Skip to content

@epikodelabs/streamix


@epikodelabs/streamix / src/public-api / ForkOption

Interface: ForkOption<T, R> ​

Defined in: projects/libraries/streamix/src/lib/operators/fork.ts:27

Represents a conditional branch for the fork operator.

Each ForkOption defines:

  1. A predicate function on to test source values.
  2. A handler function handler that produces a stream (or value/array/promise) when the predicate matches.

Type Parameters ​

T ​

T = any

The type of values in the source stream.

R ​

R = any

The type of values emitted by the handler and output stream.

Properties ​

on ​

on: (value, index) => MaybePromise<boolean>

Defined in: projects/libraries/streamix/src/lib/operators/fork.ts:35

Predicate function to determine if this option should handle a value.

Parameters ​

value ​

T

The value from the source stream.

index ​

number

The zero-based index of the value in the source stream.

Returns ​

MaybePromise<boolean>

A boolean or a Promise<boolean> indicating whether this option matches.


handler ​

handler: (value) => ForkHandlerResult<R>

Defined in: projects/libraries/streamix/src/lib/operators/fork.ts:49

Handler function called for values that match the predicate.

Can return:

Parameters ​

value ​

T

The source value that matched the predicate.

Returns ​

ForkHandlerResult<R>

A stream, atom, iterable, promise, or scalar to be flattened and emitted.

Released under the MIT License.