I have created a Rx.Observable
from a stream of events:
Rx.Observable.fromEvent(recognizeStream, \'data\')
In which every data
You should pluck "alternatives" then to iterate over the array use from, as from creates a new observable you need to flatten up it, so use you need flatMap to do the job. So finally you have alternatives back into the stream.
try it:
var data = {
error: null,
alternatives: [{
result: 1
}, {
result: 2
}, {
result: 3
}]
}
var input$ = Rx.Observable.of(data);
input$.pluck('alternatives').flatMap(alternatives => Rx.Observable.from(alternatives)).subscribe(alternative => console.log(alternative));