Giant blob of minor changes
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / rxjs / _esm2015 / internal / operators / map.js
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()`?');
6         }
7         return source.lift(new MapOperator(project, thisArg));
8     };
9 }
10 export class MapOperator {
11     constructor(project, thisArg) {
12         this.project = project;
13         this.thisArg = thisArg;
14     }
15     call(subscriber, source) {
16         return source.subscribe(new MapSubscriber(subscriber, this.project, this.thisArg));
17     }
18 }
19 class MapSubscriber extends Subscriber {
20     constructor(destination, project, thisArg) {
21         super(destination);
22         this.project = project;
23         this.count = 0;
24         this.thisArg = thisArg || this;
25     }
26     _next(value) {
27         let result;
28         try {
29             result = this.project.call(this.thisArg, value, this.count++);
30         }
31         catch (err) {
32             this.destination.error(err);
33             return;
34         }
35         this.destination.next(result);
36     }
37 }
38 //# sourceMappingURL=map.js.map