@sapphire/utilities
Version:
Common JavaScript utilities for the Sapphire Community
23 lines (20 loc) • 814 B
JavaScript
;
var isFunction_cjs = require('./isFunction.cjs');
var __defProp = Object.defineProperty;
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
function hasThen(input) {
return Reflect.has(input, "then") && isFunction_cjs.isFunction(input.then);
}
__name(hasThen, "hasThen");
function hasCatch(input) {
return Reflect.has(input, "catch") && isFunction_cjs.isFunction(input.catch);
}
__name(hasCatch, "hasCatch");
function isThenable(input) {
if (typeof input !== "object" || input === null) return false;
return input instanceof Promise || input !== Promise.prototype && hasThen(input) && hasCatch(input);
}
__name(isThenable, "isThenable");
exports.isThenable = isThenable;
//# sourceMappingURL=isThenable.cjs.map
//# sourceMappingURL=isThenable.cjs.map