12345678910111213141516 |
- import isPromise from './isPromise';
- export default function promiseReduce(values, callback, initialValue) {
- return values.reduce(function (previous, value) {
- return isPromise(previous) ? previous.then(function (resolved) {
- return callback(resolved, value);
- }) : callback(previous, value);
- }, initialValue);
- }
|