var stream = require("readable-stream"); var BunWrapper = function BunWrapper(options) { options = options || {}; if (Array.isArray(options)) { options = {streams: options}; } options.objectMode = true; stream.Duplex.call(this, options); var self = this; // grab a copy of the streams array this._streams = (options.streams || []).slice(); // we need at least one stream to do things if (this._streams.length === 0) { this._streams.push(new stream.PassThrough({objectMode: true})); } // default: true this._bubbleErrors = (typeof options.bubbleErrors === "undefined") || !!options.bubbleErrors; // error bubbling! yay! if (this._bubbleErrors) { for (var i=0;i 1, 1 -> 2, ..., n-1 -> n for (var i=0;i