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