effect-io-ai

Package: effect
Module: Array

Array.dedupe

Removes duplicates using Equal.equivalence(), preserving the order of the first occurrence.

When to use

Use to remove repeated values from an iterable when Effect’s default equality is the right comparison, preserving the first occurrence.

Example (Removing duplicates)

import { Array } from "effect"

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

See

Signature

declare const dedupe: <S extends Iterable<any>>(self: S) => S extends NonEmptyReadonlyArray<infer A> ? NonEmptyArray<A> : S extends Iterable<infer A> ? Array<A> : never

Source

Since v2.0.0