Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/proc/src/enumerable.ts>Enumerable#unzip

A better way to work with processes in Deno.
Go to Latest
method Enumerable.prototype.unzip
import { Enumerable } from "https://deno.land/x/proc@0.20.37/src/enumerable.ts";

Unzip a collection of [A, B] into Enumerable<A> and Enumerable<B>.

Note that this operations uses tee, so it will use memory during the iteration.

Example

const [a, b] = enumerate([[1, "A"], [2, "B"], [3, "C"]]).unzip();

// a is number[] -> [1, 2, 3]
// b is string[] -> ["A", "B", "C"]

Returns

Two enumerables, one for the left side of the tuple and the other for the right.