Skip to content

unzipWith

js
_.unzipWith(array, [iteratee=_.identity])

此方法类似于 _.unzip,只是它接受 iteratee 来指定如何组合重新分组的值。迭代器使用每个组的元素调用:(...group)。

¥This method is like _.unzip except that it accepts iteratee to specify how regrouped values should be combined. The iteratee is invoked with the elements of each group: (...group).

新增于

¥Since

3.8.0

参数

¥Arguments

  1. array (数组):要处理的分组元素数组。

    ¥array (Array): The array of grouped elements to process.

  2. [iteratee=_.identity] (函数):组合重新分组值的函数。

    ¥[iteratee=_.identity] (Function): The function to combine regrouped values.

返回

¥Returns

(数组):返回新的重新分组元素数组。

¥(Array): Returns the new array of regrouped elements.

示例

¥Example

js
var zipped = _.zip([1, 2], [10, 20], [100, 200]);
// => [[1, 10, 100], [2, 20, 200]]

_.unzipWith(zipped, _.add);
// => [3, 30, 300]

Lodash v4.17 中文网 - 粤ICP备13048890号