Giant blob of minor changes
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / rxjs / _esm2015 / internal / operators / filter.js
1 import { Subscriber } from '../Subscriber';
2 export function filter(predicate, thisArg) {
3     return function filterOperatorFunction(source) {
4         return source.lift(new FilterOperator(predicate, thisArg));
5     };
6 }
7 class FilterOperator {
8     constructor(predicate, thisArg) {
9         this.predicate = predicate;
10         this.thisArg = thisArg;
11     }
12     call(subscriber, source) {
13         return source.subscribe(new FilterSubscriber(subscriber, this.predicate, this.thisArg));
14     }
15 }
16 class FilterSubscriber extends Subscriber {
17     constructor(destination, predicate, thisArg) {
18         super(destination);
19         this.predicate = predicate;
20         this.thisArg = thisArg;
21         this.count = 0;
22     }
23     _next(value) {
24         let result;
25         try {
26             result = this.predicate.call(this.thisArg, value, this.count++);
27         }
28         catch (err) {
29             this.destination.error(err);
30             return;
31         }
32         if (result) {
33             this.destination.next(value);
34         }
35     }
36 }
37 //# sourceMappingURL=filter.js.map