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 777B

1234567891011121314151617181920212223242526
  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 = iterator.next();
  8. if (item.done) {
  9. subscriber.complete();
  10. break;
  11. }
  12. subscriber.next(item.value);
  13. if (subscriber.closed) {
  14. break;
  15. }
  16. } while (true);
  17. if (typeof iterator.return === 'function') {
  18. subscriber.add(function () {
  19. if (iterator.return) {
  20. iterator.return();
  21. }
  22. });
  23. }
  24. return subscriber;
  25. }; };
  26. //# sourceMappingURL=subscribeToIterable.js.map