$
This commit is contained in:
26
node_modules/curri/curri.js
generated
vendored
Normal file
26
node_modules/curri/curri.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
||||
typeof define === 'function' && define.amd ? define(factory) :
|
||||
(global = global || self, global.curri = factory());
|
||||
}(this, function () { 'use strict';
|
||||
|
||||
/**
|
||||
* Function to curry any javascript method
|
||||
* @param {Function} fn - the target function we want to curry
|
||||
* @param {...[args]} acc - initial arguments
|
||||
* @returns {Function|*} it will return a function until the target function
|
||||
* will receive all of its arguments
|
||||
*/
|
||||
function curry(fn, ...acc) {
|
||||
return (...args) => {
|
||||
args = [...acc, ...args];
|
||||
|
||||
return args.length < fn.length ?
|
||||
curry(fn, ...args) :
|
||||
fn(...args)
|
||||
}
|
||||
}
|
||||
|
||||
return curry;
|
||||
|
||||
}));
|
Reference in New Issue
Block a user