mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-22 20:39:17 +08:00
Add v2.0 options and defaults to xml2js
This commit is contained in:
@@ -17,3 +17,10 @@ var outString = builder.buildObject({
|
||||
});
|
||||
|
||||
var parser = new xml2js.Parser();
|
||||
|
||||
var v1Defaults = xml2js.defaults['0.1'];
|
||||
v1Defaults.async = true;
|
||||
|
||||
var v2Defaults = xml2js.defaults['0.2'];
|
||||
v2Defaults.async = false;
|
||||
v2Defaults.chunkSize = 20000;
|
||||
30
xml2js/xml2js.d.ts
vendored
30
xml2js/xml2js.d.ts
vendored
@@ -1,6 +1,6 @@
|
||||
// Type definitions for node-xml2js
|
||||
// Project: https://github.com/Leonidas-from-XIV/node-xml2js
|
||||
// Definitions by: Michel Salib <https://github.com/michelsalib>, Jason McNeil <https://github.com/jasonrm>
|
||||
// Definitions by: Michel Salib <https://github.com/michelsalib>, Jason McNeil <https://github.com/jasonrm>, Christopher Currens <https://github.com/ccurrens>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module 'xml2js' {
|
||||
@@ -11,6 +11,11 @@ declare module 'xml2js' {
|
||||
function parseString(xml: string, callback: (err: any, result: any) => void): void;
|
||||
function parseString(xml: string, options: Options, callback: (err: any, result: any) => void): void;
|
||||
|
||||
var defaults: {
|
||||
'0.1': Options;
|
||||
'0.2': OptionsV2;
|
||||
}
|
||||
|
||||
class Builder {
|
||||
constructor(options?: BuilderOptions);
|
||||
buildObject(rootObj: any): string;
|
||||
@@ -50,7 +55,8 @@ declare module 'xml2js' {
|
||||
interface Options {
|
||||
async?: boolean;
|
||||
attrkey?: string;
|
||||
attrNameProcessors?: (name: string) => string;
|
||||
attrNameProcessors?: [(name: string) => string];
|
||||
attrValueProcessors?: [(name: string) => string];
|
||||
charkey?: string;
|
||||
charsAsChildren?: boolean;
|
||||
childkey?: string;
|
||||
@@ -67,7 +73,27 @@ declare module 'xml2js' {
|
||||
tagNameProcessors?: [(name: string) => string];
|
||||
trim?: boolean;
|
||||
validator?: Function;
|
||||
valueProcessors?: [(name: string) => string];
|
||||
xmlns?: boolean;
|
||||
}
|
||||
|
||||
interface OptionsV2 extends Options {
|
||||
preserveChildrenOrder?: boolean;
|
||||
rootName?: string;
|
||||
xmldec?: {
|
||||
version: string;
|
||||
encoding?: string;
|
||||
standalone?: boolean;
|
||||
};
|
||||
doctype?: any;
|
||||
renderOpts?: {
|
||||
pretty?: boolean;
|
||||
indent?: string;
|
||||
newline?: string;
|
||||
};
|
||||
headless?: boolean;
|
||||
chunkSize?: number;
|
||||
cdata?: boolean;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user