UNPKG

aveazul

Version:

Bluebird drop-in replacement built on native Promise

102 lines 2.37 kB
function createNotImplemented(name) { return function () { const msg = name + " Not implemented in aveazul"; console.error(msg); throw new Error(msg); }; } export 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; } export 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; } export function setupNotImplemented(AveAzul) { const instanceMethods = createInstanceNotImplemented(AveAzul); const staticMethods = createStaticNotImplemented(AveAzul); AveAzul.__notImplementedInstance = instanceMethods; AveAzul.__notImplementedStatic = staticMethods; } //# sourceMappingURL=not-implemented.js.map