diff --git a/types/jsonstream/index.d.ts b/types/jsonstream/index.d.ts index cf0f0fdd43..3e9bdd4b12 100644 --- a/types/jsonstream/index.d.ts +++ b/types/jsonstream/index.d.ts @@ -14,7 +14,25 @@ export interface Options { export declare function parse(pattern: any): NodeJS.ReadWriteStream; export declare function parse(patterns: any[]): NodeJS.ReadWriteStream; + +/** + * Create a writable stream. + * you may pass in custom open, close, and seperator strings. But, by default, + * JSONStream.stringify() will create an array, + * (with default options open='[\n', sep='\n,\n', close='\n]\n') + */ export declare function stringify(): NodeJS.ReadWriteStream; + +/** If you call JSONStream.stringify(false) the elements will only be seperated by a newline. */ +export declare function stringify(newlineOnly: NewlineOnlyIndicator): NodeJS.ReadWriteStream; +type NewlineOnlyIndicator = false + +/** + * Create a writable stream. + * you may pass in custom open, close, and seperator strings. But, by default, + * JSONStream.stringify() will create an array, + * (with default options open='[\n', sep='\n,\n', close='\n]\n') + */ export declare function stringify(open: string, sep: string, close: string): NodeJS.ReadWriteStream; export declare function stringifyObject(): NodeJS.ReadWriteStream; diff --git a/types/jsonstream/jsonstream-tests.ts b/types/jsonstream/jsonstream-tests.ts index d42ab0d845..68c8e858ac 100644 --- a/types/jsonstream/jsonstream-tests.ts +++ b/types/jsonstream/jsonstream-tests.ts @@ -8,6 +8,7 @@ read = read.pipe(json.parse('*')); read = read.pipe(json.parse(['foo/*', 'bar/*'])); read = json.stringify(); +read = json.stringify(false); read = json.stringify('{', ',', '}'); read = json.stringifyObject();