unzipWith es-toolkit
Unpacks grouped arrays and applies a transformation function to return a new array.
Usage
unzipWith(target, iteratee)
Use unzipWith when you want to collect elements at the same position from a 2D array where multiple arrays are grouped together and apply a transformation function to get the result. It's similar to unzip but allows you to transform the elements in each group with a custom function.
If arrays have different lengths, undefined is passed.
Passing an empty array will throw an error.
Parameters
A 2D array where multiple arrays are grouped together to be unpacked and transformed.
A function that receives elements at the same position and transforms them into a new value.
Returns
A new array created by applying the transformation function to the results.
Source: es-toolkit
Re-exported verbatim from es-toolkit. Implementation, edge cases, and performance behavior are owned upstream. This page mirrors the documentation at the pinned version; the linked source is authoritative.