Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function Writable(options) {
var Duplex = require("./_stream_duplex");
if (!(this instanceof Writable) && !(this instanceof Duplex))
return new Writable(options);
this._writableState = new WritableState(options, this);
this.writable = true;
Stream.call(this);
}
Writable.prototype.pipe = function() {
function Readable(options) {
var Duplex = require("./_stream_duplex");
if (!(this instanceof Readable))
return new Readable(options);
this._readableState = new ReadableState(options, this);
this.readable = true;
Stream.call(this);
}
Readable.prototype.push = function(chunk, encoding) {
export function createLearnStreamForCategory(category) {
return Stream ? new Stream.Writable({
decodeStrings: false,
write: function write(chunk, encoding, next) {
var text = chunk.toString('utf8');
this.learn(text, category);
next();
}.bind(this)
}) : undefined;
};
Readable.prototype.on = function(ev, fn) {
var res = Stream.prototype.on.call(this, ev, fn);
if (ev === 'data' && false !== this._readableState.flowing) {
this.resume();
}
if (ev === 'readable' && this.readable) {
var state = this._readableState;
if (!state.readableListening) {
state.readableListening = true;
state.emittedReadable = false;
state.needReadable = true;
if (!state.reading) {
var self = this;
process.nextTick(function() {
debug('readable nexttick read 0');
self.read(0);
});
} else if (state.length) {