Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

every.js 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /** PURE_IMPORTS_START tslib,_Subscriber PURE_IMPORTS_END */
  2. import * as tslib_1 from "tslib";
  3. import { Subscriber } from '../Subscriber';
  4. export function every(predicate, thisArg) {
  5. return function (source) { return source.lift(new EveryOperator(predicate, thisArg, source)); };
  6. }
  7. var EveryOperator = /*@__PURE__*/ (function () {
  8. function EveryOperator(predicate, thisArg, source) {
  9. this.predicate = predicate;
  10. this.thisArg = thisArg;
  11. this.source = source;
  12. }
  13. EveryOperator.prototype.call = function (observer, source) {
  14. return source.subscribe(new EverySubscriber(observer, this.predicate, this.thisArg, this.source));
  15. };
  16. return EveryOperator;
  17. }());
  18. var EverySubscriber = /*@__PURE__*/ (function (_super) {
  19. tslib_1.__extends(EverySubscriber, _super);
  20. function EverySubscriber(destination, predicate, thisArg, source) {
  21. var _this = _super.call(this, destination) || this;
  22. _this.predicate = predicate;
  23. _this.thisArg = thisArg;
  24. _this.source = source;
  25. _this.index = 0;
  26. _this.thisArg = thisArg || _this;
  27. return _this;
  28. }
  29. EverySubscriber.prototype.notifyComplete = function (everyValueMatch) {
  30. this.destination.next(everyValueMatch);
  31. this.destination.complete();
  32. };
  33. EverySubscriber.prototype._next = function (value) {
  34. var result = false;
  35. try {
  36. result = this.predicate.call(this.thisArg, value, this.index++, this.source);
  37. }
  38. catch (err) {
  39. this.destination.error(err);
  40. return;
  41. }
  42. if (!result) {
  43. this.notifyComplete(false);
  44. }
  45. };
  46. EverySubscriber.prototype._complete = function () {
  47. this.notifyComplete(true);
  48. };
  49. return EverySubscriber;
  50. }(Subscriber));
  51. //# sourceMappingURL=every.js.map