Skip to content

Function: createOperator()

createOperator<T, R>(name, transformFn): Operator<T, R>

Defined in: abstractions/operator.ts:57

Creates a reusable stream operator.

This factory function simplifies the creation of operators by bundling a name and a transformation function into a single Operator object.

Type Parameters

T

T = any

The type of the value the operator will consume.

R

R = T

The type of the value the operator will produce.

Parameters

name

string

The name of the operator, for identification and debugging.

transformFn

(source) => AsyncIterator<R>

The transformation function that defines the operator's logic.

Returns

Operator<T, R>

A new Operator object with the specified name and transformation function.

Released under the MIT License.