1 var baseFlatten = require('../internal/baseFlatten'),
2 createWrapper = require('../internal/createWrapper'),
3 restParam = require('./restParam');
5 /** Used to compose bitmasks for wrapper metadata. */
9 * Creates a function that invokes `func` with arguments arranged according
10 * to the specified indexes where the argument value at the first index is
11 * provided as the first argument, the argument value at the second index is
12 * provided as the second argument, and so on.
17 * @param {Function} func The function to rearrange arguments for.
18 * @param {...(number|number[])} indexes The arranged argument indexes,
19 * specified as individual indexes or arrays of indexes.
20 * @returns {Function} Returns the new function.
23 * var rearged = _.rearg(function(a, b, c) {
27 * rearged('b', 'c', 'a')
28 * // => ['a', 'b', 'c']
30 * var map = _.rearg(_.map, [1, 0]);
36 var rearg = restParam(function(func, indexes) {
37 return createWrapper(func, REARG_FLAG, undefined, undefined, undefined, baseFlatten(indexes));
40 module.exports = rearg;