autoCurry()
autoCurry<
T>(fn,_args):Curried<Parameters<T>,ReturnType<T>>
Curries the given function. Allowing it to accept one or more arguments at a time.
Type Parameters
T
T extends (...args) => any
The function type to curry.
Parameters
fn
T
The function to convert to a curried version of.
_args
any[] = ...
Returns
Curried<Parameters<T>, ReturnType<T>>
Remark
pure function
Example
const curried = autoCurry((a, b, c) => (a + b) * c);
curried(2)(3)(4);
curried(2, 3)(4);
curried(2)(3, 4);
curried(2, 3, 4);