index.js 422 B

123456789101112131415161718192021
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = convertToFP;
  6. function convertToFP(fn, arity, a) {
  7. a = a || [];
  8. if (a.length >= arity) {
  9. return fn.apply(null, a.slice(0, arity).reverse());
  10. }
  11. return function () {
  12. var args = Array.prototype.slice.call(arguments);
  13. return convertToFP(fn, arity, a.concat(args));
  14. };
  15. }
  16. module.exports = exports.default;