Demo: pluck
With the pluck operator we can select the desired key out of the incoming objects from the source.
Note: 'pluck' is going to be deprecated in v8 as we can use map operator to achieve the same.
pluck('dept');
//vs its Eqivalent using map
map((v:any) => v?.dept);
//Displayed values on the Dots are truncated.
//Please use the tooltip to find the actual values.
let input=of({id:1,dept:"sales"},{id:2,dept:"HR"},
{id:3,dept:"admin"},{id:4,dept:"support"})
.pipe(concatMap(v =>of(v).pipe(delay(2000))));
//Pick the desired key out of the input object
let process = pluck('dept');
//Displayed values on the Dots are truncated.
//Please use the tooltip to find the actual values.
let output=input.pipe(process).subscribe(v=>console.log(v))