Sha256: 5fbbec0d516e93505ae43dd9277e0980aed3d98c27d741321b7a3f8373fefa6e

Contents?: true

Size: 853 Bytes

Versions: 270

Compression:

Stored size: 853 Bytes

Contents

var createCtor = require('./_createCtor'),
    root = require('./_root');

/** Used to compose bitmasks for function metadata. */
var WRAP_BIND_FLAG = 1;

/**
 * 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 `this` binding of `func`.
 * @returns {Function} Returns the new wrapped function.
 */
function createBind(func, bitmask, thisArg) {
  var isBind = bitmask & WRAP_BIND_FLAG,
      Ctor = createCtor(func);

  function wrapper() {
    var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
    return fn.apply(isBind ? thisArg : this, arguments);
  }
  return wrapper;
}

module.exports = createBind;

Version data entries

270 entries across 269 versions & 28 rubygems

Version Path
clapton-0.0.19 lib/clapton/javascripts/node_modules/lodash/_createBind.js
clapton-0.0.18 lib/clapton/javascripts/node_modules/lodash/_createBind.js
clapton-0.0.17 lib/clapton/javascripts/node_modules/lodash/_createBind.js
clapton-0.0.16 lib/clapton/javascripts/node_modules/lodash/_createBind.js
clapton-0.0.15 lib/clapton/javascripts/node_modules/lodash/_createBind.js
immosquare-cleaner-0.1.49 node_modules/lodash/_createBind.js
clapton-0.0.14 lib/clapton/javascripts/node_modules/lodash/_createBind.js
immosquare-cleaner-0.1.48 node_modules/lodash/_createBind.js
clapton-0.0.13 lib/clapton/javascripts/node_modules/lodash/_createBind.js
clapton-0.0.12 lib/clapton/javascripts/node_modules/lodash/_createBind.js
clapton-0.0.11 lib/clapton/javascripts/node_modules/lodash/_createBind.js
clapton-0.0.10 lib/clapton/javascripts/node_modules/lodash/_createBind.js
clapton-0.0.9 lib/clapton/javascripts/node_modules/lodash/_createBind.js
clapton-0.0.8 lib/clapton/javascripts/node_modules/lodash/_createBind.js
clapton-0.0.7 lib/clapton/javascripts/node_modules/lodash/_createBind.js
clapton-0.0.6 lib/clapton/javascripts/node_modules/lodash/_createBind.js
clapton-0.0.5 lib/clapton/javascripts/node_modules/lodash/_createBind.js
clapton-0.0.4 lib/clapton/javascripts/node_modules/lodash/_createBind.js
clapton-0.0.3 lib/clapton/javascripts/node_modules/lodash/_createBind.js
clapton-0.0.2 lib/clapton/javascripts/node_modules/lodash/_createBind.js