Sha256: e3221c570f9a7f052c9d34322346b78e14a68f58a38b85e7b010aa50245ea5f7

Contents?: true

Size: 474 Bytes

Versions: 109

Compression:

Stored size: 474 Bytes

Contents

/**
 * Slice reference.
 */

var slice = [].slice;

/**
 * Bind `obj` to `fn`.
 *
 * @param {Object} obj
 * @param {Function|String} fn or string
 * @return {Function}
 * @api public
 */

module.exports = function(obj, fn){
  if ('string' == typeof fn) fn = obj[fn];
  if ('function' != typeof fn) throw new Error('bind() requires a function');
  var args = slice.call(arguments, 2);
  return function(){
    return fn.apply(obj, args.concat(slice.call(arguments)));
  }
};

Version data entries

109 entries across 107 versions & 5 rubygems

Version Path
ende-0.5.16 components/component/bind/1.0.0/index.js
ende-0.5.15 components/component/bind/1.0.0/index.js
ende-0.5.14 components/component/bind/1.0.0/index.js
ende-0.5.13 components/component/bind/1.0.0/index.js
ende-0.5.12 components/component/bind/1.0.0/index.js
ende-0.5.10 components/component/bind/1.0.0/index.js
ende-0.5.9 components/component/bind/1.0.0/index.js
ende-0.5.8 components/component/bind/1.0.0/index.js
ende-0.5.7 components/component/bind/1.0.0/index.js