effect-io-ai

Package: effect
Module: Array

Array.union

Computes the union of two arrays, removing duplicates using Equal.equivalence().

Example (Computing array unions)

import { Array } from "effect"

console.log(Array.union([1, 2], [2, 3])) // [1, 2, 3]

See

Signature

declare const union: { <T extends Iterable<any>>(that: T): <S extends Iterable<any>>(self: S) => ReadonlyArray.OrNonEmpty<S, T, ReadonlyArray.Infer<S> | ReadonlyArray.Infer<T>>; <A, B>(self: NonEmptyReadonlyArray<A>, that: ReadonlyArray<B>): NonEmptyArray<A | B>; <A, B>(self: ReadonlyArray<A>, that: NonEmptyReadonlyArray<B>): NonEmptyArray<A | B>; <A, B>(self: Iterable<A>, that: Iterable<B>): Array<A | B>; }

Source

Since v2.0.0