From 4bf7b36a66613aa2879c0b4916bba40b411e162b Mon Sep 17 00:00:00 2001 From: Behind The Math Date: Thu, 26 Oct 2017 22:42:00 -0400 Subject: [PATCH] [xml2js] Add processors to the main xml2js object --- types/xml2js/index.d.ts | 4 ++++ types/xml2js/xml2js-tests.ts | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/types/xml2js/index.d.ts b/types/xml2js/index.d.ts index 59af909a09..30465ae8d5 100644 --- a/types/xml2js/index.d.ts +++ b/types/xml2js/index.d.ts @@ -4,10 +4,12 @@ // Jason McNeil // Christopher Currens // Edward Hinkle +// Behind The Math // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// 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 }; diff --git a/types/xml2js/xml2js-tests.ts b/types/xml2js/xml2js-tests.ts index 4ee1c04e5a..d3298dbf4c 100644 --- a/types/xml2js/xml2js-tests.ts +++ b/types/xml2js/xml2js-tests.ts @@ -33,7 +33,7 @@ xml2js.parseString('Hello xml2js!', { }, (err: any, result: any) => { }); xml2js.parseString('Hello xml2js!', { - attrNameProcessors: [processors.firstCharLowerCase], + attrNameProcessors: [processors.firstCharLowerCase, xml2js.processors.normalize], attrValueProcessors: [processors.normalize], tagNameProcessors: [processors.stripPrefix], valueProcessors: [processors.parseBooleans, processors.parseNumbers]