stream-stream
Advanced tools
Comparing version 1.2.1 to 1.2.2
{ | ||
"name": "stream-stream", | ||
"version": "1.2.1", | ||
"version": "1.2.2", | ||
"description": "A stream of streams in order to concatenates the contents of several streams", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -31,3 +31,3 @@ [![Build Status](https://travis-ci.org/Floby/node-stream-stream.png?branch=master)](https://travis-ci.org/Floby/node-stream-stream) | ||
steam.pipe(process.stdout); | ||
stream.pipe(process.stdout); | ||
``` | ||
@@ -34,0 +34,0 @@ |
var stream = require('stream'); | ||
var SS = require('../'); | ||
var sink = require('stream-sink'); | ||
var domain = require('domain'); | ||
Function.prototype.withDomain = function(withStack) { | ||
var fn = this; | ||
return function(test) { | ||
var d = domain.create(); | ||
d.on('error', function(e) { | ||
test.fail('test failed with ' + e.message); | ||
if(withStack) { | ||
console.error(e.stack) | ||
} | ||
test.done(); | ||
}); | ||
d.run(fn.bind(this, test)); | ||
} | ||
} | ||
exports.testMultiSync = function(test) { | ||
@@ -18,8 +35,10 @@ var a = new stream.PassThrough(); | ||
ss.write(a); | ||
a.end('hello'); | ||
b.end(' world'); | ||
ss.write(b); | ||
ss.end(c); | ||
c.end('!'); | ||
process.nextTick(function () { | ||
ss.write(a); | ||
a.end('hello'); | ||
b.end(' world'); | ||
ss.write(b); | ||
ss.end(c); | ||
c.end('!'); | ||
}) | ||
@@ -32,3 +51,3 @@ var to = setTimeout(function(){ | ||
}, 20) | ||
} | ||
}.withDomain(true) | ||
@@ -35,0 +54,0 @@ |
@@ -5,3 +5,20 @@ var util = require('util'); | ||
var sink = require('stream-sink'); | ||
var domain = require('domain'); | ||
Function.prototype.withDomain = function(withStack) { | ||
var fn = this; | ||
return function(test) { | ||
var d = domain.create(); | ||
d.on('error', function(e) { | ||
test.fail('test failed with ' + e.message); | ||
if(withStack) { | ||
console.error(e.stack) | ||
} | ||
test.done(); | ||
}); | ||
d.run(fn.bind(this, test)); | ||
} | ||
} | ||
function EmitStream (array) { | ||
@@ -14,3 +31,3 @@ stream.Readable.call(this, {objectMode:true}); | ||
var chunk = this._source.shift(); | ||
if(!chunk) this.push(null); | ||
if(!chunk) return this.push(null); | ||
@@ -21,3 +38,3 @@ var s = new stream.PassThrough(); | ||
}); | ||
this.push(s); | ||
this.push(s) | ||
} | ||
@@ -44,2 +61,2 @@ | ||
} | ||
}.withDomain(true) |
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
16287
436