partial.js 439 B

1234567891011121314
  1. "use strict";
  2. var callable = require("../../object/valid-callable")
  3. , aFrom = require("../../array/from")
  4. , defineLength = require("../_define-length")
  5. , apply = Function.prototype.apply;
  6. module.exports = function (/* …args*/) {
  7. var fn = callable(this), args = aFrom(arguments);
  8. return defineLength(function () {
  9. return apply.call(fn, this, args.concat(aFrom(arguments)));
  10. }, fn.length - args.length);
  11. };