mirror of
https://github.com/JamesIves/github-pages-deploy-action.git
synced 2023-12-15 20:03:39 +08:00
40 lines
1.5 KiB
JavaScript
40 lines
1.5 KiB
JavaScript
|
/** PURE_IMPORTS_START _Observable,_Subscription PURE_IMPORTS_END */
|
||
|
import { Observable } from '../Observable';
|
||
|
import { Subscription } from '../Subscription';
|
||
|
export function pairs(obj, scheduler) {
|
||
|
if (!scheduler) {
|
||
|
return new Observable(function (subscriber) {
|
||
|
var keys = Object.keys(obj);
|
||
|
for (var i = 0; i < keys.length && !subscriber.closed; i++) {
|
||
|
var key = keys[i];
|
||
|
if (obj.hasOwnProperty(key)) {
|
||
|
subscriber.next([key, obj[key]]);
|
||
|
}
|
||
|
}
|
||
|
subscriber.complete();
|
||
|
});
|
||
|
}
|
||
|
else {
|
||
|
return new Observable(function (subscriber) {
|
||
|
var keys = Object.keys(obj);
|
||
|
var subscription = new Subscription();
|
||
|
subscription.add(scheduler.schedule(dispatch, 0, { keys: keys, index: 0, subscriber: subscriber, subscription: subscription, obj: obj }));
|
||
|
return subscription;
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
export function dispatch(state) {
|
||
|
var keys = state.keys, index = state.index, subscriber = state.subscriber, subscription = state.subscription, obj = state.obj;
|
||
|
if (!subscriber.closed) {
|
||
|
if (index < keys.length) {
|
||
|
var key = keys[index];
|
||
|
subscriber.next([key, obj[key]]);
|
||
|
subscription.add(this.schedule({ keys: keys, index: index + 1, subscriber: subscriber, subscription: subscription, obj: obj }));
|
||
|
}
|
||
|
else {
|
||
|
subscriber.complete();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
//# sourceMappingURL=pairs.js.map
|