UNPKG

callable-instance2

Version:

Instances of classes which are directly callable as functions.

34 lines (31 loc) 913 B
'use strict'; // @ts-nocheck function CallableInstance(property) { // @ts-ignore const func = this.constructor.prototype[property]; const apply = function () { return func.apply(apply, arguments); }; // @ts-ignore Object.setPrototypeOf(apply, this.constructor.prototype); Object.getOwnPropertyNames(func).forEach(function (p) { Object.defineProperty(apply, p, Object.getOwnPropertyDescriptor(func, p)); }); return apply; } CallableInstance.prototype = /*#__PURE__*/Object.create(Function.prototype); // @ts-ignore { Object.defineProperty(CallableInstance, "__esModule", { value: true }); Object.defineProperty(CallableInstance, 'CallableInstance', { value: CallableInstance }); Object.defineProperty(CallableInstance, 'default', { value: CallableInstance }); } // @ts-ignore module.exports = CallableInstance; //# sourceMappingURL=index.cjs.development.cjs.map