You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
1.1 KiB
29 lines
1.1 KiB
2 years ago
|
import { OperatorFunction } from '../interfaces';
|
||
|
/**
|
||
|
* Maps each source value (an object) to its specified nested property.
|
||
|
*
|
||
|
* <span class="informal">Like {@link map}, but meant only for picking one of
|
||
|
* the nested properties of every emitted object.</span>
|
||
|
*
|
||
|
* <img src="./img/pluck.png" width="100%">
|
||
|
*
|
||
|
* 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.
|
||
|
*
|
||
|
* @example <caption>Map every click to the tagName of the clicked target element</caption>
|
||
|
* var clicks = Rx.Observable.fromEvent(document, 'click');
|
||
|
* var tagNames = clicks.pluck('target', 'tagName');
|
||
|
* tagNames.subscribe(x => console.log(x));
|
||
|
*
|
||
|
* @see {@link map}
|
||
|
*
|
||
|
* @param {...string} properties The nested properties to pluck from each source
|
||
|
* value (an object).
|
||
|
* @return {Observable} A new Observable of property values from the source values.
|
||
|
* @method pluck
|
||
|
* @owner Observable
|
||
|
*/
|
||
|
export declare function pluck<T, R>(...properties: string[]): OperatorFunction<T, R>;
|