Giant blob of minor changes
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / rxjs / _esm2015 / internal / operators / defaultIfEmpty.js
1 import { Subscriber } from '../Subscriber';
2 export function defaultIfEmpty(defaultValue = null) {
3     return (source) => source.lift(new DefaultIfEmptyOperator(defaultValue));
4 }
5 class DefaultIfEmptyOperator {
6     constructor(defaultValue) {
7         this.defaultValue = defaultValue;
8     }
9     call(subscriber, source) {
10         return source.subscribe(new DefaultIfEmptySubscriber(subscriber, this.defaultValue));
11     }
12 }
13 class DefaultIfEmptySubscriber extends Subscriber {
14     constructor(destination, defaultValue) {
15         super(destination);
16         this.defaultValue = defaultValue;
17         this.isEmpty = true;
18     }
19     _next(value) {
20         this.isEmpty = false;
21         this.destination.next(value);
22     }
23     _complete() {
24         if (this.isEmpty) {
25             this.destination.next(this.defaultValue);
26         }
27         this.destination.complete();
28     }
29 }
30 //# sourceMappingURL=defaultIfEmpty.js.map