Creating Your Own Operator

Let's see how we can create our own operators using map and the implementation of map operator.

Creating operators using map

So far, you’ve used operators provided by the RxJS library. However, you shouldn’t be limited to those. With pipe, creating your own operators is easier than ever.

An operator is a function that takes an observable, manipulates it in some way, and returns that new observable. This might be a bit complicated, so let’s look at some code.

In this simple case, an operator is created that appends a string to each value passed through the observable.

Get hands-on with 1200+ tech skills courses.