RxJS: Turn a Stream of Objects into an Object of Streams


Kostia Palchyk
2 min readSep 23, 2020

Hi, fellow streamer! Today I want to share a JS/TS package that allows you to access props of objects on Observables:

tl;dr: github.com/kosich/rxjs-proxify 📦

A simple use case:

☝️ of will create an Observable out of it's arguments

The package has good TypeScript support, so all props are intelli-sensed by cats, dogs, and IDEs:

👀 I can see your intentions

It’s also possible to call methods on values, e.g.:

🤯 pure magic, I tell you

And you can apply RxJS operators at any depth:

🤲 scan accumulates values over time

The package uses Proxies under the hood, recursively applying it to sub-properties and method results, so the chain can be indefinitely deep. And you can apply .subscribe or .pipe at any time!

🎹 Try it

You can install it via npm i rxjs-proxify
Or test it online: stackblitz.com/edit/rxjs-proxify-repl

📖 Repository

The source code and more examples are available on github repo:

👋 Outro

Thank you for reading this article!
Stay reactive and have a nice day 🙂

If you enjoyed reading — please, indicate that with 👏 claps

Soon I’ll post a more detailed review of the lib and how it works!
Follow me here and on twitter for more RxJS, React, and JS posts:

🗣 Would love to hear your thoughts!