Skip to content
This repository was archived by the owner on Oct 1, 2018. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 54 additions & 2 deletions src/operator-docs/transformation/pluck.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,58 @@
import { OperatorDoc } from '../operator.model';

export const pluck: OperatorDoc = {
'name': 'pluck',
'operatorType': 'transformation'
name: 'pluck',
operatorType: 'transformation',
signature: 'public pluck(properties: ...string): Observable',
marbleUrl: 'http://reactivex.io/rxjs/img/pluck.png',
parameters: [
{
name: 'properties',
type: '...string',
attribute: '',
description: `
The nested properties to 'pluck' from each source value (an object).
`
}
],
shortDescription: {
description:
'Maps each source value (an object) to its specified nested property.',
extras: [
{
type: 'Tip',
text: `
Like <a href="#/operators/map" class="markdown-code">map</a>, but meant
only for picking one of the nested properties of every emitted object.
`
}
]
},
walkthrough: {
description: `
<p>
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 <span class="markdown-code">undefined</span>
for that value.
</p>
`
},
examples: [
{
name:
'Map every every click to the tagName of the clicked target element',
code: `
const clicks = Rx.Observable.fromEvent(document, 'click');
const tagNames = clicks.pluck('target', 'tagName');
tagNames.subscribe(x => console.log(x));
`,
externalLink: {
platform: 'JSBin',
url: 'http://jsbin.com/vucuca/embed?js,console,output'
}
}
],
relatedOperators: ['map'],
additionalResources: []
};