varcreateCtor=require('./_createCtor'),root=require('./_root');/** Used to compose bitmasks for function metadata. */varWRAP_BIND_FLAG=1;/** * Creates a function that wraps `func` to invoke it with the optional `this` * binding of `thisArg`. * * @private * @param {Function} func The function to wrap. * @param {number} bitmask The bitmask flags. See `createWrap` for more details. * @param {*} [thisArg] The `this` binding of `func`. * @returns {Function} Returns the new wrapped function. */functioncreateBind(func,bitmask,thisArg){varisBind=bitmask&WRAP_BIND_FLAG,Ctor=createCtor(func);functionwrapper(){varfn=(this&&this!==root&&thisinstanceofwrapper)?Ctor:func;returnfn.apply(isBind?thisArg:this,arguments);}returnwrapper;}module.exports=createBind;