source: trip-planner-front/node_modules/rxjs/_esm5/internal/operators/map.js

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.5 KB
Line 
1/** PURE_IMPORTS_START tslib,_Subscriber PURE_IMPORTS_END */
2import * as tslib_1 from "tslib";
3import { Subscriber } from '../Subscriber';
4export function map(project, thisArg) {
5 return function mapOperation(source) {
6 if (typeof project !== 'function') {
7 throw new TypeError('argument is not a function. Are you looking for `mapTo()`?');
8 }
9 return source.lift(new MapOperator(project, thisArg));
10 };
11}
12var MapOperator = /*@__PURE__*/ (function () {
13 function MapOperator(project, thisArg) {
14 this.project = project;
15 this.thisArg = thisArg;
16 }
17 MapOperator.prototype.call = function (subscriber, source) {
18 return source.subscribe(new MapSubscriber(subscriber, this.project, this.thisArg));
19 };
20 return MapOperator;
21}());
22export { MapOperator };
23var MapSubscriber = /*@__PURE__*/ (function (_super) {
24 tslib_1.__extends(MapSubscriber, _super);
25 function MapSubscriber(destination, project, thisArg) {
26 var _this = _super.call(this, destination) || this;
27 _this.project = project;
28 _this.count = 0;
29 _this.thisArg = thisArg || _this;
30 return _this;
31 }
32 MapSubscriber.prototype._next = function (value) {
33 var result;
34 try {
35 result = this.project.call(this.thisArg, value, this.count++);
36 }
37 catch (err) {
38 this.destination.error(err);
39 return;
40 }
41 this.destination.next(result);
42 };
43 return MapSubscriber;
44}(Subscriber));
45//# sourceMappingURL=map.js.map
Note: See TracBrowser for help on using the repository browser.