UNPKG

747 BJavaScriptView Raw
1"use strict";
2
3exports.__esModule = true;
4exports["default"] = curry;
5// Type definitions taken from https://github.com/gcanti/flow-static-land/blob/master/src/Fun.js
6// eslint-disable-next-line no-unused-vars
7// eslint-disable-next-line no-unused-vars
8// eslint-disable-next-line no-redeclare
9function curried(f, length, acc) {
10 return function fn() {
11 // eslint-disable-next-line prefer-rest-params
12 var combined = acc.concat(Array.prototype.slice.call(arguments));
13 return combined.length >= length ? f.apply(this, combined) : curried(f, length, combined);
14 };
15}
16
17// eslint-disable-next-line no-redeclare
18function curry(f) {
19 // eslint-disable-line no-redeclare
20 return curried(f, f.length, []);
21}
22module.exports = exports.default;
\No newline at end of file