MCPcopy Create free account
hub / github.com/play-co/devkit / ReductionPromiseArray

Function ReductionPromiseArray

src/web/util/bluebird.js:3186–3213  ·  view source on GitHub ↗
(promises, fn, accum, _each)

Source from the content-addressed store, hash-verified

3184var tryCatch = util.tryCatch;
3185var errorObj = util.errorObj;
3186function ReductionPromiseArray(promises, fn, accum, _each) {
3187 this.constructor$(promises);
3188 this._promise._captureStackTrace();
3189 this._preservedValues = _each === INTERNAL ? [] : null;
3190 this._zerothIsAccum = (accum === undefined);
3191 this._gotAccum = false;
3192 this._reducingIndex = (this._zerothIsAccum ? 1 : 0);
3193 this._valuesPhase = undefined;
3194 var maybePromise = tryConvertToPromise(accum, this._promise);
3195 var rejected = false;
3196 var isPromise = maybePromise instanceof Promise;
3197 if (isPromise) {
3198 maybePromise = maybePromise._target();
3199 if (maybePromise._isPending()) {
3200 maybePromise._proxyPromiseArray(this, -1);
3201 } else if (maybePromise._isFulfilled()) {
3202 accum = maybePromise._value();
3203 this._gotAccum = true;
3204 } else {
3205 this._reject(maybePromise._reason());
3206 rejected = true;
3207 }
3208 }
3209 if (!(isPromise || this._zerothIsAccum)) this._gotAccum = true;
3210 this._callback = fn;
3211 this._accum = accum;
3212 if (!rejected) this._init$(undefined, -5);
3213}
3214util.inherits(ReductionPromiseArray, PromiseArray);
3215
3216ReductionPromiseArray.prototype._init = function () {};

Callers

nothing calls this directly

Calls 1

tryConvertToPromiseFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…