javascript - RxJS 1 array item into sequence of single items - operator -


given such observable

rx.observable.of([1,2,3,4,5]) 

which emits single item (that array), what operator transform observable 1 emits 5 single items (or whatever array consists of)?

the example on .of, same fetching arrays via promises, there might many other examples. don't suggest replace of from

i can't think of existing operator that, can make 1 :

arrayemitting$.concatmap(arrayvalues => rx.observable.merge(arrayvalues.map(rx.observable.of))) 

or simpler

arrayemitting$.concatmap(rx.observable.of) 

or shortest

arrayemitting$.concatmap(x => x) 

that untested let me know if worked you, , uses rxjs v4 api (specially last one). :

  • process each incoming array of values 1 unit (meaning next incoming array not interlap previous 1 - why use concatmap)
  • the incoming array transformed array of observables, merged : ensures emission of values separately , in sequence

Comments

Popular posts from this blog

'hasOwnProperty' in javascript -

python - ValueError: No axis named 1 for object type <class 'pandas.core.series.Series'> -

java - How to provide dependency injections in Eclipse RCP 3.x? -