24 lines
628 B
JavaScript
24 lines
628 B
JavaScript
|
'use strict';
|
||
|
|
||
|
Object.defineProperty(exports, '__esModule', { value: true });
|
||
|
|
||
|
function curry(fn) {
|
||
|
return function curried() {
|
||
|
var _this = this;
|
||
|
|
||
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
||
|
args[_key] = arguments[_key];
|
||
|
}
|
||
|
|
||
|
return args.length >= fn.length ? fn.apply(this, args) : function () {
|
||
|
for (var _len2 = arguments.length, nextArgs = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
||
|
nextArgs[_key2] = arguments[_key2];
|
||
|
}
|
||
|
|
||
|
return curried.apply(_this, [].concat(args, nextArgs));
|
||
|
};
|
||
|
};
|
||
|
}
|
||
|
|
||
|
exports.default = curry;
|