diff options
Auto linted
Diffstat (limited to 'app/scripts/lib/obj-multiplex.js')
-rw-r--r-- | app/scripts/lib/obj-multiplex.js | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/app/scripts/lib/obj-multiplex.js b/app/scripts/lib/obj-multiplex.js index ad1d914f8..f54ff7653 100644 --- a/app/scripts/lib/obj-multiplex.js +++ b/app/scripts/lib/obj-multiplex.js @@ -2,11 +2,10 @@ const through = require('through2') module.exports = ObjectMultiplex - -function ObjectMultiplex(opts){ +function ObjectMultiplex (opts) { opts = opts || {} // create multiplexer - var mx = through.obj(function(chunk, enc, cb) { + var mx = through.obj(function (chunk, enc, cb) { var name = chunk.name var data = chunk.data var substream = mx.streams[name] @@ -19,19 +18,19 @@ function ObjectMultiplex(opts){ }) mx.streams = {} // create substreams - mx.createStream = function(name) { - var substream = mx.streams[name] = through.obj(function(chunk, enc, cb) { + mx.createStream = function (name) { + var substream = mx.streams[name] = through.obj(function (chunk, enc, cb) { mx.push({ name: name, data: chunk, }) return cb() }) - mx.on('end', function() { + mx.on('end', function () { return substream.emit('end') }) if (opts.error) { - mx.on('error', function() { + mx.on('error', function () { return substream.emit('error') }) } |