1 import { Subscriber } from '../Subscriber';
2 export function count(predicate) {
3 return (source) => source.lift(new CountOperator(predicate, source));
6 constructor(predicate, source) {
7 this.predicate = predicate;
10 call(subscriber, source) {
11 return source.subscribe(new CountSubscriber(subscriber, this.predicate, this.source));
14 class CountSubscriber extends Subscriber {
15 constructor(destination, predicate, source) {
17 this.predicate = predicate;
24 this._tryPredicate(value);
30 _tryPredicate(value) {
33 result = this.predicate(value, this.index++, this.source);
36 this.destination.error(err);
44 this.destination.next(this.count);
45 this.destination.complete();
48 //# sourceMappingURL=count.js.map