An operator is a composable function or transformation that processes values emitted by an Observable. It changes the stream before values reach a subscriber, usually by returning a new Observable that can be chained with other operators. section 1.5 section 9.4.3
Operators provide the points where a stream changes course. A custom operator subscribes to its source, handles next, error, and complete notifications, and returns an unsubscribe function so cancellation propagates upstream. section 9.4.3 section 9.4.1
Common custom operators illustrate different stream transformations:
- map applies a function to every emitted value and produces transformed values. section 9.4.3
- filter forwards only values satisfying a predicate. section 9.4.3
- reduce accumulates values and emits the final result when the source completes. section 9.4.3
- skip suppresses an initial number of values before forwarding subsequent emissions. section 9.4.3
Composing a stream pipeline
A pipeline can skip the first value, keep even values, square them, and add the results: reduce(add, 0, map(square, filter(isEven, skip(1, obs)))). With Observable.of(1, 2, 3, 4), the subscriber receives 20.

