index.js 290 B

123456789101112
  1. export default function convertToFP(fn, arity, a) {
  2. a = a || [];
  3. if (a.length >= arity) {
  4. return fn.apply(null, a.slice(0, arity).reverse());
  5. }
  6. return function () {
  7. var args = Array.prototype.slice.call(arguments);
  8. return convertToFP(fn, arity, a.concat(args));
  9. };
  10. }