npm install --save @rxjsx/rxjsx rxjs
import { of } from 'rxjs';
import { flatListMap } from '@rxjsx/rxjsx';
of([1, 2, 3], [4], [5, 6])
.pipe(flatListMap(x => of(x, 10+x)))
.subscribe(console.log);
You can experiment with the above code by forking this ReplIt repo or through this Medium article.
The available operators so far are the following:
Operator | Description |
---|---|
flatMap |
RxJS's mergeMap alias |
zipMap |
To zip the transformed value with the original value |
flatZipMap |
Similar to zipMap, but to be used when a transformation returns an observable |
projectToFormer |
To project an observable of pairs, to get the first coordinate |
projectToLatter |
To project an observable of pairs, to get the second coordinate |
projectTo |
To project an observable of tuples |
mapFormer |
To transform the first coordinate of an observable of pairs |
mapLatter |
To transform the second coordinate of an observable of pairs |
flatMapFormer |
Similar to mapFormer, but to work on stream-returning transformations |
flatMapLatter |
Similar to mapLatter, but to work on stream-returning transformations |
listMap |
To transform an observable of list, with a mapping on the list elements |
flatListMap |
To transform an observable of list, with a stream-returning member transformation |
listFlatMap |
To transform an observable of list, with a list-returning member transformation |
flatListFlatMap |
To transform an observable of list, with a list-observable-returning transformation |
This project needs your support. Don't forget to leave a ⭐ behind.