The _.overArgs
function from Lodash creates a new function which invokes a provided function with its arguments transformed. Each argument transformation is specified as a separate function.
Here is an example usage:
index.tsx395 chars15 lines
In the example above, the _.overArgs
function is used to create a new function transformArgs
which transforms the second and third arguments to concatenateStrings
to uppercase and lowercase respectively. This new function is then invoked with the transformed arguments to return the concatenated string.
Note that the second argument to _.overArgs
is an array of functions which are applied to the corresponding arguments of the original function. In this case, we are transforming the second argument to uppercase and the third argument to lowercase.
gistlibby LogSnag