Merge pull request #21759 from gburgett/jsonstream

[JSONStream] add stringify(false) overload
This commit is contained in:
Armando Aguirre
2017-12-01 13:10:50 -08:00
committed by GitHub
2 changed files with 19 additions and 0 deletions

View File

@@ -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;

View File

@@ -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();