Another RxJS one:
I often combine streams with forkJoin or combineLatest and want the output as an object with stream names as keys. Before, I did it like this:
forkJoin
combineLatest
combineLatest([firstStream$, secondStream$]).pipe( map(([first, second]) => ({first, second})) ) // output: { first: 'some value', second: 'some other value' }
But, you can directly do:
combineLatest({ first: firstStream$, second: secondStream$ })
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Another RxJS one:
I often combine streams with
forkJoinorcombineLatestand want the output as an object with stream names as keys. Before, I did it like this:But, you can directly do: