(opts = {})
| 13 | |
| 14 | class Stringifier extends Transform { |
| 15 | constructor(opts = {}) { |
| 16 | super({ ...{ writableObjectMode: true }, ...opts }); |
| 17 | const [err, options] = normalize_options(opts); |
| 18 | if (err !== undefined) throw err; |
| 19 | // Expose options |
| 20 | this.options = options; |
| 21 | // Internal state |
| 22 | this.state = { |
| 23 | stop: false, |
| 24 | }; |
| 25 | // Information |
| 26 | this.info = { |
| 27 | records: 0, |
| 28 | }; |
| 29 | this.api = stringifier(this.options, this.state, this.info); |
| 30 | this.api.options.on_record = (...args) => { |
| 31 | this.emit("record", ...args); |
| 32 | }; |
| 33 | } |
| 34 | _transform(chunk, encoding, callback) { |
| 35 | if (this.state.stop === true) { |
| 36 | return; |
nothing calls this directly
no test coverage detected