| Current Path : /usr/local/lib/node_modules/@google/gemini-cli/node_modules/es-toolkit/dist/function/ |
| Current File : //usr/local/lib/node_modules/@google/gemini-cli/node_modules/es-toolkit/dist/function/curry.mjs |
function curry(func) {
if (func.length === 0 || func.length === 1) {
return func;
}
return function (arg) {
return makeCurry(func, func.length, [arg]);
};
}
function makeCurry(origin, argsLength, args) {
if (args.length === argsLength) {
return origin(...args);
}
else {
const next = function (arg) {
return makeCurry(origin, argsLength, [...args, arg]);
};
return next;
}
}
export { curry };