Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

subscribeToIterable.js 693B

123456789101112131415161718192021222324
  1. import { iterator as Symbol_iterator } from '../symbol/iterator';
  2. export const subscribeToIterable = (iterable) => (subscriber) => {
  3. const iterator = iterable[Symbol_iterator]();
  4. do {
  5. const item = iterator.next();
  6. if (item.done) {
  7. subscriber.complete();
  8. break;
  9. }
  10. subscriber.next(item.value);
  11. if (subscriber.closed) {
  12. break;
  13. }
  14. } while (true);
  15. if (typeof iterator.return === 'function') {
  16. subscriber.add(() => {
  17. if (iterator.return) {
  18. iterator.return();
  19. }
  20. });
  21. }
  22. return subscriber;
  23. };
  24. //# sourceMappingURL=subscribeToIterable.js.map