This repository has been archived on 2024-07-27. You can view files and clone it, but cannot push or open issues or pull requests.
keksAccountGUI/node_modulesOLD/rxjs/_esm2015/internal/util/subscribeToIterable.js

24 lines
693 B
JavaScript
Raw Permalink Normal View History

2019-08-11 18:48:02 +00:00
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