Skip to content

Implement AsyncIterator Helpers#2366

Merged
lahma merged 1 commit into
sebastienros:mainfrom
lahma:compat-table
Mar 26, 2026
Merged

Implement AsyncIterator Helpers#2366
lahma merged 1 commit into
sebastienros:mainfrom
lahma:compat-table

Conversation

@lahma

@lahma lahma commented Mar 26, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add AsyncIterator as a global constructor with from() static method for wrapping async/sync iterables
  • Implement prototype helper methods returning async iterators: map, filter, take, drop, flatMap
  • Implement prototype reducing methods returning promises: reduce, toArray, forEach, some, every, find
  • Add Symbol.toStringTag returning "AsyncIterator"
  • Add WrapForValidAsyncIterator for non-instanceof wrapping

Mirrors the existing sync Iterator Helpers architecture with promise-based chaining via PerformPromiseThen for all async operations.

Test plan

  • Full test262 suite: 95,985 passed, 0 failures (+4 new passing from AsyncIterator)
  • Compat-table esnext: 34/43 (was 17, +17 — all 16 AsyncIterator Helper tests pass)
  • No regressions in ES5, ES6, ES2016+, esintl suites

🤖 Generated with Claude Code

Add AsyncIterator as a global constructor with:
- AsyncIterator.from() static method for wrapping async/sync iterables
- Prototype helper methods: map, filter, take, drop, flatMap
- Prototype reducing methods: reduce, toArray, forEach, some, every, find
- Symbol.toStringTag returning "AsyncIterator"
- WrapForValidAsyncIterator for non-instanceof wrapping

Mirrors the existing sync Iterator Helpers architecture with promise-based
chaining via PerformPromiseThen for all async operations.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@lahma
lahma merged commit 1a449f3 into sebastienros:main Mar 26, 2026
4 checks passed
@lahma
lahma deleted the compat-table branch March 26, 2026 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant