source: node_modules/es-toolkit/dist/function/curryRight.mjs

Last change on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago

Added visualizations

  • Property mode set to 100644
File size: 511 bytes
Line 
1function curryRight(func) {
2 if (func.length === 0 || func.length === 1) {
3 return func;
4 }
5 return function (arg) {
6 return makeCurryRight(func, func.length, [arg]);
7 };
8}
9function makeCurryRight(origin, argsLength, args) {
10 if (args.length === argsLength) {
11 return origin(...args);
12 }
13 else {
14 const next = function (arg) {
15 return makeCurryRight(origin, argsLength, [arg, ...args]);
16 };
17 return next;
18 }
19}
20
21export { curryRight };
Note: See TracBrowser for help on using the repository browser.