modArgsSet source npm

_.modArgsSet(func, [transforms])

This method is like _.modArgs except that each of the transforms is provided the complete set of arguments the created function is invoked with.

Arguments

  1. func (Function)

    The function to wrap.

  2. [transforms] (...(Function|Function[])

    The functions to transform arguments, specified individually or in arrays.

Returns (Function)

Returns the new function.

Example

function divide(x, y) {
  return x / y;
}

function multiply(x, y) {
  return x * y;
}

var modded = _.modArgsSet(function(x, y) {
  return [x, y];
}, multiply, divide);

modded(9, 3);
// => [27, 3]

modded(10, 5);
// => [50, 2]