diff options
Diffstat (limited to 'lib/waterfall.js')
-rw-r--r-- | lib/waterfall.js | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/waterfall.js b/lib/waterfall.js index 7bc60da..24befac 100644 --- a/lib/waterfall.js +++ b/lib/waterfall.js @@ -4,6 +4,7 @@ import once from './internal/once'; import rest from './internal/rest'; import onlyOnce from './internal/onlyOnce'; +import wrapAsync from './internal/wrapAsync'; /** * Runs the `tasks` array of functions in series, each passing their results to @@ -16,10 +17,10 @@ import onlyOnce from './internal/onlyOnce'; * @memberOf module:ControlFlow * @method * @category Control Flow - * @param {Array} tasks - An array of functions to run, each function is passed - * a `callback(err, result1, result2, ...)` it must call on completion. The - * first argument is an error (which can be `null`) and any further arguments - * will be passed as arguments in order to the next task. + * @param {Array} tasks - An array of [async functions]{@link AsyncFunction} + * to run. + * Each function should complete with any number of `result` values. + * The `result` values will be passed as arguments, in order, to the next task. * @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]). @@ -82,7 +83,7 @@ export default function(tasks, callback) { args.push(taskCallback); - var task = tasks[taskIndex++]; + var task = wrapAsync(tasks[taskIndex++]); task.apply(null, args); } |