UNPKG

490 BJavaScriptView Raw
1const Streamz = require('streamz');
2const util = require('util');
3
4function 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
13util.inherits(Stringify,Streamz);
14
15Stringify.prototype._fn = function(d) {
16 return JSON.stringify(d,this.replacer,this.indent) + (this.newline ? '\n' : '');
17};
18
19module.exports = Stringify;
\No newline at end of file