| /** PURE_IMPORTS_START tslib,_Subscriber PURE_IMPORTS_END */ |
| import * as tslib_1 from "tslib"; |
| import { Subscriber } from '../Subscriber'; |
| export function filter(predicate, thisArg) { |
| return function filterOperatorFunction(source) { |
| return source.lift(new FilterOperator(predicate, thisArg)); |
| }; |
| } |
| var FilterOperator = /*@__PURE__*/ (function () { |
| function FilterOperator(predicate, thisArg) { |
| this.predicate = predicate; |
| this.thisArg = thisArg; |
| } |
| FilterOperator.prototype.call = function (subscriber, source) { |
| return source.subscribe(new FilterSubscriber(subscriber, this.predicate, this.thisArg)); |
| }; |
| return FilterOperator; |
| }()); |
| var FilterSubscriber = /*@__PURE__*/ (function (_super) { |
| tslib_1.__extends(FilterSubscriber, _super); |
| function FilterSubscriber(destination, predicate, thisArg) { |
| var _this = _super.call(this, destination) || this; |
| _this.predicate = predicate; |
| _this.thisArg = thisArg; |
| _this.count = 0; |
| return _this; |
| } |
| FilterSubscriber.prototype._next = function (value) { |
| var result; |
| try { |
| result = this.predicate.call(this.thisArg, value, this.count++); |
| } |
| catch (err) { |
| this.destination.error(err); |
| return; |
| } |
| if (result) { |
| this.destination.next(value); |
| } |
| }; |
| return FilterSubscriber; |
| }(Subscriber)); |
| //# sourceMappingURL=filter.js.map |