Skip to content

unctionjs/zip

Repository files navigation

@unction/zip

Tests Stability Dependencies

ListType | RecordType<unknown, R> | string => ListType | RecordType<unknown, L> | string => ListType<[R, L]> | RecordType<unknown, [R, L]>

Takes two iterables and merges them together, combining their values into an array

zip([1, 2, 3])([4, 5, 6])

returns

[[1, 4], [2, 5], [3, 6]]
zip({x: 1, y: 2, z: 0})({x: 0, y: 0, z: 0})

returns

{x: [1, 0], y: [2, 0], z: [0, 0]}