RxJS: Eight Operators Worth Getting to Know
# mapTo
Ignores the source value and emit the provided constant when the source emits.
# finalize
Call the provided function on error or complete.
# switchMapTo
Like switchMap
, for when you don’t need to use the source value.
There are also variations for mergeMapTo
and concatMapTo
.
# pluck
Maps each source value (an object) to its specified nested property.
# startWith
Emit given value(s) first.
# toArray
Creates an array from observable sequence. (upon completion)
# partition
Splits the source observable into two, one with values that satisfy a predicate, and another with values that don’t satisfy the predicate.
# empty
Just emits complete
, and nothing else.
Follow me on Medium or Twitter to read more about Angular, Vue and JS!
👂🏻 Last but Not Least, Have you Heard of Akita?
Akita is a state management pattern that we’ve developed here in Datorama. It’s been successfully used in a big data production environment for over seven months, and we’re continually adding features to it.
Akita encourages simplicity. It saves you the hassle of creating boilerplate code and offers powerful tools with a moderate learning curve, suitable for both experienced and inexperienced developers alike.
I highly recommend checking it out.