main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
958 bytes
|
Line | |
---|
1 | import baseRest from './_baseRest.js';
|
---|
2 | import unzipWith from './unzipWith.js';
|
---|
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 | * @since 3.8.0
|
---|
12 | * @category Array
|
---|
13 | * @param {...Array} [arrays] The arrays to process.
|
---|
14 | * @param {Function} [iteratee=_.identity] The function to combine
|
---|
15 | * grouped values.
|
---|
16 | * @returns {Array} Returns the new array of grouped elements.
|
---|
17 | * @example
|
---|
18 | *
|
---|
19 | * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
|
---|
20 | * return a + b + c;
|
---|
21 | * });
|
---|
22 | * // => [111, 222]
|
---|
23 | */
|
---|
24 | var zipWith = baseRest(function(arrays) {
|
---|
25 | var length = arrays.length,
|
---|
26 | iteratee = length > 1 ? arrays[length - 1] : undefined;
|
---|
27 |
|
---|
28 | iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
|
---|
29 | return unzipWith(arrays, iteratee);
|
---|
30 | });
|
---|
31 |
|
---|
32 | export default zipWith;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.