GRAYBYTE WORDPRESS FILE MANAGER8187

Server IP : 198.54.121.189 / Your IP : 216.73.216.112
System : Linux premium69.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
PHP Version : 7.4.33
Disable Function : NONE
cURL : ON | WGET : ON | Sudo : OFF | Pkexec : OFF
Directory : /lib/node_modules/npm/node_modules/bluebird/js/release/
Upload Files :
Current_dir [ Not Writeable ] Document_root [ Writeable ]

Command :


Current File : /lib/node_modules/npm/node_modules/bluebird/js/release//reduce.js
"use strict";
module.exports = function(Promise,
                          PromiseArray,
                          apiRejection,
                          tryConvertToPromise,
                          INTERNAL,
                          debug) {
var getDomain = Promise._getDomain;
var util = require("./util");
var tryCatch = util.tryCatch;

function ReductionPromiseArray(promises, fn, initialValue, _each) {
    this.constructor$(promises);
    var domain = getDomain();
    this._fn = domain === null ? fn : util.domainBind(domain, fn);
    if (initialValue !== undefined) {
        initialValue = Promise.resolve(initialValue);
        initialValue._attachCancellationCallback(this);
    }
    this._initialValue = initialValue;
    this._currentCancellable = null;
    if(_each === INTERNAL) {
        this._eachValues = Array(this._length);
    } else if (_each === 0) {
        this._eachValues = null;
    } else {
        this._eachValues = undefined;
    }
    this._promise._captureStackTrace();
    this._init$(undefined, -5);
}
util.inherits(ReductionPromiseArray, PromiseArray);

ReductionPromiseArray.prototype._gotAccum = function(accum) {
    if (this._eachValues !== undefined && 
        this._eachValues !== null && 
        accum !== INTERNAL) {
        this._eachValues.push(accum);
    }
};

ReductionPromiseArray.prototype._eachComplete = function(value) {
    if (this._eachValues !== null) {
        this._eachValues.push(value);
    }
    return this._eachValues;
};

ReductionPromiseArray.prototype._init = function() {};

ReductionPromiseArray.prototype._resolveEmptyArray = function() {
    this._resolve(this._eachValues !== undefined ? this._eachValues
                                                 : this._initialValue);
};

ReductionPromiseArray.prototype.shouldCopyValues = function () {
    return false;
};

ReductionPromiseArray.prototype._resolve = function(value) {
    this._promise._resolveCallback(value);
    this._values = null;
};

ReductionPromiseArray.prototype._resultCancelled = function(sender) {
    if (sender === this._initialValue) return this._cancel();
    if (this._isResolved()) return;
    this._resultCancelled$();
    if (this._currentCancellable instanceof Promise) {
        this._currentCancellable.cancel();
    }
    if (this._initialValue instanceof Promise) {
        this._initialValue.cancel();
    }
};

ReductionPromiseArray.prototype._iterate = function (values) {
    this._values = values;
    var value;
    var i;
    var length = values.length;
    if (this._initialValue !== undefined) {
        value = this._initialValue;
        i = 0;
    } else {
        value = Promise.resolve(values[0]);
        i = 1;
    }

    this._currentCancellable = value;

    if (!value.isRejected()) {
        for (; i < length; ++i) {
            var ctx = {
                accum: null,
                value: values[i],
                index: i,
                length: length,
                array: this
            };
            value = value._then(gotAccum, undefined, undefined, ctx, undefined);
        }
    }

    if (this._eachValues !== undefined) {
        value = value
            ._then(this._eachComplete, undefined, undefined, this, undefined);
    }
    value._then(completed, completed, undefined, value, this);
};

Promise.prototype.reduce = function (fn, initialValue) {
    return reduce(this, fn, initialValue, null);
};

Promise.reduce = function (promises, fn, initialValue, _each) {
    return reduce(promises, fn, initialValue, _each);
};

function completed(valueOrReason, array) {
    if (this.isFulfilled()) {
        array._resolve(valueOrReason);
    } else {
        array._reject(valueOrReason);
    }
}

function reduce(promises, fn, initialValue, _each) {
    if (typeof fn !== "function") {
        return apiRejection("expecting a function but got " + util.classString(fn));
    }
    var array = new ReductionPromiseArray(promises, fn, initialValue, _each);
    return array.promise();
}

function gotAccum(accum) {
    this.accum = accum;
    this.array._gotAccum(accum);
    var value = tryConvertToPromise(this.value, this.array._promise);
    if (value instanceof Promise) {
        this.array._currentCancellable = value;
        return value._then(gotValue, undefined, undefined, this, undefined);
    } else {
        return gotValue.call(this, value);
    }
}

function gotValue(value) {
    var array = this.array;
    var promise = array._promise;
    var fn = tryCatch(array._fn);
    promise._pushContext();
    var ret;
    if (array._eachValues !== undefined) {
        ret = fn.call(promise._boundValue(), value, this.index, this.length);
    } else {
        ret = fn.call(promise._boundValue(),
                              this.accum, value, this.index, this.length);
    }
    if (ret instanceof Promise) {
        array._currentCancellable = ret;
    }
    var promiseCreated = promise._popContext();
    debug.checkForgottenReturns(
        ret,
        promiseCreated,
        array._eachValues !== undefined ? "Promise.each" : "Promise.reduce",
        promise
    );
    return ret;
}
};

