123456789101112131415161718192021222324252627282930313233343536373839 |
- import { __asyncGenerator, __await, __generator } from "tslib";
- import { isFunction } from './isFunction';
- export function readableStreamLikeToAsyncGenerator(readableStream) {
- return __asyncGenerator(this, arguments, function readableStreamLikeToAsyncGenerator_1() {
- var reader, _a, value, done;
- return __generator(this, function (_b) {
- switch (_b.label) {
- case 0:
- reader = readableStream.getReader();
- _b.label = 1;
- case 1:
- _b.trys.push([1, , 9, 10]);
- _b.label = 2;
- case 2:
- if (!true) return [3, 8];
- return [4, __await(reader.read())];
- case 3:
- _a = _b.sent(), value = _a.value, done = _a.done;
- if (!done) return [3, 5];
- return [4, __await(void 0)];
- case 4: return [2, _b.sent()];
- case 5: return [4, __await(value)];
- case 6: return [4, _b.sent()];
- case 7:
- _b.sent();
- return [3, 2];
- case 8: return [3, 10];
- case 9:
- reader.releaseLock();
- return [7];
- case 10: return [2];
- }
- });
- });
- }
- export function isReadableStreamLike(obj) {
- return isFunction(obj === null || obj === void 0 ? void 0 : obj.getReader);
- }
- //# sourceMappingURL=isReadableStreamLike.js.map
|