ordered-read-streams
Advanced tools
Comparing version 0.0.6 to 0.0.7
15
index.js
@@ -21,4 +21,3 @@ var Readable = require('stream').Readable; | ||
} else { | ||
// initial index in list of streams | ||
this._currentIndex = 0; | ||
// stream data buffer | ||
this._buff = {}; | ||
@@ -37,4 +36,4 @@ this._totalStreams = streams.length; | ||
s.on('data', function (data) { | ||
if (i === self._currentIndex) { | ||
// data got from stream, which is at current index | ||
if (i === 0) { | ||
// from first stream we simply push data | ||
self.push(data); | ||
@@ -46,7 +45,4 @@ } else { | ||
s.on('end', function () { | ||
if (i === self._currentIndex) { | ||
// stream ended and it at current index | ||
self._currentIndex++; | ||
} | ||
if (!--self._openedStreams) { | ||
// no more opened streams | ||
// flush buffered data (if any) before end | ||
@@ -62,5 +58,2 @@ for (var j = 0; j < self._totalStreams; j++) { | ||
s.on('error', function (e) { | ||
if (i === self._currentIndex) { | ||
self._currentIndex++; | ||
} | ||
self.emit('error', e); | ||
@@ -67,0 +60,0 @@ }); |
{ | ||
"name": "ordered-read-streams", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"description": "Combines array of streams into one read stream in strict order", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "mocha -R spec && jshint *.js test/*.js" | ||
"test": "jshint *.js test/*.js && mocha -R spec" | ||
}, | ||
@@ -9,0 +9,0 @@ "repository": { |
@@ -113,3 +113,3 @@ var should = require('should'); | ||
streams.on('end', function () { | ||
results.length.should.equal(3); | ||
results.length.should.be.exactly(3); | ||
results[0].should.equal('stream 1'); | ||
@@ -116,0 +116,0 @@ results[1].should.equal('stream 2'); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8587
195