mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-02 06:29:40 +08:00
Merge pull request #21759 from gburgett/jsonstream
[JSONStream] add stringify(false) overload
This commit is contained in:
18
types/jsonstream/index.d.ts
vendored
18
types/jsonstream/index.d.ts
vendored
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user