* Create the readable async iterable from a queue.
(queue)
| 640 | * Create the readable async iterable from a queue. |
| 641 | */ |
| 642 | function createReadable(queue) { |
| 643 | var _a; |
| 644 | return _a = {}, |
| 645 | _a[Symbol.asyncIterator] = function () { |
| 646 | return { |
| 647 | next: function () { |
| 648 | return __awaiter(this, void 0, void 0, function () { |
| 649 | return __generator(this, function (_a) { |
| 650 | return [2 /*return*/, queue.read()]; |
| 651 | }); |
| 652 | }); |
| 653 | }, |
| 654 | return: function () { |
| 655 | return __awaiter(this, void 0, void 0, function () { |
| 656 | return __generator(this, function (_a) { |
| 657 | queue.consumerReturn(); |
| 658 | return [2 /*return*/, { value: undefined, done: true }]; |
| 659 | }); |
| 660 | }); |
| 661 | }, |
| 662 | throw: function (error) { |
| 663 | return __awaiter(this, void 0, void 0, function () { |
| 664 | return __generator(this, function (_a) { |
| 665 | queue.consumerThrow(error); |
| 666 | return [2 /*return*/, { value: undefined, done: true }]; |
| 667 | }); |
| 668 | }); |
| 669 | }, |
| 670 | }; |
| 671 | }, |
| 672 | _a; |
| 673 | } |
| 674 | // ============================================================================= |
| 675 | // Stream.push() Factory |
| 676 | // ============================================================================= |
no test coverage detected