Security update for permissions_by_term
[yaffs-website] / node_modules / uncss / node_modules / lodash / rearg.js
1 var baseFlatten = require('./internal/baseFlatten'),
2     createWrapper = require('./internal/createWrapper'),
3     rest = require('./rest');
4
5 /** Used to compose bitmasks for wrapper metadata. */
6 var REARG_FLAG = 256;
7
8 /**
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.
13  *
14  * @static
15  * @memberOf _
16  * @category Function
17  * @param {Function} func The function to rearrange arguments for.
18  * @param {...(number|number[])} indexes The arranged argument indexes,
19  *  specified individually or in arrays.
20  * @returns {Function} Returns the new function.
21  * @example
22  *
23  * var rearged = _.rearg(function(a, b, c) {
24  *   return [a, b, c];
25  * }, 2, 0, 1);
26  *
27  * rearged('b', 'c', 'a')
28  * // => ['a', 'b', 'c']
29  */
30 var rearg = rest(function(func, indexes) {
31   return createWrapper(func, REARG_FLAG, undefined, undefined, undefined, baseFlatten(indexes));
32 });
33
34 module.exports = rearg;