PHP 8.2.30
Preview: method.js Size: 1.73 KB
/proc/thread-self/root/home/byroehnu/.trash/node_modules11/bluebird/js/release/method.js

"use strict";
module.exports =
function(Promise, INTERNAL, tryConvertToPromise, apiRejection, debug) {
var util = require("./util");
var tryCatch = util.tryCatch;

Promise.method = function (fn) {
    if (typeof fn !== "function") {
        throw new Promise.TypeError("expecting a function but got " + util.classString(fn));
    }
    return function () {
        var ret = new Promise(INTERNAL);
        ret._captureStackTrace();
        ret._pushContext();
        var value = tryCatch(fn).apply(this, arguments);
        var promiseCreated = ret._popContext();
        debug.checkForgottenReturns(
            value, promiseCreated, "Promise.method", ret);
        ret._resolveFromSyncValue(value);
        return ret;
    };
};

Promise.attempt = Promise["try"] = function (fn) {
    if (typeof fn !== "function") {
        return apiRejection("expecting a function but got " + util.classString(fn));
    }
    var ret = new Promise(INTERNAL);
    ret._captureStackTrace();
    ret._pushContext();
    var value;
    if (arguments.length > 1) {
        debug.deprecated("calling Promise.try with more than 1 argument");
        var arg = arguments[1];
        var ctx = arguments[2];
        value = util.isArray(arg) ? tryCatch(fn).apply(ctx, arg)
                                  : tryCatch(fn).call(ctx, arg);
    } else {
        value = tryCatch(fn)();
    }
    var promiseCreated = ret._popContext();
    debug.checkForgottenReturns(
        value, promiseCreated, "Promise.try", ret);
    ret._resolveFromSyncValue(value);
    return ret;
};

Promise.prototype._resolveFromSyncValue = function (value) {
    if (value === util.errorObj) {
        this._rejectCallback(value.e, false);
    } else {
        this._resolveCallback(value, true);
    }
};
};

Directory Contents

Dirs: 0 × Files: 37

Name Size Perms Modified Actions
421 B lrw-r--r-- 2026-02-21 00:53:44
Edit Download
1.61 KB lrw-r--r-- 2026-02-21 00:53:44
Edit Download
2.81 KB lrw-r--r-- 2026-02-21 00:53:46
Edit Download
1.92 KB lrw-r--r-- 2026-02-21 00:53:46
Edit Download
291 B lrw-r--r-- 2026-02-21 00:53:48
Edit Download
4.25 KB lrw-r--r-- 2026-02-21 00:53:50
Edit Download
3.62 KB lrw-r--r-- 2026-02-21 00:53:50
Edit Download
1.39 KB lrw-r--r-- 2026-02-21 00:53:50
Edit Download
2.33 KB lrw-r--r-- 2026-02-21 00:53:50
Edit Download
31.42 KB lrw-r--r-- 2026-02-21 00:53:52
Edit Download
1.36 KB lrw-r--r-- 2026-02-21 00:53:54
Edit Download
789 B lrw-r--r-- 2026-02-21 00:53:54
Edit Download
3.63 KB lrw-r--r-- 2026-02-21 00:53:56
Edit Download
1.93 KB lrw-r--r-- 2026-02-21 00:53:56
Edit Download
314 B lrw-r--r-- 2026-02-21 00:53:56
Edit Download
4.50 KB lrw-r--r-- 2026-02-21 00:53:58
Edit Download
7.58 KB lrw-r--r-- 2026-02-21 00:53:58
Edit Download
7.95 KB lrw-r--r-- 2026-02-21 00:53:58
Edit Download
5.47 KB lrw-r--r-- 2026-02-21 00:53:58
Edit Download
1.73 KB lrw-r--r-- 2026-02-21 00:53:58
Edit Download
1.52 KB lrw-r--r-- 2026-02-21 00:53:58
Edit Download
1.61 KB lrw-r--r-- 2026-02-21 00:53:58
Edit Download
26.35 KB lrw-r--r-- 2026-02-21 00:54:00
Edit Download
5.13 KB lrw-r--r-- 2026-02-21 00:54:00
Edit Download
11.90 KB lrw-r--r-- 2026-02-21 00:54:00
Edit Download
3.04 KB lrw-r--r-- 2026-02-21 00:54:00
Edit Download
1.83 KB lrw-r--r-- 2026-02-21 00:54:00
Edit Download
1.22 KB lrw-r--r-- 2026-02-21 00:54:00
Edit Download
5.25 KB lrw-r--r-- 2026-02-21 00:54:00
Edit Download
2.10 KB lrw-r--r-- 2026-02-21 00:54:00
Edit Download
1.33 KB lrw-r--r-- 2026-02-21 00:54:00
Edit Download
3.87 KB lrw-r--r-- 2026-02-21 00:54:00
Edit Download
2.75 KB lrw-r--r-- 2026-02-21 00:54:00
Edit Download
2.08 KB lrw-r--r-- 2026-02-21 00:54:00
Edit Download
2.34 KB lrw-r--r-- 2026-02-21 00:54:02
Edit Download
7.35 KB lrw-r--r-- 2026-02-21 00:54:02
Edit Download
11.11 KB lrw-r--r-- 2026-02-21 00:54:02
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).