Comparing version 2.0.0 to 2.0.1
var co = require('co') | ||
var describe = require('to-descriptor') | ||
@@ -20,5 +19,5 @@ | ||
if (done === true) { | ||
var thunk = co(read._flush()) | ||
var thunk = read._flush() | ||
return arguments.length === 2 | ||
? thunk.call(read, arguments[1]) | ||
? thunk(arguments[1]) | ||
: thunk | ||
@@ -25,0 +24,0 @@ } |
@@ -204,11 +204,42 @@ var EventEmitter = require('events').EventEmitter | ||
Channel.prototype._flush = function* () { | ||
if (this.discard) { | ||
while (this.readable) yield this | ||
return | ||
Channel.prototype._flush = function () { | ||
if (this.discard) return this._flushDiscard.bind(this) | ||
else return this._flushResults.bind(this) | ||
} | ||
Channel.prototype._flushDiscard = function (done) { | ||
var read = this | ||
if (!read.closed) { | ||
read.pushed(function (err, pushed) { | ||
if (!pushed) done() | ||
else read(next) | ||
}) | ||
} else { | ||
read(next) | ||
} | ||
function next(err) { | ||
if (err) done(err) | ||
else if (!read.readable) done() | ||
else read(next) | ||
} | ||
} | ||
Channel.prototype._flushResults = function (done) { | ||
var read = this | ||
var results = [] | ||
while (this.readable) results.push(yield this) | ||
return results | ||
if (!read.closed) { | ||
read.pushed(function (err, pushed) { | ||
if (!pushed) done() | ||
else read(next) | ||
}) | ||
} else { | ||
read(next) | ||
} | ||
function next(err, res) { | ||
if (err) return done(err) | ||
results.push(res) | ||
if (read.readable) return read(next) | ||
done(null, results) | ||
} | ||
} |
{ | ||
"name": "chanel", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "Channel-based control-flow for parallel tasks with concurrency control", | ||
@@ -19,2 +19,3 @@ "repository": { | ||
}, | ||
"main": "lib/index.js", | ||
"dependencies": { | ||
@@ -28,13 +29,8 @@ "generator-supported": "~0.0.1", | ||
"should": "^3.0.0", | ||
"regenerator": "*", | ||
"gnode": "*" | ||
}, | ||
"scripts": { | ||
"test": "NODE=gnode make test", | ||
"prepublish": "make clean build" | ||
"test": "NODE=gnode make test" | ||
}, | ||
"engines": { | ||
"node": ">= 0.11.3" | ||
}, | ||
"homepage": "https://github.com/cojs/chanel" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
4
1
12436
7
226