DefinitelyTyped/types/jsonstream/jsonstream-tests.ts
Gordon Burgett 4148e85675
[JSONStream] add stringify(false) overload
Package docs allow `false` as a parameter to `stringify`, in addition
  to `stringify(open, sep, close)`.  This is useful for dumping a stream
  of objects separated by newlines, rather than creating a JSON array of
  the objects.

  from https://www.npmjs.com/package/JSONStream

    > If you call JSONStream.stringify(false) the elements will only be
    > seperated by a newline.
2017-11-26 08:46:44 -07:00

16 lines
362 B
TypeScript

import json = require('jsonstream');
var read: NodeJS.ReadableStream;
var write: NodeJS.WritableStream;
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();
read = json.stringifyObject('{', ',', '}');