This commit is contained in:
Your Name
2026-08-11 17:41:36 +08:00
parent cfe4c82c90
commit 03fe4ddf9d
18771 changed files with 3617239 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
var noop = require('./noop');
var nextTick = require('./nextTick');
var restArgs = require('./restArgs');
exports = function(tasks, cb) {
cb = cb || noop;
var current = 0;
var taskCb = restArgs(function(err, args) {
if (++current >= tasks.length || err) {
args.unshift(err);
nextTick(function() {
cb.apply(null, args);
});
} else {
args.push(taskCb);
tasks[current].apply(null, args);
}
});
if (tasks.length) {
tasks[0](taskCb);
} else {
nextTick(function() {
cb();
});
}
};
module.exports = exports;