Add zip

Open
#43 0 comments 0 reactions 1 assignee View on GitHub

@ramongr is already working on this.

Since May 6, 2026.

Assessment

This issue has not been assessed yet.

Description

additive v3-accepted
Operation

zip

Category

transformations

Proposed signature
export function zip<T extends readonly (readonly unknown[])[]>(
  ...arrays: T
): { [K in keyof T]: T[K] extends readonly (infer U)[] ? U : never }[]
Why this isn't covered by native ES/TS

No native equivalent.

Empty / edge-case behaviour
  • No arguments → [].
  • Result length = length of the shortest input array (document this; an alternative zipLongest could be a follow-up).
  • Variadic arity preserved in the tuple type.
Examples
zip([1, 2, 3], ['a', 'b', 'c']);          // [[1, 'a'], [2, 'b'], [3, 'c']]
zip([1, 2, 3], ['a', 'b'], [true]);       // [[1, 'a', true]]
Acceptance criteria
  • Implementation in src/transformations/zip.ts
  • Re-exported from src/transformations/index.ts
  • Tests in tests/transformations/zip.test.ts (incl. unequal lengths, no args)
  • Docs added in docs/transformations.md
  • README API table updated
Dominant language
TypeScript
Stars
2
Forks
0
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ramongr/op-array

All issues in ramongr/op-array

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.