To use the pairs()
function from the rxjs library in TypeScript, you must first import it from the library. You can do this using the following code:
index.ts252 chars11 lines
In this example, we create an object obj
with two properties - name
and age
. We then use the pairs()
function to create an observable source
that emits an array of [key, value]
pairs for each property of the object.
We then subscribe to source
and log each [key, value]
pair to the console using destructuring assignment in the next
callback function.
Note that the pairs()
function is only available in RxJS version 6 or later.
gistlibby LogSnag