mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-05 20:02:05 +08:00
[xml2js] Add processors to the main xml2js object
This commit is contained in:
4
types/xml2js/index.d.ts
vendored
4
types/xml2js/index.d.ts
vendored
@@ -4,10 +4,12 @@
|
||||
// Jason McNeil <https://github.com/jasonrm>
|
||||
// Christopher Currens <https://github.com/ccurrens>
|
||||
// Edward Hinkle <https://github.com/edwardhinkle>
|
||||
// Behind The Math <https://github.com/BehindTheMath>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node"/>
|
||||
import { EventEmitter } from 'events';
|
||||
import * as processors from './lib/processors';
|
||||
|
||||
export function parseString(xml: convertableToString, callback: (err: any, result: any) => void): void;
|
||||
export function parseString(xml: convertableToString, options: OptionsV2, callback: (err: any, result: any) => void): void;
|
||||
@@ -76,3 +78,5 @@ export interface OptionsV2 extends Options {
|
||||
export interface convertableToString {
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
export { processors };
|
||||
|
||||
@@ -33,7 +33,7 @@ xml2js.parseString('<root>Hello xml2js!</root>', {
|
||||
}, (err: any, result: any) => { });
|
||||
|
||||
xml2js.parseString('<root>Hello xml2js!</root>', {
|
||||
attrNameProcessors: [processors.firstCharLowerCase],
|
||||
attrNameProcessors: [processors.firstCharLowerCase, xml2js.processors.normalize],
|
||||
attrValueProcessors: [processors.normalize],
|
||||
tagNameProcessors: [processors.stripPrefix],
|
||||
valueProcessors: [processors.parseBooleans, processors.parseNumbers]
|
||||
|
||||
Reference in New Issue
Block a user