source: trip-planner-front/node_modules/lodash/_composeArgsRight.js@ e29cc2e

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

initial commit

  • Property mode set to 100644
File size: 1.4 KB
Line 
1/* Built-in method references for those with the same name as other `lodash` methods. */
2var nativeMax = Math.max;
3
4/**
5 * This function is like `composeArgs` except that the arguments composition
6 * is tailored for `_.partialRight`.
7 *
8 * @private
9 * @param {Array} args The provided arguments.
10 * @param {Array} partials The arguments to append 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 composeArgsRight(args, partials, holders, isCurried) {
16 var argsIndex = -1,
17 argsLength = args.length,
18 holdersIndex = -1,
19 holdersLength = holders.length,
20 rightIndex = -1,
21 rightLength = partials.length,
22 rangeLength = nativeMax(argsLength - holdersLength, 0),
23 result = Array(rangeLength + rightLength),
24 isUncurried = !isCurried;
25
26 while (++argsIndex < rangeLength) {
27 result[argsIndex] = args[argsIndex];
28 }
29 var offset = argsIndex;
30 while (++rightIndex < rightLength) {
31 result[offset + rightIndex] = partials[rightIndex];
32 }
33 while (++holdersIndex < holdersLength) {
34 if (isUncurried || argsIndex < argsLength) {
35 result[offset + holders[holdersIndex]] = args[argsIndex++];
36 }
37 }
38 return result;
39}
40
41module.exports = composeArgsRight;
Note: See TracBrowser for help on using the repository browser.