1 /** PURE_IMPORTS_START tslib,_Subscriber PURE_IMPORTS_END */
2 import * as tslib_1 from "tslib";
3 import { Subscriber } from '../Subscriber';
4 export function filter(predicate, thisArg) {
5 return function filterOperatorFunction(source) {
6 return source.lift(new FilterOperator(predicate, thisArg));
9 var FilterOperator = /*@__PURE__*/ (function () {
10 function FilterOperator(predicate, thisArg) {
11 this.predicate = predicate;
12 this.thisArg = thisArg;
14 FilterOperator.prototype.call = function (subscriber, source) {
15 return source.subscribe(new FilterSubscriber(subscriber, this.predicate, this.thisArg));
17 return FilterOperator;
19 var FilterSubscriber = /*@__PURE__*/ (function (_super) {
20 tslib_1.__extends(FilterSubscriber, _super);
21 function FilterSubscriber(destination, predicate, thisArg) {
22 var _this = _super.call(this, destination) || this;
23 _this.predicate = predicate;
24 _this.thisArg = thisArg;
28 FilterSubscriber.prototype._next = function (value) {
31 result = this.predicate.call(this.thisArg, value, this.count++);
34 this.destination.error(err);
38 this.destination.next(value);
41 return FilterSubscriber;
43 //# sourceMappingURL=filter.js.map