Async control flow patterns using promises based on https://github.com/caolan/async
It needs an ES6 environment to work (Promises, Block-scoped binding constructs, etc) like modern browsers and node 4.
Example:
var asyncP = require('async-promises');
var args = [];
return asyncP
.each([1, 3, 2], (x) => {
return new Promise(function (resolve) {
setTimeout(() => {
args.push(x);
resolve();
}, x * 25);
});
})
.then(() => {
console.log(args); //prints [1, 2, 3]
});
- Collections
- each
- eachSeries
- map
- mapSeries
- filter
- filterSeries
- reduce
- reduceRight
- some
- every
- Control Flow
- series
- parallel
- waterfall
- retry
- times
- timesSeries