wishthis/node_modules/rxjs/internal/util/subscribeToIterable.js
2022-05-29 11:24:36 +02:00

33 lines
No EOL
926 B
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var iterator_1 = require("../symbol/iterator");
exports.subscribeToIterable = function (iterable) { return function (subscriber) {
var iterator = iterable[iterator_1.iterator]();
do {
var item = void 0;
try {
item = iterator.next();
}
catch (err) {
subscriber.error(err);
return subscriber;
}
if (item.done) {
subscriber.complete();
break;
}
subscriber.next(item.value);
if (subscriber.closed) {
break;
}
} while (true);
if (typeof iterator.return === 'function') {
subscriber.add(function () {
if (iterator.return) {
iterator.return();
}
});
}
return subscriber;
}; };
//# sourceMappingURL=subscribeToIterable.js.map