1 import { Subscriber } from '../Subscriber';
2 export function map(project, thisArg) {
3 return function mapOperation(source) {
4 if (typeof project !== 'function') {
5 throw new TypeError('argument is not a function. Are you looking for `mapTo()`?');
7 return source.lift(new MapOperator(project, thisArg));
10 export class MapOperator {
11 constructor(project, thisArg) {
12 this.project = project;
13 this.thisArg = thisArg;
15 call(subscriber, source) {
16 return source.subscribe(new MapSubscriber(subscriber, this.project, this.thisArg));
19 class MapSubscriber extends Subscriber {
20 constructor(destination, project, thisArg) {
22 this.project = project;
24 this.thisArg = thisArg || this;
29 result = this.project.call(this.thisArg, value, this.count++);
32 this.destination.error(err);
35 this.destination.next(result);
38 //# sourceMappingURL=map.js.map