The function to curry.
The arity of func
.
Optional
guard: anyEnables use as an iteratee for methods like map
.
Optional
Returns the new curried function.
5.5.0
var abc = function(a, b, c) {
return [a, b, c];
};
var curried = curry(abc);
curried(1)(2)(3);
// => [1, 2, 3]
curried(1, 2)(3);
// => [1, 2, 3]
curried(1, 2, 3);
// => [1, 2, 3]
// Curried with placeholders.
curried(1)(curry.placeholder, 3)(2);
// => [1, 2, 3]
Creates a function that accepts arguments of
func
and either invokesfunc
returning its result, if at leastarity
number of arguments have been provided, or returns a function that accepts the remainingfunc
arguments, and so on. The arity offunc
may be specified iffunc.length
is not sufficient.Note: This method doesn't set the "length" property of curried functions.