_.overArgs(func, [transforms=[_.identity]])
Creates a function that invokes func with its arguments transformed.
Since
4.0.0
Arguments
-
func(Function): The function to wrap. -
[transforms=[_.identity]](...(Function|Function[])): The argument transforms.
Returns
(Function): Returns the new function.
Example
function doubled(n) {
return n * 2;
}
function square(n) {
return n * n;
}
var func = _.overArgs(function(x, y) {
return [x, y];
}, [square, doubled]);
func(9, 3);
// => [81, 6]
func(10, 5);
// => [100, 10]
Please login to continue.