2 var __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);
9 return function (d, b) {
11 function __() { this.constructor = d; }
12 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15 Object.defineProperty(exports, "__esModule", { value: true });
16 var Subscriber_1 = require("../Subscriber");
17 function 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()`?');
22 return source.lift(new MapOperator(project, thisArg));
26 var MapOperator = (function () {
27 function MapOperator(project, thisArg) {
28 this.project = project;
29 this.thisArg = thisArg;
31 MapOperator.prototype.call = function (subscriber, source) {
32 return source.subscribe(new MapSubscriber(subscriber, this.project, this.thisArg));
36 exports.MapOperator = MapOperator;
37 var 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;
43 _this.thisArg = thisArg || _this;
46 MapSubscriber.prototype._next = function (value) {
49 result = this.project.call(this.thisArg, value, this.count++);
52 this.destination.error(err);
55 this.destination.next(result);
58 }(Subscriber_1.Subscriber));
59 //# sourceMappingURL=map.js.map