Security update for permissions_by_term
[yaffs-website] / node_modules / uncss / node_modules / lodash / zipWith.js
1 var rest = require('./rest'),
2     unzipWith = require('./unzipWith');
3
4 /**
5  * This method is like `_.zip` except that it accepts `iteratee` to specify
6  * how grouped values should be combined. The iteratee is invoked with the
7  * elements of each group: (...group).
8  *
9  * @static
10  * @memberOf _
11  * @category Array
12  * @param {...Array} [arrays] The arrays to process.
13  * @param {Function} [iteratee=_.identity] The function to combine grouped values.
14  * @returns {Array} Returns the new array of grouped elements.
15  * @example
16  *
17  * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
18  *   return a + b + c;
19  * });
20  * // => [111, 222]
21  */
22 var zipWith = rest(function(arrays) {
23   var length = arrays.length,
24       iteratee = length > 1 ? arrays[length - 1] : undefined;
25
26   iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
27   return unzipWith(arrays, iteratee);
28 });
29
30 module.exports = zipWith;