Promise Series
Execute array of methods that return promises, in series.
Installation
$ npm install promise-series
Basic Usage
var promiseSeries = ; var { return { ; };}; var { return { ; };}; ;
This will print:
'hello' 'world' //results are returned in the order they were executed
Halt condition
Optionally, you make choose to provide a callback that is run against each result. If the test fails, the subsequent functions in the series will not be executed, and the series will resolve immediately.
var { return { ; };}; var { return { ; };}; var { return { ; };}; ;
This will print:
//note that func3 is not included, because func2 failed before it ran//also note that results include the failed resulttrue false
Non-standard inputs
If a function does not return a promise, the return value will be passed through to the results:
var { return 'cruel';}; ;
This will print:
'hello' 'cruel' 'world'
If one of the inputs is not a function, the input will be passed through to the results:
;
This will print:
'hello' 'foo' 42 'world'