Map each emitted value to it's property, defined by path:
Also see the
map
operator and try comparing pluck to map
12345678910111213141516171819const { rxObserver } = require('api/v0.3'); const { of } = require('rxjs'); const { pluck, map } = require('rxjs/operators'); const source$ = of({ a: 1 }, { a: 2 }, { a: 3 }); source$ .pipe( map(x => JSON.stringify(x)) ) .subscribe(rxObserver('of( { a: 1 } , ... )')); source$ .pipe( pluck('a') ) .subscribe(rxObserver(`pluck('a')`));
NOTE: I've created a package to simplify subproperty access
It turns Observables of Objects into Objects of Observables
Check it out: rxjs/proxy {👓}