diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 801a1d07ac..e026bac5b1 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -326,6 +326,7 @@ All definitions files include a header with the author and editors, so at some p * [WinRT](http://msdn.microsoft.com/en-us/library/windows/apps/br211377.aspx) (from TypeScript samples) * [ws](http://einaros.github.io/ws/) (by [Paul Loyd](https://github.com/loyd)) * [x2js](https://code.google.com/p/x2js/) (by [Hiroki Horiuchi](https://github.com/horiuchi/)) +* [xml2js](https://github.com/Leonidas-from-XIV/node-xml2js) (by [Michel Salib](https://github.com/michelsalib)) * [XRegExp](http://xregexp.com/) (by [Bart van der Schoor](https://github.com/Bartvds)) * [YouTube](https://developers.google.com/youtube/) (by [Daz Wilkin](https://github.com/DazWilkin/)) * [YouTube Analytics API](https://developers.google.com/youtube/analytics/) (by [Frank M](https://github.com/sgtfrankieboy)) diff --git a/xml2js/xml2js-tests.ts b/xml2js/xml2js-tests.ts new file mode 100644 index 0000000000..3e3fbb661c --- /dev/null +++ b/xml2js/xml2js-tests.ts @@ -0,0 +1,7 @@ +/// + +import xml2js = require('xml2js'); + +xml2js.parseString("Hello xml2js!", (err: any, result: any) => { }); + +xml2js.parseString("Hello xml2js!", {trim: true}, (err: any, result: any) => { }); diff --git a/xml2js/xml2js.d.ts b/xml2js/xml2js.d.ts new file mode 100644 index 0000000000..2b5aabc4db --- /dev/null +++ b/xml2js/xml2js.d.ts @@ -0,0 +1,36 @@ +// Type definitions for node-xml2js +// Project: https://github.com/Leonidas-from-XIV/node-xml2js +// Definitions by: Michel Salib +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module 'xml2js' { + + export = xml2js; + + 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; + + interface Options { + attrkey?: string; + charkey?: string; + explicitCharkey?: boolean; + trim?: boolean; + normalizeTags?: boolean; + normalize?: boolean; + explicitRoot?: boolean; + emptyTag?: any; + explicitArray?: boolean; + ignoreAttrs?: boolean; + mergeAttrs?: boolean; + validator?: Function; + xmlns?: boolean; + explicitChildren?: boolean; + charsAsChildren?: boolean; + async?: boolean; + strict?: boolean; + attrNameProcessors?: (name: string) => string; + tagNameProcessors?: (name: string) => string; + } + } +}