Comparing version 0.0.4 to 0.0.5
@@ -49,2 +49,3 @@ var EventEmitter = require('events').EventEmitter; | ||
this.batchSize = flow.batchSize; | ||
this.data = flow.data; | ||
this.err = flow.err; | ||
@@ -75,2 +76,3 @@ this.next = this.next.bind(this); | ||
this.batchSize = flow.batchSize; | ||
this.data = flow.data; | ||
this.err = flow.err; | ||
@@ -84,4 +86,4 @@ this.next = this.next.bind(this); | ||
if (this.err) { | ||
throw new Error('An error is not handled. ' + | ||
'To avoid this behavior, add the statement. "this.err = null;"\n' + | ||
throw new Error('An error is not handled. To avoid this behavior, add the statement "this.err = null;" ' + | ||
'before exiting the last function. ' + | ||
'The unhandled error is following:\n' + | ||
@@ -176,2 +178,3 @@ this.err.stack); | ||
args: self.callerArgs, | ||
data: {}, | ||
err: undefined, | ||
@@ -208,2 +211,3 @@ lastStep: lastStep, | ||
this.isLast = this.index === runner.lastIndex; | ||
this.data = runner.callerContext.data; | ||
this.next = this.next.bind(this); | ||
@@ -236,4 +240,3 @@ this.end = this.end.bind(this); | ||
SerialContext.prototype.end = function (err) { | ||
this.runner.callerContext.err = err; | ||
this.runner.endSerial.apply(this.runner, Array.prototype.slice.call(arguments, 1)); | ||
this.runner.callerContext.end.apply(this.runner.callerContext, arguments); | ||
}; | ||
@@ -286,2 +289,3 @@ | ||
this.batchSize = runner.batchSize; | ||
this.data = runner.callerContext.data; | ||
this.next = this.next.bind(this); | ||
@@ -303,4 +307,6 @@ this.end = this.end.bind(this); | ||
ParallelContext.prototype.end = function () { | ||
this.runner.callerContext.err = arguments[0]; | ||
this.runner.endParallel.apply(this.runner, Array.prototype.slice.call(arguments, 1)); | ||
if (!this.runner.isEnded) { | ||
this.runner.isEnded = true; | ||
this.runner.callerContext.end.apply(this.runner.callerContext, arguments); | ||
} | ||
}; | ||
@@ -325,3 +331,3 @@ | ||
this.isEnded = true; | ||
this.callerContext.next.apply(this.callerContext, Array.prototype.slice.apply(arguments)); | ||
this.callerContext.next.apply(this.callerContext, arguments); | ||
} | ||
@@ -372,6 +378,6 @@ }; | ||
Nue.prototype.flow = function () { | ||
var tasks = Array.prototype.slice.apply(arguments); | ||
var tasks = Array.prototype.slice.call(arguments); | ||
var batchSize = this.batchSize; | ||
var fn = function () { | ||
var args = Array.prototype.slice.apply(arguments); | ||
var args = Array.prototype.slice.call(arguments); | ||
runFlow(batchSize, tasks, fn, args, this); | ||
@@ -544,2 +550,3 @@ }; | ||
this.queue = runner.queue; | ||
this.data = this.queue.data; | ||
this.index = this.queue.index; | ||
@@ -639,2 +646,3 @@ this.isFirst = this.index === 0; | ||
this.queue = runner.queue; | ||
this.data = this.queue.data; | ||
this.next = this.next.bind(this); | ||
@@ -652,4 +660,6 @@ this.end = this.end.bind(this); | ||
ParallelQueueContext.prototype.end = function () { | ||
this.queue.isCanceled = true; | ||
this.queue.callerContext.end.apply(this.queue.callerContext, arguments); | ||
if (!this.queue.isCanceled) { | ||
this.queue.isCanceled = true; | ||
this.queue.callerContext.end.apply(this.queue.callerContext, arguments); | ||
} | ||
}; | ||
@@ -726,3 +736,3 @@ | ||
exports.version = '0.0.4'; | ||
exports.version = '0.0.5'; | ||
@@ -732,69 +742,55 @@ exports.batchSize = exports.DEFAULT_BATCH_SIZE; | ||
exports.flow = function () { | ||
var args = Array.prototype.slice.apply(arguments); | ||
return wrapOrApply(Nue.prototype.flow, args); | ||
return wrapOrApply(Nue.prototype.flow, arguments); | ||
}; | ||
exports.forEach = function () { | ||
var args = Array.prototype.slice.apply(arguments); | ||
return wrapOrApply(Nue.prototype.forEach, args); | ||
return wrapOrApply(Nue.prototype.forEach, arguments); | ||
}; | ||
exports.map = function () { | ||
var args = Array.prototype.slice.apply(arguments); | ||
return wrapOrApply(Nue.prototype.map, args); | ||
return wrapOrApply(Nue.prototype.map, arguments); | ||
}; | ||
exports.filter = function () { | ||
var args = Array.prototype.slice.apply(arguments); | ||
return wrapOrApply(Nue.prototype.filter, args); | ||
return wrapOrApply(Nue.prototype.filter, arguments); | ||
}; | ||
exports.every = function () { | ||
var args = Array.prototype.slice.apply(arguments); | ||
return wrapOrApply(Nue.prototype.every, args); | ||
return wrapOrApply(Nue.prototype.every, arguments); | ||
}; | ||
exports.some = function () { | ||
var args = Array.prototype.slice.apply(arguments); | ||
return wrapOrApply(Nue.prototype.some, args); | ||
return wrapOrApply(Nue.prototype.some, arguments); | ||
}; | ||
exports.queue = function () { | ||
var args = Array.prototype.slice.apply(arguments); | ||
return wrapOrApply(Nue.prototype.queue, args); | ||
return wrapOrApply(Nue.prototype.queue, arguments); | ||
}; | ||
exports.parallel = function () { | ||
var args = Array.prototype.slice.apply(arguments); | ||
return wrapOrApply(Nue.prototype.parallel, args); | ||
return wrapOrApply(Nue.prototype.parallel, arguments); | ||
}; | ||
exports.parallelForEach = function () { | ||
var args = Array.prototype.slice.apply(arguments); | ||
return wrapOrApply(Nue.prototype.parallelForEach, args); | ||
return wrapOrApply(Nue.prototype.parallelForEach, arguments); | ||
}; | ||
exports.parallelMap = function () { | ||
var args = Array.prototype.slice.apply(arguments); | ||
return wrapOrApply(Nue.prototype.parallelMap, args); | ||
return wrapOrApply(Nue.prototype.parallelMap, arguments); | ||
}; | ||
exports.parallelFilter = function () { | ||
var args = Array.prototype.slice.apply(arguments); | ||
return wrapOrApply(Nue.prototype.parallelFilter, args); | ||
return wrapOrApply(Nue.prototype.parallelFilter, arguments); | ||
}; | ||
exports.parallelEvery = function () { | ||
var args = Array.prototype.slice.apply(arguments); | ||
return wrapOrApply(Nue.prototype.parallelEvery, args); | ||
return wrapOrApply(Nue.prototype.parallelEvery, arguments); | ||
}; | ||
exports.parallelSome = function () { | ||
var args = Array.prototype.slice.apply(arguments); | ||
return wrapOrApply(Nue.prototype.parallelSome, args); | ||
return wrapOrApply(Nue.prototype.parallelSome, arguments); | ||
}; | ||
exports.parallelQueue = function () { | ||
var args = Array.prototype.slice.apply(arguments); | ||
return wrapOrApply(Nue.prototype.parallelQueue, args); | ||
return wrapOrApply(Nue.prototype.parallelQueue, arguments); | ||
}; | ||
@@ -801,0 +797,0 @@ |
@@ -12,3 +12,3 @@ { | ||
}, | ||
"version" : "0.0.4" | ||
"version" : "0.0.5" | ||
} |
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
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
4928
0
31009
784