From 4feea7435523c2d61ab551d2968f615d008d8ae2 Mon Sep 17 00:00:00 2001 From: Igor Strebezhev Date: Thu, 29 Aug 2019 02:53:32 +0300 Subject: [PATCH] Update missing options fields at xml2json (#37954) * Update missing options fields at xml2json Options are described here: https://github.com/buglabs/node-xml2json/blob/98272646816c5f5747970ee6906e206c1fdd6082/README.md * Update index.d.ts --- types/xml2json/index.d.ts | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/types/xml2json/index.d.ts b/types/xml2json/index.d.ts index 380174a270..e6e1505d35 100644 --- a/types/xml2json/index.d.ts +++ b/types/xml2json/index.d.ts @@ -1,6 +1,7 @@ -// Type definitions for xml2json 0.10 +// Type definitions for xml2json 0.11 // Project: https://github.com/buglabs/node-xml2json // Definitions by: Dolan Miu +// Igor Strebezhev // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export function toJson(xml: string, options?: { object?: false } & JsonOptions): string; export function toJson(xml: string, options?: { object: true } & JsonOptions): {}; @@ -24,6 +25,10 @@ export interface XmlOptions { * @example */ sanitize?: boolean; + /** + * Ignores all null values. + */ + ignoreNull?: boolean; } export interface JsonOptions { @@ -64,7 +69,13 @@ export interface JsonOptions { */ trim?: boolean; /** - * XML child nodes are always treated as arrays + * XML child nodes are always treated as arrays. + * You can specify a selective array of nodes for this to apply to instead of the whole document. */ - arrayNotation?: boolean; + arrayNotation?: boolean | string[]; + /** + * Changes the default textNode property from $t to _t when option is set to true. + * Alternatively a string can be specified which will override $t to what ever the string is. + */ + alternateTextNode?: boolean; }