From 17b4b172c6522838ab86f4b9b9877714fe500321 Mon Sep 17 00:00:00 2001 From: Hardik Pithva Date: Sat, 30 Dec 2017 12:23:27 +0530 Subject: [PATCH 1/2] docs(operators): add documentation for pluck --- src/operator-docs/transformation/pluck.ts | 53 ++++++++++++++++++++++- 1 file changed, 51 insertions(+), 2 deletions(-) diff --git a/src/operator-docs/transformation/pluck.ts b/src/operator-docs/transformation/pluck.ts index 7c4cec25..a83f835e 100644 --- a/src/operator-docs/transformation/pluck.ts +++ b/src/operator-docs/transformation/pluck.ts @@ -1,6 +1,55 @@ 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 map, but meant only for picking + one of the nested properties of every emitted object. + ` + } + ] + }, + walkthrough: { + description: ` +

+ 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. +

+ ` + }, + 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: [] }; From bb2002949496df9c09539e506a4e810c4c0478a3 Mon Sep 17 00:00:00 2001 From: Hardik Pithva Date: Sat, 30 Dec 2017 12:27:28 +0530 Subject: [PATCH 2/2] fix(operators): update description indentation --- src/operator-docs/transformation/pluck.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/operator-docs/transformation/pluck.ts b/src/operator-docs/transformation/pluck.ts index a83f835e..21d692e2 100644 --- a/src/operator-docs/transformation/pluck.ts +++ b/src/operator-docs/transformation/pluck.ts @@ -10,7 +10,9 @@ export const pluck: OperatorDoc = { name: 'properties', type: '...string', attribute: '', - description: `The nested properties to 'pluck' from each source value (an object).` + description: ` + The nested properties to 'pluck' from each source value (an object). + ` } ], shortDescription: { @@ -20,8 +22,8 @@ export const pluck: OperatorDoc = { { type: 'Tip', text: ` - Like map, but meant only for picking - one of the nested properties of every emitted object. + Like map, but meant + only for picking one of the nested properties of every emitted object. ` } ] @@ -29,9 +31,10 @@ export const pluck: OperatorDoc = { walkthrough: { description: `

- 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. + 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.

` },