Package: effect
Module: Array
Removes consecutive duplicate elements using a custom equivalence.
When to use
Use when consecutive duplicates should be collapsed using a custom equivalence, while equivalent values that appear later should remain in the result.
Details
Non-adjacent duplicates are preserved.
Example (Deduplicating adjacent elements)
import { Array } from "effect"
console.log(Array.dedupeAdjacentWith([1, 1, 2, 2, 3, 3], (a, b) => a === b))
// [1, 2, 3]
See
dedupeAdjacent — uses default equalitydedupeWith — dedupes all duplicates, not just adjacentSignature
declare const dedupeAdjacentWith: { <A>(isEquivalent: (self: A, that: A) => boolean): (self: Iterable<A>) => Array<A>; <A>(self: Iterable<A>, isEquivalent: (self: A, that: A) => boolean): Array<A>; }
Since v2.0.0