curryN
description
Returns a curried version of the provided function. The new function will have the specified arity. curry
is a pure function and will return a new function, without modifying the original function.
curryN
is very similar to curry
, except you need to explictly provide the desired arity. curry
actually uses curryN
internally and is defined as follows: curry = fn => curryN(fn.length, fn)
. In most cases, curry
or arity
will be better suited to your needs. The only case where you might want to use curryN
would be if your function's length
property does not reflect its actual arity (either because it uses the spread parameter operator, or uses the arguments
local variable internally).
examples
basic example
0-arity functions
Last updated