1 var createCtorWrapper = require('./createCtorWrapper');
4 * Creates a function that wraps `func` and invokes it with the `this`
5 * binding of `thisArg`.
8 * @param {Function} func The function to bind.
9 * @param {*} [thisArg] The `this` binding of `func`.
10 * @returns {Function} Returns the new bound function.
12 function createBindWrapper(func, thisArg) {
13 var Ctor = createCtorWrapper(func);
16 var fn = (this && this !== global && this instanceof wrapper) ? Ctor : func;
17 return fn.apply(thisArg, arguments);
22 module.exports = createBindWrapper;