source: imaps-frontend/node_modules/lodash-es/_composeArgsRight.js@ d565449

main
Last change on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • 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
41export default composeArgsRight;
Note: See TracBrowser for help on using the repository browser.