UNPKG

moy-fp

Version:
19 lines (16 loc) 359 B
import curry from '../Function/curry' /** * ((b, a) -> c) -> [b] -> [a] -> [c] */ const zipWith = curry( (fn, list2, list1) => { const list = [], length = Math.min(list1.length, list2.length) let index = 0 while(index < length){ list.push(fn(list2[index], list1[index ++])) } return list } ) export default zipWith