Run a series of callbacks in sequence.
Run a series of callbacks in sequence, as simply as possible.
npm install async-series
series(tasks, callback, safe)
tasks is an array of functions, each with their own
callback is called when finished. Setting
safe to true
will ensure there's at least a tick between each task to prevent RangeErrors.
seriesconsole.log'first thing'doneconsole.log'second thing'done'another thing'// never happens, because "second thing"// passed an error to the done() callbackconsole.logerrmessage // "another thing"