1 import { Observable } from '../Observable';
2 import { Subscription } from '../Subscription';
3 export function pairs(obj, scheduler) {
5 return new Observable(subscriber => {
6 const keys = Object.keys(obj);
7 for (let i = 0; i < keys.length && !subscriber.closed; i++) {
9 if (obj.hasOwnProperty(key)) {
10 subscriber.next([key, obj[key]]);
13 subscriber.complete();
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 }));
25 export 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 }));
34 subscriber.complete();
38 //# sourceMappingURL=pairs.js.map