|
1 | 1 | import { OperatorDoc } from '../operator.model';
|
2 | 2 |
|
3 | 3 | export const pluck: OperatorDoc = {
|
4 |
| - 'name': 'pluck', |
5 |
| - 'operatorType': 'transformation' |
| 4 | + name: 'pluck', |
| 5 | + operatorType: 'transformation', |
| 6 | + signature: 'public pluck(properties: ...string): Observable', |
| 7 | + marbleUrl: 'http://reactivex.io/rxjs/img/pluck.png', |
| 8 | + parameters: [ |
| 9 | + { |
| 10 | + name: 'properties', |
| 11 | + type: '...string', |
| 12 | + attribute: '', |
| 13 | + description: ` |
| 14 | + The nested properties to 'pluck' from each source value (an object). |
| 15 | + ` |
| 16 | + } |
| 17 | + ], |
| 18 | + shortDescription: { |
| 19 | + description: |
| 20 | + 'Maps each source value (an object) to its specified nested property.', |
| 21 | + extras: [ |
| 22 | + { |
| 23 | + type: 'Tip', |
| 24 | + text: ` |
| 25 | + Like <a href="#/operators/map" class="markdown-code">map</a>, but meant |
| 26 | + only for picking one of the nested properties of every emitted object. |
| 27 | + ` |
| 28 | + } |
| 29 | + ] |
| 30 | + }, |
| 31 | + walkthrough: { |
| 32 | + description: ` |
| 33 | + <p> |
| 34 | + Given a list of strings describing a path to an object property, retrieves |
| 35 | + the value of a specified nested property from all values in the source Observable. |
| 36 | + If a property can't be resolved, it will return <span class="markdown-code">undefined</span> |
| 37 | + for that value. |
| 38 | + </p> |
| 39 | + ` |
| 40 | + }, |
| 41 | + examples: [ |
| 42 | + { |
| 43 | + name: |
| 44 | + 'Map every every click to the tagName of the clicked target element', |
| 45 | + code: ` |
| 46 | + const clicks = Rx.Observable.fromEvent(document, 'click'); |
| 47 | + const tagNames = clicks.pluck('target', 'tagName'); |
| 48 | + tagNames.subscribe(x => console.log(x)); |
| 49 | + `, |
| 50 | + externalLink: { |
| 51 | + platform: 'JSBin', |
| 52 | + url: 'http://jsbin.com/vucuca/embed?js,console,output' |
| 53 | + } |
| 54 | + } |
| 55 | + ], |
| 56 | + relatedOperators: ['map'], |
| 57 | + additionalResources: [] |
6 | 58 | };
|
0 commit comments