es-promise-ext
Version:
Native promise extensions for javascript and typescript.
14 lines (13 loc) • 560 B
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const _helper_1 = require("../../_helper");
const wrap_1 = __importDefault(require("./wrap"));
function wrap(asyncFunction) {
if (!(this instanceof Promise))
throw TypeError('Promise.prototype.wrap called on a non-Promise instance');
return this.then((0, wrap_1.default)(asyncFunction));
}
(0, _helper_1.extendPrototype)(wrap);