curry.js 498 B

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