UNPKG
pull-awaitable
Version:
latest (1.0.0)
1.0.0
Convert a pull-stream to an Async Iterable
github.com/staltz/pull-awaitable
staltz/pull-awaitable
pull-awaitable
/
index.js
13 lines
(11 loc)
•
251 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
const
thenable =
require
(
'pull-thenable'
);
module
.
exports
=
async
function
*
awaitable
(
readable
) {
while
(
true
) {
try
{
yield
await
thenable
(readable); }
catch
(err) {
if
(err ===
true
)
return
;
else
throw
err; } } };