I currently have two different streams which I will name as follows:
const firstStream = Rx.of([
{
first: 'first',
}, {
third: 'third',
}
]);
const secondStream = Rx.of([
{
second: 'second'
}, {
fourth: 'fourth'
}
]);
My goal is to create a combined stream that merges the results of these two streams and sorts the output array in a specific order like this:
const resultArr = [
{
first: 'first',
},
{
second: 'second'
},
{
third: 'third',
},
{
fourth: 'fourth'
}
];
I attempted to use combineLatest
along with the RxJS flatMap
operator, but encountered issues. To play around and troubleshoot, I have provided a StackBlitz playground link here: StackBlitz
I believe there are multiple solutions to achieve this task. If anyone has suggestions or can assist me, it would be greatly appreciated :)