zipWith es-toolkit
Creates a new array by combining multiple arrays using a custom function.
Usage
zipWith(...arrs, combine)
Use zipWith when you want to combine elements at the same position from multiple arrays in a desired way. It passes elements at the same index from each array to the combine function and creates a new array from the results.
If the arrays have different lengths, it adjusts to the longest array's length. Empty positions in shorter arrays are passed as undefined.
Parameters
The arrays to combine.
A function that receives elements at the same index from each array, followed by the index itself, and returns a new value.
Returns
Returns a new array consisting of results from applying the combine function.
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.