Giant blob of minor changes
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / rxjs / _esm2015 / internal / operators / repeat.js
1 import { Subscriber } from '../Subscriber';
2 import { empty } from '../observable/empty';
3 export function repeat(count = -1) {
4     return (source) => {
5         if (count === 0) {
6             return empty();
7         }
8         else if (count < 0) {
9             return source.lift(new RepeatOperator(-1, source));
10         }
11         else {
12             return source.lift(new RepeatOperator(count - 1, source));
13         }
14     };
15 }
16 class RepeatOperator {
17     constructor(count, source) {
18         this.count = count;
19         this.source = source;
20     }
21     call(subscriber, source) {
22         return source.subscribe(new RepeatSubscriber(subscriber, this.count, this.source));
23     }
24 }
25 class RepeatSubscriber extends Subscriber {
26     constructor(destination, count, source) {
27         super(destination);
28         this.count = count;
29         this.source = source;
30     }
31     complete() {
32         if (!this.isStopped) {
33             const { source, count } = this;
34             if (count === 0) {
35                 return super.complete();
36             }
37             else if (count > -1) {
38                 this.count = count - 1;
39             }
40             source.subscribe(this._unsubscribeAndRecycle());
41         }
42     }
43 }
44 //# sourceMappingURL=repeat.js.map