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

Keeps the first occurrence of each value by key, stream-wide (holds a Set of seen keys — bound infinite streams). Failures pass through.

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

Parameters

key: (value: T) => unknown

Return Type

Usage

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