Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 | 4x 7x 1x 2x 2x 3x 2x | import {BinaryFunction} from 'fnxt/fnxt-types'; export const zipWith = <E, F, R>(mapper: BinaryFunction<E, F, R>) => (arr1: E[]) => (arr2: F[]): Array<R> => { if (arr1.length !== arr2.length) { throw new Error('Input arrays must have equal lengths'); } const result: Array<R> = []; for (let i = 0; i < arr1.length; i++) { result.push(mapper(arr1[i], arr2[i])); } return result; }; |