This repository has been archived on 2026-03-28. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
StasisWarden-Legacy/node_modules/es-toolkit/dist/array/zipWith.mjs
T

14 lines
404 B
JavaScript

function zipWith(arr1, ...rest) {
const arrs = [arr1, ...rest.slice(0, -1)];
const combine = rest[rest.length - 1];
const maxIndex = Math.max(...arrs.map(arr => arr.length));
const result = Array(maxIndex);
for (let i = 0; i < maxIndex; i++) {
const elements = arrs.map(arr => arr[i]);
result[i] = combine(...elements);
}
return result;
}
export { zipWith };