MCPcopy Index your code
hub / github.com/deployd/deployd / createBind

Function createBind

test-app/public/sinon.js:15554–15563  ·  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. * @pa

(func, bitmask, thisArg)

Source from the content-addressed store, hash-verified

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`.

Callers 1

createWrapFunction · 0.85

Calls 1

createCtorFunction · 0.85

Tested by

no test coverage detected