source: trip-planner-front/node_modules/lodash/_composeArgs.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: 1.3 KB
RevLine 
[6a3a178]1/* Built-in method references for those with the same name as other `lodash` methods. */
2var nativeMax = Math.max;
3
4/**
5 * Creates an array that is the composition of partially applied arguments,
6 * placeholders, and provided arguments into a single array of arguments.
7 *
8 * @private
9 * @param {Array} args The provided arguments.
10 * @param {Array} partials The arguments to prepend to those provided.
11 * @param {Array} holders The `partials` placeholder indexes.
12 * @params {boolean} [isCurried] Specify composing for a curried function.
13 * @returns {Array} Returns the new array of composed arguments.
14 */
15function composeArgs(args, partials, holders, isCurried) {
16 var argsIndex = -1,
17 argsLength = args.length,
18 holdersLength = holders.length,
19 leftIndex = -1,
20 leftLength = partials.length,
21 rangeLength = nativeMax(argsLength - holdersLength, 0),
22 result = Array(leftLength + rangeLength),
23 isUncurried = !isCurried;
24
25 while (++leftIndex < leftLength) {
26 result[leftIndex] = partials[leftIndex];
27 }
28 while (++argsIndex < holdersLength) {
29 if (isUncurried || argsIndex < argsLength) {
30 result[holders[argsIndex]] = args[argsIndex];
31 }
32 }
33 while (rangeLength--) {
34 result[leftIndex++] = args[argsIndex++];
35 }
36 return result;
37}
38
39module.exports = composeArgs;
Note: See TracBrowser for help on using the repository browser.