1 | const Streamz = require('streamz');
|
2 | const util = require('util');
|
3 |
|
4 | function Stringify(indent,replacer,newline) {
|
5 | if (!(this instanceof Streamz))
|
6 | return new Stringify(indent,replacer,newline);
|
7 | Streamz.call(this);
|
8 | this.indent = indent;
|
9 | this.replacer = replacer;
|
10 | this.newline = newline;
|
11 | }
|
12 |
|
13 | util.inherits(Stringify,Streamz);
|
14 |
|
15 | Stringify.prototype._fn = function(d) {
|
16 | return JSON.stringify(d,this.replacer,this.indent) + (this.newline ? '\n' : '');
|
17 | };
|
18 |
|
19 | module.exports = Stringify; |
\ | No newline at end of file |