MCPcopy
hub / github.com/lodash/lodash / createBind

Function createBind

lodash.js:5016–5025  ·  view source on GitHub ↗

* 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 `t

(func, bitmask, thisArg)

Source from the content-addressed store, hash-verified

5014 * @returns {Function} Returns the new wrapped function.
5015 */
5016 function createBind(func, bitmask, thisArg) {
5017 var isBind = bitmask & WRAP_BIND_FLAG,
5018 Ctor = createCtor(func);
5019
5020 function wrapper() {
5021 var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
5022 return fn.apply(isBind ? thisArg : this, arguments);
5023 }
5024 return wrapper;
5025 }
5026
5027 /**
5028 * Creates a function like `_.lowerFirst`.

Callers 1

createWrapFunction · 0.85

Calls 1

createCtorFunction · 0.85

Tested by

no test coverage detected