Initial commit
[yaffs-website] / node_modules / grunt-contrib-watch / node_modules / lodash / internal / composeArgs.js
1 /* Native method references for those with the same name as other `lodash` methods. */
2 var 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|Object} args The provided arguments.
10  * @param {Array} partials The arguments to prepend to those provided.
11  * @param {Array} holders The `partials` placeholder indexes.
12  * @returns {Array} Returns the new array of composed arguments.
13  */
14 function composeArgs(args, partials, holders) {
15   var holdersLength = holders.length,
16       argsIndex = -1,
17       argsLength = nativeMax(args.length - holdersLength, 0),
18       leftIndex = -1,
19       leftLength = partials.length,
20       result = Array(leftLength + argsLength);
21
22   while (++leftIndex < leftLength) {
23     result[leftIndex] = partials[leftIndex];
24   }
25   while (++argsIndex < holdersLength) {
26     result[holders[argsIndex]] = args[argsIndex];
27   }
28   while (argsLength--) {
29     result[leftIndex++] = args[argsIndex++];
30   }
31   return result;
32 }
33
34 module.exports = composeArgs;