Curries a function, allowing it to be called with a single argument at a time and returning a new function that takes the next argument. This process continues until all arguments have been provided, at which point the original function is called with all accumulated arguments.
Unlike curry
, this function curries the function from right to left.
A curried function.
Curries a function, allowing it to be called with a single argument at a time and returning a new function that takes the next argument. This process continues until all arguments have been provided, at which point the original function is called with all accumulated arguments.
Unlike curry
, this function curries the function from right to left.
A curried function.
Curries a function, allowing it to be called with a single argument at a time and returning a new function that takes the next argument. This process continues until all arguments have been provided, at which point the original function is called with all accumulated arguments.
Unlike curry
, this function curries the function from right to left.
A curried function.
Curries a function, allowing it to be called with a single argument at a time and returning a new function that takes the next argument. This process continues until all arguments have been provided, at which point the original function is called with all accumulated arguments.
Unlike curry
, this function curries the function from right to left.
A curried function.
Curries a function, allowing it to be called with a single argument at a time and returning a new function that takes the next argument. This process continues until all arguments have been provided, at which point the original function is called with all accumulated arguments.
Unlike curry
, this function curries the function from right to left.
A curried function.
Curries a function, allowing it to be called with a single argument at a time and returning a new function that takes the next argument. This process continues until all arguments have been provided, at which point the original function is called with all accumulated arguments.
Unlike curry
, this function curries the function from right to left.
A curried function.
function fiveArgFunc(a: number, b: number, c: number, d: number, e: number) {
return [a, b, c, d, e];
}
const curriedFiveArgFunc = curryRight(fiveArgFunc);
const func = curriedFiveArgFunc(1);
const func2 = func(2);
const func3 = func2(3);
const func4 = func3(4);
console.log(func4(5)); // [5, 4, 3, 2, 1]
Curries a function, allowing it to be called with a single argument at a time and returning a new function that takes the next argument. This process continues until all arguments have been provided, at which point the original function is called with all accumulated arguments.
Unlike curry
, this function curries the function from right to left.
The function to curry.
Rest
...args: any[]A curried function.
Rest
...args: any[]function sum(a: number, b: number, c: number) {
return a + b + c;
}
const curriedSum = curryRight(sum);
// The parameter `c` should be given the value `10`.
const add10 = curriedSum(10);
// The parameter `b` should be given the value `15`.
const add25 = add10(15);
// The parameter `a` should be given the value `5`. The function 'sum' has received all its arguments and will now return a value.
const result = add25(5); // 30
Alias