12345678910111213141516171819202122232425 |
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = promiseReduce;
- var _isPromise = _interopRequireDefault(require("./isPromise"));
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- function promiseReduce(values, callback, initialValue) {
- return values.reduce(function (previous, value) {
- return (0, _isPromise.default)(previous) ? previous.then(function (resolved) {
- return callback(resolved, value);
- }) : callback(previous, value);
- }, initialValue);
- }
|