Files
2025-11-28 19:45:44 -07:00

18 lines
500 B
JavaScript

'use strict';
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
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;
}
exports.zipWith = zipWith;