"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ParseJsonStream = exports.StringifyJsonStream = void 0;
const streamWithEventPipe_1 = require("./streamWithEventPipe");
class StringifyJsonStream extends streamWithEventPipe_1.TransformWithEventPipe {
    constructor() {
        super({ objectMode: true });
    }
    _transform(item, _, done) {
        done(null, JSON.stringify(item) + '\n');
    }
}
exports.StringifyJsonStream = StringifyJsonStream;
class ParseJsonStream extends streamWithEventPipe_1.TransformWithEventPipe {
    constructor() {
        super({ objectMode: true });
    }
    _transform(data, _, done) {
        if (typeof data === 'string') {
            data = JSON.parse(data);
        }
        done(null, data);
    }
}
exports.ParseJsonStream = ParseJsonStream;
//# sourceMappingURL=jsonStream.js.map