effect-io-ai

Package: effect
Module: Array

Array.unzip

Splits an array of pairs into two arrays. Inverse of zip.

Example (Unzipping pairs)

import { Array } from "effect"

console.log(Array.unzip([[1, "a"], [2, "b"], [3, "c"]])) // [[1, 2, 3], ["a", "b", "c"]]

See

Signature

declare const unzip: <S extends Iterable<readonly [any, any]>>(self: S) => S extends NonEmptyReadonlyArray<readonly [infer A, infer B]> ? [NonEmptyArray<A>, NonEmptyArray<B>] : S extends Iterable<readonly [infer A, infer B]> ? [Array<A>, Array<B>] : never

Source

Since v2.0.0