source: trip-planner-front/node_modules/rxjs/_esm2015/internal/observable/pairs.js@ ceaed42

Last change on this file since ceaed42 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.3 KB
Line 
1import { Observable } from '../Observable';
2import { Subscription } from '../Subscription';
3export function pairs(obj, scheduler) {
4 if (!scheduler) {
5 return new Observable(subscriber => {
6 const keys = Object.keys(obj);
7 for (let i = 0; i < keys.length && !subscriber.closed; i++) {
8 const key = keys[i];
9 if (obj.hasOwnProperty(key)) {
10 subscriber.next([key, obj[key]]);
11 }
12 }
13 subscriber.complete();
14 });
15 }
16 else {
17 return new Observable(subscriber => {
18 const keys = Object.keys(obj);
19 const subscription = new Subscription();
20 subscription.add(scheduler.schedule(dispatch, 0, { keys, index: 0, subscriber, subscription, obj }));
21 return subscription;
22 });
23 }
24}
25export function dispatch(state) {
26 const { keys, index, subscriber, subscription, obj } = state;
27 if (!subscriber.closed) {
28 if (index < keys.length) {
29 const key = keys[index];
30 subscriber.next([key, obj[key]]);
31 subscription.add(this.schedule({ keys, index: index + 1, subscriber, subscription, obj }));
32 }
33 else {
34 subscriber.complete();
35 }
36 }
37}
38//# sourceMappingURL=pairs.js.map
Note: See TracBrowser for help on using the repository browser.