Giant blob of minor changes
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / rxjs / _esm2015 / internal / observable / range.js
1 import { Observable } from '../Observable';
2 export function range(start = 0, count, scheduler) {
3     return new Observable(subscriber => {
4         if (count === undefined) {
5             count = start;
6             start = 0;
7         }
8         let index = 0;
9         let current = start;
10         if (scheduler) {
11             return scheduler.schedule(dispatch, 0, {
12                 index, count, start, subscriber
13             });
14         }
15         else {
16             do {
17                 if (index++ >= count) {
18                     subscriber.complete();
19                     break;
20                 }
21                 subscriber.next(current++);
22                 if (subscriber.closed) {
23                     break;
24                 }
25             } while (true);
26         }
27         return undefined;
28     });
29 }
30 export function dispatch(state) {
31     const { start, index, count, subscriber } = state;
32     if (index >= count) {
33         subscriber.complete();
34         return;
35     }
36     subscriber.next(start);
37     if (subscriber.closed) {
38         return;
39     }
40     state.index = index + 1;
41     state.start = start + 1;
42     this.schedule(state);
43 }
44 //# sourceMappingURL=range.js.map