of([1,2,3]).subscribe(console.log)
prints:[1,2,3]
But:
of([1,2,3]).pipe(concatAll()).subscribe(console.log)
prints:
1
2
3
Why the above happens? Why adding concatAll()
emits the elements of the array one by one? Isn't this somehow the opposite of what the word concat means?
I feel that concatAll()
acts differently depending on the input.
Consider also this:
from([of(1),of(2),of(3)]).pipe(concatAll()).subscribe(console.log)
It will again print:
1
2
3
So of([1,2,3]).pipe(concatAll())
== from([of(1),of(2),of(3)]).pipe(concatAll())
But of([1,2,3])
!= from([of(1),of(2),of(3)])
because subscribing to the latter will print:
Observable { _isScalar: false, _subscribe: [Function] }
Observable { _isScalar: false, _subscribe: [Function] }
Observable { _isScalar: false, _subscribe: [Function] }
The right side of the above equality is pretty clear to me, but where is documented that concatAll()
should emit all the values of the array separately, acting like a pipeable from
?