source: trip-planner-front/node_modules/lodash/rearg.js@ eed0bf8

Last change on this file since eed0bf8 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1023 bytes
Line 
1var createWrap = require('./_createWrap'),
2 flatRest = require('./_flatRest');
3
4/** Used to compose bitmasks for function metadata. */
5var WRAP_REARG_FLAG = 256;
6
7/**
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.
12 *
13 * @static
14 * @memberOf _
15 * @since 3.0.0
16 * @category Function
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.
20 * @example
21 *
22 * var rearged = _.rearg(function(a, b, c) {
23 * return [a, b, c];
24 * }, [2, 0, 1]);
25 *
26 * rearged('b', 'c', 'a')
27 * // => ['a', 'b', 'c']
28 */
29var rearg = flatRest(function(func, indexes) {
30 return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
31});
32
33module.exports = rearg;
Note: See TracBrowser for help on using the repository browser.