1 var createWrap = require('./_createWrap'),
2 flatRest = require('./_flatRest');
4 /** Used to compose bitmasks for function metadata. */
5 var WRAP_REARG_FLAG = 256;
8 * Creates a function that invokes `func` with arguments arranged according
9 * to the specified `indexes` where the argument value at the first index is
10 * provided as the first argument, the argument value at the second index is
11 * 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 * @returns {Function} Returns the new function.
22 * var rearged = _.rearg(function(a, b, c) {
26 * rearged('b', 'c', 'a')
27 * // => ['a', 'b', 'c']
29 var rearg = flatRest(function(func, indexes) {
30 return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
33 module.exports = rearg;