| /* Native method references for those with the same name as other `lodash` methods. */ |
| var nativeMax = Math.max; |
| |
| /** |
| * Creates an array that is the composition of partially applied arguments, |
| * placeholders, and provided arguments into a single array of arguments. |
| * |
| * @private |
| * @param {Array|Object} args The provided arguments. |
| * @param {Array} partials The arguments to prepend to those provided. |
| * @param {Array} holders The `partials` placeholder indexes. |
| * @returns {Array} Returns the new array of composed arguments. |
| */ |
| function composeArgs(args, partials, holders) { |
| var holdersLength = holders.length, |
| argsIndex = -1, |
| argsLength = nativeMax(args.length - holdersLength, 0), |
| leftIndex = -1, |
| leftLength = partials.length, |
| result = Array(leftLength + argsLength); |
| |
| while (++leftIndex < leftLength) { |
| result[leftIndex] = partials[leftIndex]; |
| } |
| while (++argsIndex < holdersLength) { |
| result[holders[argsIndex]] = args[argsIndex]; |
| } |
| while (argsLength--) { |
| result[leftIndex++] = args[argsIndex++]; |
| } |
| return result; |
| } |
| |
| module.exports = composeArgs; |