UNPKG

@newdash/newdash

Version:

javascript/typescript utility library

21 lines (20 loc) 829 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.createBind = void 0; // @ts-nocheck const CONSTANTS_1 = require("./CONSTANTS"); const createCtor_1 = __importDefault(require("./createCtor")); const root_1 = __importDefault(require("./root")); function createBind(func, bitmask, thisArg) { var isBind = bitmask & CONSTANTS_1.WRAP_BIND_FLAG, Ctor = (0, createCtor_1.default)(func); function wrapper() { var fn = (this && this !== root_1.default && this instanceof wrapper) ? Ctor : func; return fn.apply(isBind ? thisArg : this, arguments); } return wrapper; } exports.createBind = createBind; exports.default = createBind;