if (done) { readable.push(null); return; } if (value && typeof value.then === 'function') { return changeToAsyncValues(value); } if (value === null) { reading = false; throw new ERR_STREAM_NULL_VALUES(); } if (readable.push(value)) { continue; } reading = false; } catch (err) { readable.destroy(err); } break; } } async function changeToAsyncValues(value) { isAsyncValues = true; try { const res = await value; if (res === null) { reading = false; throw new ERR_STREAM_NULL_VALUES(); } if (readable.push(res)) { nextSyncWithAsyncValues(); return; } reading = false; } catch (err) { readable.destroy(err); } } async function nextSyncWithAsyncValues() { for (;;) { try { const { value, done } = iterator.next(); if (done) { readable.push(null); return; } const res = (value && typeof value.then === 'function') ? await value : value; if (res === null) { reading = false; throw new ERR_STREAM_NULL_VALUES(); } if (readable.push(res)) { continue; } reading = false; } catch (err) { readable.destroy(err); } break; } } async function nextAsync() { for (;;) { try { const { value, done } = await iterator.next(); if (done) { readable.push(null); return; } if (value === null) { reading = false; throw new ERR_STREAM_NULL_VALUES(); } if (readable.push(value)) { continue; } reading = false; } catch (err) { readable.destroy(err); } break; } } return readable; } module.exports = from;