Async.js async is a great shortcut for restraining deeply nested functions and callbacks. This module adds a chainable API to:
(This is particularly useful in single-file executable scripts.)
Note: It is important to understand how Async.js works to appreciate this example.
var async = ;async// Waterfall – expect a returned value from callback// Series// Switch to parallel// Finish;
function(cb)run in series
function(arg1…n, cb)where arg1…n is the expected arguments to be returned from the previous callback, this signature will always be matched so that the last argument is the callback
function(cb)run in parallel
This module will attempt to extend a shallow clone of whatever version async you already have. The module therefore makes available all the methods already available on standard async. Perhaps, if we can establish that the 'chain' method name wouldn't clash with standard async, we could just extend without cloning.