1 /* Built-in method references for those with the same name as other `lodash` methods. */
2 var nativeMax = Math.max;
5 * Creates an array that is the composition of partially applied arguments,
6 * placeholders, and provided arguments into a single array of arguments.
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.
15 function composeArgs(args, partials, holders, isCurried) {
17 argsLength = args.length,
18 holdersLength = holders.length,
20 leftLength = partials.length,
21 rangeLength = nativeMax(argsLength - holdersLength, 0),
22 result = Array(leftLength + rangeLength),
23 isUncurried = !isCurried;
25 while (++leftIndex < leftLength) {
26 result[leftIndex] = partials[leftIndex];
28 while (++argsIndex < holdersLength) {
29 if (isUncurried || argsIndex < argsLength) {
30 result[holders[argsIndex]] = args[argsIndex];
33 while (rangeLength--) {
34 result[leftIndex++] = args[argsIndex++];
39 module.exports = composeArgs;