In RxJS I want to convert an array that I have at some point into a sequence of items that are in the array. I found two ways to do it: Option 1 & 2, which I guess, do the same thing:
const obj = { array: [1, 2, 3, 4, 5] };
const observable = Observable.of(obj);
// Option 1
observable.flatMap(x => {
return Observable.from(x.array);
}).subscribe(console.log);
// Option 2
observable.flatMap(x => x.array).subscribe(console.log);
// Option 3 ?
Are there nicer / better ways that express what I'm doing , I mean without flatMap operator?