Iterator Helpers Update
July 2022 · 91st meeting of TC39
Michael Ficarra & Kevin Gibbons
Proposal Summary
https://github.com/tc39/proposal-iterator-helpers
Proposal Summary
Proposal Summary
Resolutions
throw RangeError in take/drop when input is NaN-ish
https://github.com/tc39/proposal-iterator-helpers/pull/181
don't preserve the generator protocol
https://github.com/tc39/proposal-iterator-helpers/pull/194
Iterator helpers can't coherently preserve the generator protocol, so they shouldn't try.
AsyncIterator.from uses the PromiseResolve AO
https://github.com/tc39/proposal-iterator-helpers/pull/197
AsyncIterator#toArray does not await promises
https://github.com/tc39/proposal-iterator-helpers/issues/168
matches for-await-of and Array.fromAsync proposal
Open Questions
or issues
Iterator.prototype.flat?
Iterator.prototype.toAsync?
AsyncIterator.from(iter) works, but is kind of annoying in a chain
arr.values()
.map(foo)
.toAsync()
.filter(async x => await bar(x))
https://github.com/tc39/proposal-iterator-helpers/pull/202
AsyncIterator.from(
arr.values()
.map(foo)
)
.filter(async x => await bar(x))
Should .drop be eager?
web compat: writability of toStringTag on Iterator.prototype
https://github.com/tc39/proposal-iterator-helpers/issues/115
reachability of new intrinisics from the global
https://github.com/tc39/proposal-iterator-helpers/issues/173
Future Work
THESE ARE NOT PART OF THIS PROPOSAL
More helpers
Cleanup
https://github.com/tc39/proposal-iterator-helpers/issues/162
https://github.com/tc39/proposal-iterator-helpers/issues/164
function idsToUser(idIter) {
let dbHandle = getDbHandle();
return idIter.map(i => dbHandle.getId(i));
// how to close dbHandle when this iterator is closed?
}
Call for Stage 2 Reviewers!