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