Sha256: 19a95ec304c87db148ed62b557953c4dfc5cea5daf6ee75e2184d4e8ca85a5f0

Contents?: true

Size: 855 Bytes

Versions: 320

Compression:

Stored size: 855 Bytes

Contents

'use strict';
var aFunction  = require('./_a-function')
  , isObject   = require('./_is-object')
  , invoke     = require('./_invoke')
  , arraySlice = [].slice
  , factories  = {};

var construct = function(F, len, args){
  if(!(len in factories)){
    for(var n = [], i = 0; i < len; i++)n[i] = 'a[' + i + ']';
    factories[len] = Function('F,a', 'return new F(' + n.join(',') + ')');
  } return factories[len](F, args);
};

module.exports = Function.bind || function bind(that /*, args... */){
  var fn       = aFunction(this)
    , partArgs = arraySlice.call(arguments, 1);
  var bound = function(/* args... */){
    var args = partArgs.concat(arraySlice.call(arguments));
    return this instanceof bound ? construct(fn, args.length, args) : invoke(fn, args, that);
  };
  if(isObject(fn.prototype))bound.prototype = fn.prototype;
  return bound;
};

Version data entries

320 entries across 8 versions & 3 rubygems

Version Path
babel-schmooze-sprockets-0.1.3 node_modules/babel-helper-optimise-call-expression/node_modules/core-js/library/modules/_bind.js
babel-schmooze-sprockets-0.1.3 node_modules/babel-helper-optimise-call-expression/node_modules/core-js/modules/_bind.js
babel-schmooze-sprockets-0.1.3 node_modules/babel-helper-function-name/node_modules/core-js/modules/_bind.js
babel-schmooze-sprockets-0.1.3 node_modules/babel-helper-remap-async-to-generator/node_modules/core-js/modules/_bind.js
babel-schmooze-sprockets-0.1.3 node_modules/babel-helper-replace-supers/node_modules/core-js/modules/_bind.js
babel-schmooze-sprockets-0.1.3 node_modules/babel-helpers/node_modules/core-js/library/modules/_bind.js
babel-schmooze-sprockets-0.1.3 node_modules/babel-messages/node_modules/core-js/modules/_bind.js
babel-schmooze-sprockets-0.1.3 node_modules/babel-plugin-check-es2015-constants/node_modules/core-js/library/modules/_bind.js
babel-schmooze-sprockets-0.1.3 node_modules/babel-plugin-external-helpers/node_modules/core-js/library/modules/_bind.js
babel-schmooze-sprockets-0.1.3 node_modules/babel-plugin-external-helpers/node_modules/core-js/modules/_bind.js
babel-schmooze-sprockets-0.1.3 node_modules/babel-core/node_modules/core-js/modules/_bind.js
babel-schmooze-sprockets-0.1.3 node_modules/babel-core/node_modules/core-js/library/modules/_bind.js
babel-schmooze-sprockets-0.1.3 node_modules/babel-generator/node_modules/core-js/library/modules/_bind.js
babel-schmooze-sprockets-0.1.3 node_modules/babel-code-frame/node_modules/core-js/library/modules/_bind.js
babel-schmooze-sprockets-0.1.3 node_modules/babel-code-frame/node_modules/core-js/modules/_bind.js
babel-schmooze-sprockets-0.1.3 node_modules/babel-helper-call-delegate/node_modules/core-js/library/modules/_bind.js
babel-schmooze-sprockets-0.1.3 node_modules/babel-helper-define-map/node_modules/core-js/library/modules/_bind.js
babel-schmooze-sprockets-0.1.3 node_modules/babel-helper-define-map/node_modules/core-js/modules/_bind.js
babel-schmooze-sprockets-0.1.3 node_modules/babel-generator/node_modules/core-js/modules/_bind.js
babel-schmooze-sprockets-0.1.3 node_modules/babel-helper-get-function-arity/node_modules/core-js/library/modules/_bind.js