method StreamClass.prototype.dedupBy
Private
StreamClass.prototype.dedupBy(key: (value: T) => unknown): StreamClass<T, E>

Drops consecutive duplicate values by key — failures are transparent: they pass through without resetting the last-seen memory.

await Stream.from([1, 1, 2, 2, 1]).dedupBy((n) => n).collect(); // [1, 2, 1]

Parameters

key: (value: T) => unknown

Return Type

Usage

import { StreamClass } from "lib/stream/stream.ts";