1 var createCtorWrapper = require('./_createCtorWrapper'),
2 root = require('./_root');
4 /** Used to compose bitmasks for wrapper metadata. */
8 * Creates a function that wraps `func` to invoke it with the optional `this`
9 * binding of `thisArg`.
12 * @param {Function} func The function to wrap.
13 * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper` for more details.
14 * @param {*} [thisArg] The `this` binding of `func`.
15 * @returns {Function} Returns the new wrapped function.
17 function createBaseWrapper(func, bitmask, thisArg) {
18 var isBind = bitmask & BIND_FLAG,
19 Ctor = createCtorWrapper(func);
22 var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
23 return fn.apply(isBind ? thisArg : this, arguments);
28 module.exports = createBaseWrapper;