Theoretically it should be possible to implement any RxJS operator (except just()
and flatMap()
) through flatMap()
. For instance map()
can be implemented as
function map(source, selector) {
return source.flatMap(x => Rx.Observable.just(selector(x)));
}
How to implement merge()
through flatMap()
? (avoiding mergeAll()
too, of course)
It looks possible if you take advantage of the fact that flatMap can also take array return values.
EDIT 1
Using RxJS 6 and the
pipe
syntax