1 /** PURE_IMPORTS_START tslib,_Subscriber PURE_IMPORTS_END */
2 import * as tslib_1 from "tslib";
3 import { Subscriber } from '../Subscriber';
4 export 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()`?');
9 return source.lift(new MapOperator(project, thisArg));
12 var MapOperator = /*@__PURE__*/ (function () {
13 function MapOperator(project, thisArg) {
14 this.project = project;
15 this.thisArg = thisArg;
17 MapOperator.prototype.call = function (subscriber, source) {
18 return source.subscribe(new MapSubscriber(subscriber, this.project, this.thisArg));
22 export { MapOperator };
23 var 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;
29 _this.thisArg = thisArg || _this;
32 MapSubscriber.prototype._next = function (value) {
35 result = this.project.call(this.thisArg, value, this.count++);
38 this.destination.error(err);
41 this.destination.next(result);
45 //# sourceMappingURL=map.js.map