function
stable
Maps each source value (an object) to its specified nested property.
pluck<T, R>(...properties: string[]): OperatorFunction<T, R>
properties | The nested properties to pluck from each source value (an object). |
OperatorFunction<T, R>
: A new Observable of property values from the source values.
Like map
, but meant only for picking one of the nested properties of every emitted object.
Given a list of strings describing a path to an object property, retrieves the value of a specified nested property from all values in the source Observable. If a property can't be resolved, it will return undefined
for that value.
Map every click to the tagName of the clicked target element
import { fromEvent } from 'rxjs'; import { pluck } from 'rxjs/operators'; const clicks = fromEvent(document, 'click'); const tagNames = clicks.pipe(pluck('target', 'tagName')); tagNames.subscribe(x => console.log(x));
pluck(k1: K1): OperatorFunction<T, T[K1]>
k1 | Type: |
OperatorFunction<T, T[K1]>
pluck(k1: K1, k2: K2): OperatorFunction<T, T[K1][K2]>
k1 | Type: |
k2 | Type: |
OperatorFunction<T, T[K1][K2]>
pluck(k1: K1, k2: K2, k3: K3): OperatorFunction<T, T[K1][K2][K3]>
k1 | Type: |
k2 | Type: |
k3 | Type: |
OperatorFunction<T, T[K1][K2][K3]>
pluck(k1: K1, k2: K2, k3: K3, k4: K4): OperatorFunction<T, T[K1][K2][K3][K4]>
k1 | Type: |
k2 | Type: |
k3 | Type: |
k4 | Type: |
OperatorFunction<T, T[K1][K2][K3][K4]>
pluck(k1: K1, k2: K2, k3: K3, k4: K4, k5: K5): OperatorFunction<T, T[K1][K2][K3][K4][K5]>
k1 | Type: |
k2 | Type: |
k3 | Type: |
k4 | Type: |
k5 | Type: |
OperatorFunction<T, T[K1][K2][K3][K4][K5]>
pluck(k1: K1, k2: K2, k3: K3, k4: K4, k5: K5, k6: K6): OperatorFunction<T, T[K1][K2][K3][K4][K5][K6]>
k1 | Type: |
k2 | Type: |
k3 | Type: |
k4 | Type: |
k5 | Type: |
k6 | Type: |
OperatorFunction<T, T[K1][K2][K3][K4][K5][K6]>
pluck(...properties: string[]): OperatorFunction<T, R>
properties | Type: |
OperatorFunction<T, R>
© 2015–2018 Google, Inc., Netflix, Inc., Microsoft Corp. and contributors.
Code licensed under an Apache-2.0 License. Documentation licensed under CC BY 4.0.
https://rxjs.dev/api/operators/pluck