Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

bind.js 559B

123456789101112131415
  1. var isFunction = require('./isFunction.js');
  2. var _executeBound = require('./_executeBound.js');
  3. var restArguments = require('./restArguments.js');
  4. // Create a function bound to a given object (assigning `this`, and arguments,
  5. // optionally).
  6. var bind = restArguments(function(func, context, args) {
  7. if (!isFunction(func)) throw new TypeError('Bind must be called on a function');
  8. var bound = restArguments(function(callArgs) {
  9. return _executeBound(func, bound, context, this, args.concat(callArgs));
  10. });
  11. return bound;
  12. });
  13. module.exports = bind;