stream-splicer
Advanced tools
Comparing version 1.3.2 to 2.0.0
25
index.js
var Duplex = require('readable-stream').Duplex; | ||
var PassThrough = require('readable-stream').PassThrough; | ||
var Readable = require('readable-stream').Readable; | ||
var Pass = require('readable-stream').PassThrough; | ||
var inherits = require('inherits'); | ||
var isArray = require('isarray'); | ||
var indexof = require('indexof'); | ||
var wrap = require('readable-wrap'); | ||
@@ -17,3 +14,3 @@ var nextTick = typeof setImmediate !== 'undefined' | ||
module.exports.obj = function (streams, opts) { | ||
if (!opts && !isArray(streams)) { | ||
if (!opts && !Array.isArray(streams)) { | ||
opts = streams; | ||
@@ -30,3 +27,3 @@ streams = []; | ||
if (!(this instanceof Pipeline)) return new Pipeline(streams, opts); | ||
if (!opts && !isArray(streams)) { | ||
if (!opts && !Array.isArray(streams)) { | ||
opts = streams; | ||
@@ -81,5 +78,5 @@ streams = []; | ||
if (this._streams.length > 0) return; | ||
var stream = new Pass(this._options); | ||
var stream = new PassThrough(this._options); | ||
stream.once('end', function () { | ||
var ix = indexof(self._streams, stream); | ||
var ix = self._streams.indexOf(stream); | ||
if (ix >= 0 && ix === self._streams.length - 1) { | ||
@@ -131,3 +128,3 @@ Duplex.prototype.push.call(self, null); | ||
for (var j = 2; j < args.length; j++) (function (stream) { | ||
if (isArray(stream)) { | ||
if (Array.isArray(stream)) { | ||
stream = new Pipeline(stream, self._options); | ||
@@ -141,3 +138,3 @@ } | ||
stream.once('end', function () { | ||
var ix = indexof(self._streams, stream); | ||
var ix = self._streams.indexOf(stream); | ||
if (ix >= 0 && ix === self._streams.length - 1) { | ||
@@ -164,2 +161,6 @@ Duplex.prototype.push.call(self, null); | ||
for (var i = 0; i < reps.length; i++) { | ||
reps[i].read(0); | ||
} | ||
this.emit('_mutate'); | ||
@@ -188,3 +189,3 @@ this.length = this._streams.length; | ||
Pipeline.prototype.indexOf = function (stream) { | ||
return indexof(this._streams, stream); | ||
return this._streams.indexOf(stream); | ||
}; | ||
@@ -194,3 +195,3 @@ | ||
if (typeof stream.read === 'function') return stream; | ||
var w = wrap(stream, this._wrapOptions); | ||
var w = new Readable(this._wrapOptions).wrap(stream); | ||
w._write = function (buf, enc, next) { | ||
@@ -197,0 +198,0 @@ if (stream.write(buf) === false) { |
{ | ||
"name": "stream-splicer", | ||
"version": "1.3.2", | ||
"version": "2.0.0", | ||
"description": "streaming pipeline with a mutable configuration", | ||
@@ -8,14 +8,10 @@ "main": "index.js", | ||
"inherits": "^2.0.1", | ||
"isarray": "~0.0.1", | ||
"readable-stream": "^1.1.13-1", | ||
"readable-wrap": "^1.0.0", | ||
"through2": "^1.0.0", | ||
"indexof": "0.0.1" | ||
"readable-stream": "^2.0.2" | ||
}, | ||
"devDependencies": { | ||
"tape": "^2.12.1", | ||
"JSONStream": "~0.8.2", | ||
"JSONStream": "^1.0.4", | ||
"concat-stream": "^1.4.6", | ||
"split": "~0.3.0", | ||
"object-keys": "~0.5.1" | ||
"split": "^1.0.0", | ||
"tape": "^4.2.0", | ||
"through2": "^2.0.0" | ||
}, | ||
@@ -40,21 +36,3 @@ "scripts": { | ||
}, | ||
"license": "MIT", | ||
"testling": { | ||
"files": "test/*.js", | ||
"browsers": [ | ||
"ie/8..latest", | ||
"firefox/15", | ||
"firefox/latest", | ||
"firefox/nightly", | ||
"chrome/15", | ||
"chrome/latest", | ||
"chrome/canary", | ||
"opera/12..latest", | ||
"opera/next", | ||
"safari/5.1..latest", | ||
"ipad/6.0..latest", | ||
"iphone/6.0..latest", | ||
"android-browser/4.2..latest" | ||
] | ||
} | ||
"license": "MIT" | ||
} |
var pipeline = require('../'); | ||
var through = require('through2'); | ||
var stringify = require('JSONStream').stringify; | ||
var split = require('split'); | ||
@@ -5,0 +4,0 @@ var concat = require('concat-stream'); |
var pipeline = require('../'); | ||
var through = require('through2'); | ||
var stringify = require('JSONStream').stringify; | ||
var split = require('split'); | ||
@@ -5,0 +4,0 @@ var concat = require('concat-stream'); |
var pipeline = require('../'); | ||
var through = require('through2'); | ||
var split = require('split'); | ||
var concat = require('concat-stream'); | ||
var test = require('tape'); | ||
@@ -6,0 +5,0 @@ |
var pipeline = require('../'); | ||
var through = require('through2'); | ||
var split = require('split'); | ||
var concat = require('concat-stream'); | ||
var test = require('tape'); | ||
@@ -6,0 +4,0 @@ |
var pipeline = require('../'); | ||
var through = require('through2'); | ||
var split = require('split'); | ||
var concat = require('concat-stream'); | ||
var test = require('tape'); | ||
@@ -6,0 +4,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
2
25822
647
140
+ Addedisarray@1.0.0(transitive)
+ Addedprocess-nextick-args@2.0.1(transitive)
+ Addedreadable-stream@2.3.8(transitive)
+ Addedsafe-buffer@5.1.2(transitive)
+ Addedstring_decoder@1.1.1(transitive)
+ Addedutil-deprecate@1.0.2(transitive)
- Removedindexof@0.0.1
- Removedisarray@~0.0.1
- Removedreadable-wrap@^1.0.0
- Removedthrough2@^1.0.0
- Removedindexof@0.0.1(transitive)
- Removedisarray@0.0.1(transitive)
- Removedreadable-stream@1.1.14(transitive)
- Removedreadable-wrap@1.0.0(transitive)
- Removedstring_decoder@0.10.31(transitive)
- Removedthrough2@1.1.1(transitive)
- Removedxtend@4.0.2(transitive)
Updatedreadable-stream@^2.0.2