Last change
on this file since 6a80231 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
926 bytes
|
Rev | Line | |
---|
[6a3a178] | 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 |
---|
Note:
See
TracBrowser
for help on using the repository browser.