"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.default=promiseReduce;var_isPromise=_interopRequireDefault(require("./isPromise"));function_interopRequireDefault(obj){returnobj&&obj.__esModule?obj:{default:obj};}/** * Similar to Array.prototype.reduce(), however the reducing callback may return * a Promise, in which case reduction will continue after each promise resolves. * * If the callback does not return a Promise, then this function will also not * return a Promise. */functionpromiseReduce(values,callback,initialValue){returnvalues.reduce(function(previous,value){return(0,_isPromise.default)(previous)?previous.then(function(resolved){returncallback(resolved,value);}):callback(previous,value);},initialValue);}