mirror of
https://github.com/JamesIves/github-pages-deploy-action.git
synced 2023-12-15 20:03:39 +08:00
24 lines
693 B
JavaScript
24 lines
693 B
JavaScript
import { iterator as Symbol_iterator } from '../symbol/iterator';
|
|
export const subscribeToIterable = (iterable) => (subscriber) => {
|
|
const iterator = iterable[Symbol_iterator]();
|
|
do {
|
|
const item = iterator.next();
|
|
if (item.done) {
|
|
subscriber.complete();
|
|
break;
|
|
}
|
|
subscriber.next(item.value);
|
|
if (subscriber.closed) {
|
|
break;
|
|
}
|
|
} while (true);
|
|
if (typeof iterator.return === 'function') {
|
|
subscriber.add(() => {
|
|
if (iterator.return) {
|
|
iterator.return();
|
|
}
|
|
});
|
|
}
|
|
return subscriber;
|
|
};
|
|
//# sourceMappingURL=subscribeToIterable.js.map
|