I have created a Rx.Observable
from a stream of events:
Rx.Observable.fromEvent(recognizeStream, \'data\')
In which every data
Operators flatMap()
and concatMap()
are both a good choice. You can just turn the alternatives
property to another Observable and then emit the array items merged into the stream.
const Observable = Rx.Observable;
Observable.of({ error: null, alternatives: ['result1', 'result2', 'result3'] })
.concatMap(val => {
return Observable.from(val['alternatives']);
})
.subscribe(val => console.log(val));
This prints to console:
result1
result2
result3
See live demo: https://jsbin.com/foqutab/2/edit?js,console