An async version of array.reduce().
npm install tw-async-reduceasyncReduce functions similarly to array.reduce, but expects the callback to return a promise. Each iteration waits for the previous callback to complete before continuing the chain.
current is the first argument, then index, then accumulator. These arguments are the same as those found in the default array.reduce() implementation.
const urls = ['http://foo.bar', 'http://baz.yay'];
const results = await asyncReduce(urls, async (curr, index, acc) => (
await fetch(curr)
));
`
ES5:
`
const urls = ['http://foo.bar', 'http://baz.yay'];
asyncReduce(urls, function(curr, index, acc) {
return fetch(curr);
}).then(function(results) {});
``