pull-stream
Advanced tools
Comparing version 2.18.2 to 2.18.3
@@ -5,3 +5,3 @@ | ||
var throughs = require('./throughs') | ||
var u = require('./util') | ||
var u = require('pull-core') | ||
@@ -8,0 +8,0 @@ for(var k in sources) |
@@ -1,2 +0,2 @@ | ||
var u = require('./util') | ||
var u = require('pull-core') | ||
var prop = u.prop | ||
@@ -3,0 +3,0 @@ var id = u.id |
{ | ||
"name": "pull-stream", | ||
"description": "minimal pull stream", | ||
"version": "2.18.2", | ||
"version": "2.18.3", | ||
"homepage": "https://github.com/dominictarr/pull-stream", | ||
@@ -11,2 +11,3 @@ "repository": { | ||
"dependencies": { | ||
"pull-core": "~1.0.0" | ||
}, | ||
@@ -13,0 +14,0 @@ "devDependencies": { |
40
sinks.js
var drain = exports.drain = function (read, op, done) { | ||
;(function next() { | ||
var sync = true, returned = false, loop = true | ||
do { | ||
returned = false; sync = true | ||
read(null, function (err, data) { | ||
returned = true | ||
if(err) { | ||
done && done(err === true ? null : err) | ||
return loop = false | ||
var loop = true, cbed = false | ||
while(loop) { | ||
cbed = false | ||
read(null, function (end, data) { | ||
cbed = true | ||
if(end) { | ||
loop = false | ||
done && done(end === true ? null : end) | ||
} | ||
if(op) { | ||
//return false to abort! | ||
if(false === op(data)) { | ||
loop = false | ||
return read(true, done || function () {}) | ||
} | ||
else if(op && false === op(data)) { | ||
loop = false | ||
read(true, done || function () {}) | ||
} | ||
if(!sync) next() | ||
else if(!loop){ | ||
next() | ||
} | ||
}) | ||
sync = false | ||
if(!returned) return | ||
} while (loop); | ||
if(!cbed) { | ||
loop = false | ||
return | ||
} | ||
} | ||
})() | ||
@@ -27,0 +27,0 @@ } |
var pull = require('../') | ||
var test = require('tape') | ||
require('tape')('group', function (t) { | ||
process.on('uncaughtException', function (err) { | ||
console.error(err.stack) | ||
}) | ||
test('group', function (t) { | ||
pull.count() | ||
@@ -19,2 +24,3 @@ .pipe(pull.take(20)) | ||
} | ||
process.nextTick(cb.bind(null, end, data)) | ||
@@ -24,3 +30,4 @@ }) | ||
}) | ||
.pipe(pull.drain(function () { | ||
.pipe(pull.drain(null, function (err) { | ||
t.notOk(err) | ||
t.end() | ||
@@ -30,3 +37,3 @@ })) | ||
require('tape')('flatten (ungroup)', function (t) { | ||
test('flatten (ungroup)', function (t) { | ||
pull.count() | ||
@@ -41,2 +48,3 @@ .pipe(pull.take(20)) | ||
.pipe(pull.collect(function (err, ary) { | ||
t.notOk(err) | ||
console.log(ary) | ||
@@ -46,4 +54,3 @@ t.deepEqual(ary, [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]) | ||
})) | ||
}) | ||
@@ -1,2 +0,2 @@ | ||
var u = require('./util') | ||
var u = require('pull-core') | ||
var sources = require('./sources') | ||
@@ -3,0 +3,0 @@ var sinks = require('./sinks') |
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
40268
1
29
1064
+ Addedpull-core@~1.0.0
+ Addedpull-core@1.0.0(transitive)