diff options
author | Alexander Early <alexander.early@gmail.com> | 2016-06-07 18:32:02 -0700 |
---|---|---|
committer | Alexander Early <alexander.early@gmail.com> | 2016-06-07 18:32:02 -0700 |
commit | 428a3004417c1c456dceecc1ba1c68afe24122fc (patch) | |
tree | 07b74085c7e31740909e24ad2f35f5f239cc2ab9 /lib/waterfall.js | |
parent | 6932085d7ca452e8c081ea709d8994fcb0246e27 (diff) | |
download | async-428a3004417c1c456dceecc1ba1c68afe24122fc.tar.gz |
fix new lint errors
Diffstat (limited to 'lib/waterfall.js')
-rw-r--r-- | lib/waterfall.js | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/waterfall.js b/lib/waterfall.js index 62bbdfe..9478bd9 100644 --- a/lib/waterfall.js +++ b/lib/waterfall.js @@ -22,6 +22,7 @@ import onlyOnce from './internal/onlyOnce'; * @param {Function} [callback] - An optional callback to run once all the * functions have completed. This will be passed the results of the last task's * callback. Invoked with (err, [results]). + * @returns undefined * @example * * async.waterfall([ @@ -60,20 +61,20 @@ import onlyOnce from './internal/onlyOnce'; * callback(null, 'done'); * } */ -export default function(tasks, cb) { - cb = once(cb || noop); - if (!isArray(tasks)) return cb(new Error('First argument to waterfall must be an array of functions')); - if (!tasks.length) return cb(); +export default function(tasks, callback) { + callback = once(callback || noop); + if (!isArray(tasks)) return callback(new Error('First argument to waterfall must be an array of functions')); + if (!tasks.length) return callback(); var taskIndex = 0; function nextTask(args) { if (taskIndex === tasks.length) { - return cb.apply(null, [null].concat(args)); + return callback.apply(null, [null].concat(args)); } var taskCallback = onlyOnce(rest(function(err, args) { if (err) { - return cb.apply(null, [err].concat(args)); + return callback.apply(null, [err].concat(args)); } nextTask(args); })); |