Skip to main content

mapObservablePipe

Alternative: map$$$

Inlined: mapObservable, map$$

Types

function mapObservablePipe<GIn, GOut>(
mapFunction: IMapFunction<GIn, GOut>,
): IObservablePipe<GIn, GOut>

Definition

Applies a given mapFunction function to each value emitted by the source Observable, and emits the resulting values as an Observable.

The RxJS equivalent is map.

Diagram

Algorithm

OUTmapObservablePipe(mapFunction)observableOUTmapObservablePipe(mapFunction)observablecalls mapFunction(value)valuevalue returned by mapFunction

Example

OUTmapObservablePipe(x => x * 10)observableOUTmapObservablePipe(x => x * 10)observable110220330

Example

Multiply incoming values by 10

const subscribe = pipe$$(of(1, 2, 3), [
map$$$(x => x * 10),
]);

subscribe((value) => {
console.log(value);
});

Output:

10
20
30

Shortcuts

toStringObservablePipe

toStringObservablePipe<GValue>(): IObservablePipe<GValue, string>;

Alternative: toString$$$

Inlined: toStringObservable, toString$$

Equivalent of mapObservablePipe(String)

toNumberObservablePipe

toNumberObservablePipe<GValue>(): IObservablePipe<GValue, number>;

Alternative: toNumber$$$

Inlined: toNumberObservable, toNumber$$

Equivalent of mapObservablePipe(Number)

toBooleanObservablePipe

toBooleanObservablePipe<GValue>(): IObservablePipe<GValue, boolean>;

Alternative: toBoolean$$$

Inlined: toBooleanObservable, toBoolean$$

Equivalent of mapObservablePipe(Boolean)