[ Back ]
Name
Size
Last Modified
Owner / Group
Permissions
Options
..
--
March 03 2024 22:36:28
root / root
0755
any.js
0.411 KB
March 10 2021 14:36:36
root / root
0644
assert.js
1.614 KB
March 10 2021 14:36:36
root / root
0644
async.js
4.05 KB
March 10 2021 14:36:36
root / root
0644
bind.js
1.924 KB
March 10 2021 14:36:36
root / root
0644
bluebird.js
0.284 KB
March 10 2021 14:36:36
root / root
0644
call_get.js
4.253 KB
March 10 2021 14:36:36
root / root
0644
cancel.js
3.62 KB
March 10 2021 14:36:36
root / root
0644
catch_filter.js
1.393 KB
March 10 2021 14:36:36
root / root
0644
context.js
2.326 KB
March 10 2021 14:36:36
root / root
0644
debuggability.js
29.63 KB
March 10 2021 14:36:36
root / root
0644
direct_resolve.js
1.362 KB
March 10 2021 14:36:36
root / root
0644
each.js
0.771 KB
March 10 2021 14:36:36
root / root
0644
errors.js
3.63 KB
March 10 2021 14:36:36
root / root
0644
es5.js
1.932 KB
March 10 2021 14:36:36
root / root
0644
filter.js
0.307 KB
March 10 2021 14:36:36
root / root
0644
finally.js
4.505 KB
March 10 2021 14:36:36
root / root
0644
generators.js
7.579 KB
March 10 2021 14:36:36
root / root
0644
join.js
8.025 KB
March 10 2021 14:36:36
root / root
0644
map.js
5.251 KB
March 10 2021 14:36:36
root / root
0644
method.js
1.727 KB
March 10 2021 14:36:36
root / root
0644
nodeback.js
1.523 KB
March 10 2021 14:36:36
root / root
0644
nodeify.js
1.608 KB
March 10 2021 14:36:36
root / root
0644
promise.js
25.591 KB
March 10 2021 14:36:36
root / root
0644
promise_array.js
5.084 KB
March 10 2021 14:36:36
root / root
0644
promisify.js
11.896 KB
March 10 2021 14:36:36
root / root
0644
props.js
3.044 KB
March 10 2021 14:36:36
root / root
0644
queue.js
1.829 KB
March 10 2021 14:36:36
root / root
0644
race.js
1.221 KB
March 10 2021 14:36:36
root / root
0644
reduce.js
5.006 KB
March 10 2021 14:36:36
root / root
0644
schedule.js
2.098 KB
March 10 2021 14:36:36
root / root
0644
settle.js
1.233 KB
March 10 2021 14:36:36
root / root
0644
some.js
3.866 KB
March 10 2021 14:36:36
root / root
0644
synchronous_inspection.js
2.747 KB
March 10 2021 14:36:36
root / root
0644
thenables.js
2.081 KB
March 10 2021 14:36:36
root / root
0644
timers.js
2.339 KB
March 10 2021 14:36:36
root / root
0644
using.js
7.349 KB
March 10 2021 14:36:36
root / root
0644
util.js
10.279 KB
March 10 2021 14:36:36
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025
CONTACT ME
Static GIF