I have two streams :
const sourceOne = of(1, 2, 3);
const sourceTwo = of(4, 5, 6);
const example = sourceOne.pipe(concat(sourceTwo)); //123456
As you see , I've concatenated them unconditionally.
But it turns out that I need to concat them only if the first item from sourceOne
is "even". (%2==0
)
Question:
How can I concat sourceTwo
to sourceOne
by adding conditions regarding the first stream ?
I know I can create an external method which will be piped , but I don't think it's the RXJS way of doing it.