aveazul
Version:
Bluebird drop-in replacement built on native Promise
107 lines • 2.61 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createInstanceNotImplemented = createInstanceNotImplemented;
exports.createStaticNotImplemented = createStaticNotImplemented;
exports.setupNotImplemented = setupNotImplemented;
function createNotImplemented(name) {
return function () {
const msg = name + " Not implemented in aveazul";
console.error(msg);
throw new Error(msg);
};
}
function createInstanceNotImplemented(AveAzul) {
const methods = [
"then",
"spread",
"catch",
"finally",
"bind",
"isFulfilled",
"isRejected",
"isPending",
"isCancelled",
"value",
"reason",
"all",
"props",
"any",
"some",
"map",
"reduce",
"filter",
"each",
"mapSeries",
"disposer",
"asCallback",
"delay",
"timeout",
"cancel",
"tap",
"tapCatch",
"call",
"get",
"return",
"throw",
"catchReturn",
"catchThrow",
"reflect",
"suppressUnhandledRejections",
"done",
];
const proto = AveAzul.prototype;
const ret = [];
for (const method of methods) {
if (!proto[method]) {
ret.push(method);
proto[method] = createNotImplemented("instance " + method);
}
}
return ret;
}
function createStaticNotImplemented(AveAzul) {
const methods = [
"join",
"try",
"method",
"resolve",
"reject",
"props",
"any",
"some",
"map",
"reduce",
"filter",
"each",
"mapSeries",
"race",
"using",
"promisify",
"promisifyAll",
"fromCallback",
"delay",
"coroutine",
"coroutine.addYieldHandler",
"getNewLibraryCopy",
"noConflict",
"setScheduler",
];
const ret = [];
const aveazul = AveAzul;
for (const method of methods) {
if (!aveazul[method]) {
ret.push(method);
aveazul[method] = createNotImplemented("static " + method);
}
}
return ret;
}
function setupNotImplemented(AveAzul) {
const instanceMethods = createInstanceNotImplemented(AveAzul);
const staticMethods = createStaticNotImplemented(AveAzul);
AveAzul.__notImplementedInstance =
instanceMethods;
AveAzul.__notImplementedStatic =
staticMethods;
}
//# sourceMappingURL=not-implemented.cjs.map