Skip to content

@epikodelabs/streamix


@epikodelabs/streamix / skipWhile

Function: skipWhile()

skipWhile<T>(predicate): Operator<T, T>

Defined in: projects/libraries/streamix/src/lib/operators/skipWhile.ts:16

Creates a stream operator that skips values from the source stream while a predicate returns true.

Values skipped while the predicate holds are yielded with dropped: true so that backpressure is released and downstream operators can observe suppressed emissions. As soon as the predicate returns false for the first time, this operator emits that value and all subsequent values normally.

Type Parameters

T

T = any

The type of the values in the source and output streams.

Parameters

predicate

(value, index) => MaybePromise<boolean>

The function to test each value. Receives the value and its index. true means to continue skipping, and false means to stop skipping and begin emitting.

Returns

Operator<T, T>

An Operator instance that can be used in a stream's pipe method.

Released under the GNU AGPL v3 or later.