Interface: Operator<Input, Output>#

"urx/src/pipe".Operator

Operators can transform and control the flow of values. pipe is used to transform one Emitter into another by stacking operators to its values. To build your own operator that looks like the built-in ones, create a function which returns an operator. The following custom operator multiplies the passed value:

function multiplyBy(multiplier: number): Operator<number> {
return done => value => done(value * multiplier)
}
const foo = stream<number>()
const multipliedFoo = pipe(foo, multiplyBy(3))
subscribe(multipliedFoo, value => console.log(value))
publish(foo, 42)

Type parameters#

NameDefault
Input-
OutputInput

Hierarchy#

  • Operator

Callable#

â–¸ (done: (value: Output) => void): function

Defined in urx/src/pipe.ts:42

Operators can transform and control the flow of values. pipe is used to transform one Emitter into another by stacking operators to its values. To build your own operator that looks like the built-in ones, create a function which returns an operator. The following custom operator multiplies the passed value:

function multiplyBy(multiplier: number): Operator<number> {
return done => value => done(value * multiplier)
}
const foo = stream<number>()
const multipliedFoo = pipe(foo, multiplyBy(3))
subscribe(multipliedFoo, value => console.log(value))
publish(foo, 42)

Parameters:#

NameType
done(value: Output) => void

Returns: function