UNPKG

@ace-util/core

Version:
21 lines 629 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.promisify = exports.isPromise = void 0; /** * check if a value is a promise */ function isPromise(obj) { return !!obj && (typeof obj === 'object' || typeof obj === 'function') && typeof obj.then === 'function'; } exports.isPromise = isPromise; /** * transform a value to a promise */ function promisify(promise) { if (promise && promise instanceof Promise && typeof promise.then === 'function') { return promise; } return Promise.resolve(promise); } exports.promisify = promisify; //# sourceMappingURL=promise.js.map