Skip to content

@epikodelabs/streamix


@epikodelabs/streamix / aggregates/src/public-api / min

Function: min()

min<T>(comparator?): Operator<T, T>

Defined in: projects/libraries/streamix/aggregates/src/lib/operators/min.ts:15

Creates a stream operator that emits the smallest value produced by the source stream.

This terminal operator consumes every value, retaining the minimum seen so far as the stream progresses. A comparator may be provided to customize how values are ordered (asynchronous comparators are supported). Once the source completes, the minimum is emitted exactly once; empty sources result in DONE without emission.

Type Parameters

T

T = any

The type of the values in the source stream.

Parameters

comparator?

(a, b) => MaybePromise<number>

Optional comparison function. It should return a negative number when a < b, zero when equal, and a positive number when a > b. Defaults to the < operator.

Returns

Operator<T, T>

An Operator instance usable in a stream's pipe method.

Released under the GNU AGPL v3 or later.