diff --git a/README.md b/README.md index b9ce0b0d5..ba36f06b3 100644 --- a/README.md +++ b/README.md @@ -1191,8 +1191,8 @@ multiplyAndAdd5(5, 2) -> 15 Curries a function. Use recursion. -If the number of provided arguments (`args`) is sufficient, call the passed function `f`. -Otherwise, return a curried function `f` that expects the rest of the arguments. +If the number of provided arguments (`args`) is sufficient, call the passed function `fn`. +Otherwise, return a curried function `fn` that expects the rest of the arguments. If you want to curry a function that accepts a variable number of arguments (a variadic function, e.g. `Math.min()`), you can optionally pass the number of arguments to the second parameter `arity`. ```js diff --git a/docs/index.html b/docs/index.html index a49d80a82..596680ec2 100644 --- a/docs/index.html +++ b/docs/index.html @@ -805,8 +805,8 @@ multiplyAndAdd5(5, 2) -> 15

curry

Curries a function.

Use recursion. -If the number of provided arguments (args) is sufficient, call the passed function f. -Otherwise, return a curried function f that expects the rest of the arguments. +If the number of provided arguments (args) is sufficient, call the passed function fn. +Otherwise, return a curried function fn that expects the rest of the arguments. If you want to curry a function that accepts a variable number of arguments (a variadic function, e.g. Math.min()), you can optionally pass the number of arguments to the second parameter arity.

const curry = (fn, arity = fn.length, ...args) =>
   arity <= args.length