curry.js 499 B

1234567891011121314151617181920
  1. "use strict";
  2. var toArray = require("../../../array/to-array")
  3. , f = function () {
  4. return toArray(arguments);
  5. };
  6. module.exports = function (t, a) {
  7. var x, y = {}, z;
  8. a.deep(t.call(f, 0, 1, 2)(3), [], "0 arguments");
  9. x = t.call(f, 5, {});
  10. a(x.length, 5, "Length #1");
  11. z = x(1, 2);
  12. a(z.length, 3, "Length #2");
  13. z = z(3, 4);
  14. a(z.length, 1, "Length #1");
  15. a.deep(z(5, 6), [1, 2, 3, 4, 5], "Many arguments");
  16. a.deep(x(8, 3)(y, 45)("raz", 6), [8, 3, y, 45, "raz"], "Many arguments #2");
  17. };