Skip to main content
Module

x/froebel/list.ts>zip

A strictly typed utility library.
Go to Latest
variable zip
import { zip } from "https://deno.land/x/froebel@v0.21.0/list.ts";

Takes multiple lists and returns a list of tuples containing the value in each list at the current index. If the lists are of different lengths, the returned list of tuples has the length of the shortest passed in list.

Examples

Example 1

const pairs = zip([1,2,3], ['a','b','c'])
console.log(pairs) // prints: [[1,'a'], [2,'b'], [3,'c']]

type

<T extends unknown[][]>(...lists: T) => Zip<T>