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

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

Added visualizations

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