UNPKG

pull-awaitable

Version:

Convert a pull-stream to an Async Iterable

13 lines (11 loc) 251 B
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; } } };