run-waterfall
Run an array of functions in series, each passing its results to the next function
install
npm install run-waterfall
usage
waterfall(tasks, [callback])
Runs the tasks
array of functions in series, each passing their results to the next in
the array. However, if any of the tasks
pass an error to their own callback, the next
function is not executed, and the main callback
is immediately called with the error.
arguments
tasks
- An array of functions to run, each function is passed acallback(err, result1, result2, ...)
it must call on completion. The first argument is an error (which can benull
) and any further arguments will be passed as arguments in order to the next task.callback(err, [results])
- An optional callback to run once all the functions have completed. This will be passed the results of the last task's callback.
example
var waterfall =
This module is basically equavalent to
async.waterfall
, but it's
handy to just have the functions you need instead of the kitchen sink. Modularity!
Especially handy if you're serving to the browser and need to reduce your javascript
bundle size.
Works great in the browser with browserify!
see also
license
MIT. Copyright (c) Feross Aboukhadijeh.
Image credit: Waterfall designed by Luis Prado