Skip to content
This repository was archived by the owner on Oct 1, 2018. It is now read-only.

Commit 17b4b17

Browse files
committed
docs(operators): add documentation for pluck
1 parent 9f7b9df commit 17b4b17

File tree

1 file changed

+51
-2
lines changed
  • src/operator-docs/transformation

1 file changed

+51
-2
lines changed
Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,55 @@
11
import { OperatorDoc } from '../operator.model';
22

33
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: `The nested properties to 'pluck' from each source value (an object).`
14+
}
15+
],
16+
shortDescription: {
17+
description:
18+
'Maps each source value (an object) to its specified nested property.',
19+
extras: [
20+
{
21+
type: 'Tip',
22+
text: `
23+
Like <a href="#/operators/map" class="markdown-code">map</a>, but meant only for picking
24+
one of the nested properties of every emitted object.
25+
`
26+
}
27+
]
28+
},
29+
walkthrough: {
30+
description: `
31+
<p>
32+
Given a list of strings describing a path to an object property, retrieves the value of a specified
33+
nested property from all values in the source Observable. If a property can't be resolved, it will
34+
return <span class="markdown-code">undefined</span> for that value.
35+
</p>
36+
`
37+
},
38+
examples: [
39+
{
40+
name:
41+
'Map every every click to the tagName of the clicked target element',
42+
code: `
43+
const clicks = Rx.Observable.fromEvent(document, 'click');
44+
const tagNames = clicks.pluck('target', 'tagName');
45+
tagNames.subscribe(x => console.log(x));
46+
`,
47+
externalLink: {
48+
platform: 'JSBin',
49+
url: 'http://jsbin.com/vucuca/embed?js,console,output'
50+
}
51+
}
52+
],
53+
relatedOperators: ['map'],
54+
additionalResources: []
655
};

0 commit comments

Comments
 (0)