| 1 |
import { __asyncGenerator, __await } from "tslib"; |
| 2 |
import { isFunction } from './isFunction'; |
| 3 |
export function readableStreamLikeToAsyncGenerator(readableStream) { |
| 4 |
return __asyncGenerator(this, arguments, function* readableStreamLikeToAsyncGenerator_1() { |
| 5 |
const reader = readableStream.getReader(); |
| 6 |
try { |
| 7 |
while (true) { |
| 8 |
const { value, done } = yield __await(reader.read()); |
| 9 |
if (done) { |
| 10 |
return yield __await(void 0); |
| 11 |
} |
| 12 |
yield yield __await(value); |
| 13 |
} |
| 14 |
} |
| 15 |
finally { |
| 16 |
reader.releaseLock(); |
| 17 |
} |
| 18 |
}); |
| 19 |
} |
| 20 |
export function isReadableStreamLike(obj) { |
| 21 |
return isFunction(obj === null || obj === void 0 ? void 0 : obj.getReader); |
| 22 |
} |
| 23 |
//# sourceMappingURL=isReadableStreamLike.js.map |