From 1f36536bba5798dc0410643b02d746ee3d043171 Mon Sep 17 00:00:00 2001 From: natmegs Date: Fri, 17 Nov 2017 17:35:12 -0800 Subject: [PATCH 1/2] docs(operators): add documentation for operator map closes #117 --- src/operator-docs/transformation/map.ts | 54 ++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 2 deletions(-) diff --git a/src/operator-docs/transformation/map.ts b/src/operator-docs/transformation/map.ts index b8496df7..b184cd25 100644 --- a/src/operator-docs/transformation/map.ts +++ b/src/operator-docs/transformation/map.ts @@ -1,6 +1,56 @@ import { OperatorDoc } from '../operator.model'; export const map: OperatorDoc = { - 'name': 'map', - 'operatorType': 'transformation' + name: 'map', + operatorType: 'transformation', + signature: 'public map(project: Function, thisArg: any): Observable', + parameters: [ + { + name: 'project', + type: '(value: T, index: number) => R', + attribute: '', + description: `The function to apply to each 'value' emitted by the source Observable. The 'index' parameter is the number 'i' + for the i-th emission that has happened since the subscription, starting from the number '0'.` + }, + { + name: 'thisArg', + type: 'any', + attribute: 'optional', + description: + "An optional argument to define what this is in the 'project' function." + } + ], + marbleUrl: 'http://reactivex.io/rxjs/img/map.png', + shortDescription: { + description: ` + Applies a given project function to each value emitted by the source + Observable, and emits the resulting values as an Observable. + `, + extras: [] + }, + walkthrough: { + description: ` +

+ Similar to the well known Array.prototype.map function, + this operator applies a projection to each value and emits that projection in the output + Observable. +

+ ` + }, + examples: [ + { + name: 'Map every click to the clientX position of that click', + code: ` + let clicks = Rx.Observable.fromEvent(document, 'click'); + let positions = clicks.map(ev => ev.clientX); + positions.subscribe(x => console.log(x)); + `, + externalLink: { + platform: 'JSBin', + url: 'http://jsbin.com/geyokey/embed?js,console' + } + } + ], + relatedOperators: ['mapTo', 'pluck'], + additionalResources: [] }; From 7ea9ecaf4c6fd3d3c9434d93291bcd93999044d2 Mon Sep 17 00:00:00 2001 From: natmegs Date: Mon, 20 Nov 2017 20:00:05 -0800 Subject: [PATCH 2/2] docs(map): fix JS bin link --- src/operator-docs/transformation/map.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/operator-docs/transformation/map.ts b/src/operator-docs/transformation/map.ts index b184cd25..0221acfe 100644 --- a/src/operator-docs/transformation/map.ts +++ b/src/operator-docs/transformation/map.ts @@ -47,7 +47,7 @@ export const map: OperatorDoc = { `, externalLink: { platform: 'JSBin', - url: 'http://jsbin.com/geyokey/embed?js,console' + url: 'http://jsbin.com/dutered/embed?js,console,output' } } ],