MergeMap for each expand occurence

Viewed 512

I want to create an Observable chain which will be able to add http data to each expand occurence before the next one and I can't figure out how.

Actual test:

Observable.of('')
          .expand(n => n.length < 15 ? Observable.of(n + 'e') : Observable.empty())
          .mergeMap(n => Observable.of(n + 'm'))
          .subscribe(v => console.log(v));

Output:

m
em
eem
eeem
eeeem
eeeeem

Expected output:

em
emem
ememem

The goal of this is to add informations to each expand call using an http request.

1 Answers
Related