* 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. * @pa
(func, bitmask, thisArg)
| 15552 | * @returns {Function} Returns the new wrapped function. |
| 15553 | */ |
| 15554 | function createBind(func, bitmask, thisArg) { |
| 15555 | var isBind = bitmask & WRAP_BIND_FLAG, |
| 15556 | Ctor = createCtor(func); |
| 15557 | |
| 15558 | function wrapper() { |
| 15559 | var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; |
| 15560 | return fn.apply(isBind ? thisArg : this, arguments); |
| 15561 | } |
| 15562 | return wrapper; |
| 15563 | } |
| 15564 | |
| 15565 | /** |
| 15566 | * Creates a function like `_.lowerFirst`. |
no test coverage detected