Packages
A spellchecker for Elixir, made with Bun and cspell
Current section
Files
Jump to
Current section
Files
priv/bun/node_modules/@cspell/cspell-pipe/dist/helpers/iteratorToIterable.js
export function* iteratorToIterable(iterator) {
try {
let n;
while (!(n = iterator.next()).done) {
yield n.value;
}
}
catch (e) {
if (iterator.throw) {
return iterator.throw(e);
}
throw e;
}
finally {
// ensure that clean up happens.
iterator.return?.();
}
}
export async function* asyncIteratorToAsyncIterable(iterator) {
try {
let n;
while (!(n = await iterator.next()).done) {
yield n.value;
}
}
catch (e) {
if (iterator.throw) {
return iterator.throw(e);
}
throw e;
}
finally {
// ensure that clean up happens.
iterator.return?.();
}
}
//# sourceMappingURL=iteratorToIterable.js.map