isEmpty.js 768 B

12345678910111213141516171819202122232425262728293031
  1. import { Subscriber } from '../Subscriber';
  2. export function isEmpty() {
  3. return (source) => source.lift(new IsEmptyOperator());
  4. }
  5. class IsEmptyOperator {
  6. call(observer, source) {
  7. return source.subscribe(new IsEmptySubscriber(observer));
  8. }
  9. }
  10. /**
  11. * We need this JSDoc comment for affecting ESDoc.
  12. * @ignore
  13. * @extends {Ignored}
  14. */
  15. class IsEmptySubscriber extends Subscriber {
  16. constructor(destination) {
  17. super(destination);
  18. }
  19. notifyComplete(isEmpty) {
  20. const destination = this.destination;
  21. destination.next(isEmpty);
  22. destination.complete();
  23. }
  24. _next(value) {
  25. this.notifyComplete(false);
  26. }
  27. _complete() {
  28. this.notifyComplete(true);
  29. }
  30. }
  31. //# sourceMappingURL=isEmpty.js.map