source: trip-planner-front/node_modules/rxjs/internal/operators/map.js@ 1ad8e64

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

initial commit

  • Property mode set to 100644
File size: 2.1 KB
Line 
1"use strict";
2var __extends = (this && this.__extends) || (function () {
3 var extendStatics = function (d, b) {
4 extendStatics = Object.setPrototypeOf ||
5 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
7 return extendStatics(d, b);
8 }
9 return function (d, b) {
10 extendStatics(d, b);
11 function __() { this.constructor = d; }
12 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13 };
14})();
15Object.defineProperty(exports, "__esModule", { value: true });
16var Subscriber_1 = require("../Subscriber");
17function map(project, thisArg) {
18 return function mapOperation(source) {
19 if (typeof project !== 'function') {
20 throw new TypeError('argument is not a function. Are you looking for `mapTo()`?');
21 }
22 return source.lift(new MapOperator(project, thisArg));
23 };
24}
25exports.map = map;
26var MapOperator = (function () {
27 function MapOperator(project, thisArg) {
28 this.project = project;
29 this.thisArg = thisArg;
30 }
31 MapOperator.prototype.call = function (subscriber, source) {
32 return source.subscribe(new MapSubscriber(subscriber, this.project, this.thisArg));
33 };
34 return MapOperator;
35}());
36exports.MapOperator = MapOperator;
37var MapSubscriber = (function (_super) {
38 __extends(MapSubscriber, _super);
39 function MapSubscriber(destination, project, thisArg) {
40 var _this = _super.call(this, destination) || this;
41 _this.project = project;
42 _this.count = 0;
43 _this.thisArg = thisArg || _this;
44 return _this;
45 }
46 MapSubscriber.prototype._next = function (value) {
47 var result;
48 try {
49 result = this.project.call(this.thisArg, value, this.count++);
50 }
51 catch (err) {
52 this.destination.error(err);
53 return;
54 }
55 this.destination.next(result);
56 };
57 return MapSubscriber;
58}(Subscriber_1.Subscriber));
59//# sourceMappingURL=map.js.map
Note: See TracBrowser for help on using the repository browser.