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

subscribeToIterable.js 926B

123456789101112131415161718192021222324252627282930313233
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. var iterator_1 = require("../symbol/iterator");
  4. exports.subscribeToIterable = function (iterable) { return function (subscriber) {
  5. var iterator = iterable[iterator_1.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. //# sourceMappingURL=subscribeToIterable.js.map