Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

subscribeToIterable.js 1.0KB

12345678910111213141516171819202122232425262728293031323334
  1. /** PURE_IMPORTS_START _symbol_iterator PURE_IMPORTS_END */
  2. import { iterator as Symbol_iterator } from '../symbol/iterator';
  3. export var subscribeToIterable = function (iterable) {
  4. return function (subscriber) {
  5. var iterator = iterable[Symbol_iterator]();
  6. do {
  7. var item = void 0;
  8. try {
  9. item = iterator.next();
  10. }
  11. catch (err) {
  12. subscriber.error(err);
  13. return subscriber;
  14. }
  15. if (item.done) {
  16. subscriber.complete();
  17. break;
  18. }
  19. subscriber.next(item.value);
  20. if (subscriber.closed) {
  21. break;
  22. }
  23. } while (true);
  24. if (typeof iterator.return === 'function') {
  25. subscriber.add(function () {
  26. if (iterator.return) {
  27. iterator.return();
  28. }
  29. });
  30. }
  31. return subscriber;
  32. };
  33. };
  34. //# sourceMappingURL=subscribeToIterable.js.map