work.suroh.tk/node_modules/rxjs/operators/mapTo.js.map

1 line
2.8 KiB
Plaintext
Raw Normal View History

2019-12-02 12:22:45 +00:00
{"version":3,"file":"mapTo.js","sourceRoot":"","sources":["../../src/operators/mapTo.ts"],"names":[],"mappings":";;;;;;AACA,2BAA2B,eAAe,CAAC,CAAA;AAI3C;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAA4B,KAAQ;IAClC,MAAM,CAAC,UAAC,MAAqB,IAAK,OAAA,MAAM,CAAC,IAAI,CAAC,IAAI,aAAa,CAAC,KAAK,CAAC,CAAC,EAArC,CAAqC,CAAC;AAC1E,CAAC;AAFe,aAAK,QAEpB,CAAA;AAED;IAIE,uBAAY,KAAQ;QAClB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED,4BAAI,GAAJ,UAAK,UAAyB,EAAE,MAAW;QACzC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,eAAe,CAAC,UAAU,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IACvE,CAAC;IACH,oBAAC;AAAD,CAAC,AAXD,IAWC;AAED;;;;GAIG;AACH;IAAoC,mCAAa;IAI/C,yBAAY,WAA0B,EAAE,KAAQ;QAC9C,kBAAM,WAAW,CAAC,CAAC;QACnB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAES,+BAAK,GAAf,UAAgB,CAAI;QAClB,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;IACH,sBAAC;AAAD,CAAC,AAZD,CAAoC,uBAAU,GAY7C","sourcesContent":["import { Operator } from '../Operator';\nimport { Subscriber } from '../Subscriber';\nimport { Observable } from '../Observable';\nimport { OperatorFunction } from '../interfaces';\n\n/**\n * Emits the given constant value on the output Observable every time the source\n * Observable emits a value.\n *\n * <span class=\"informal\">Like {@link map}, but it maps every source value to\n * the same output value every time.</span>\n *\n * <img src=\"./img/mapTo.png\" width=\"100%\">\n *\n * Takes a constant `value` as argument, and emits that whenever the source\n * Observable emits a value. In other words, ignores the actual source value,\n * and simply uses the emission moment to know when to emit the given `value`.\n *\n * @example <caption>Map every click to the string 'Hi'</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var greetings = clicks.mapTo('Hi');\n * greetings.subscribe(x => console.log(x));\n *\n * @see {@link map}\n *\n * @param {any} value The value to map each source value to.\n * @return {Observable} An Observable that emits the given `value` every time\n * the source Observable emits something.\n * @method mapTo\n * @owner Observable\n */\nexport function mapTo<T, R>(value: R): OperatorFunction<T, R> {\n return (source: Observable<T>) => source.lift(new MapToOperator(value));\n}\n\nclass MapToOperator<T, R> implements Operator<T, R> {\n\n value: R;\n\n constructor(value: R) {\n this.value = value;\n }\n\n call(subscriber: Subscriber<R>, source: any): any {\n return source.subscribe(new MapToSubscriber(subscriber, this.value));\n }\n}\n\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nclass MapToSubscriber<T, R> extends Subscriber<T> {\n\n value: R;\n\n constructor(destination: Subscriber<R>, value: R) {\n super(destination);\n this.value = value;\n }\n\n protected _next(x: T) {\n this.destination.next(this.value);\n }\n}"]}