Skip to content

update Iterator.prototype.{take,drop} for new RangeError#5065

Open
michaelficarra wants to merge 1 commit into
mainfrom
iterator-counter-numbers
Open

update Iterator.prototype.{take,drop} for new RangeError#5065
michaelficarra wants to merge 1 commit into
mainfrom
iterator-counter-numbers

Conversation

@michaelficarra

@michaelficarra michaelficarra commented May 28, 2026

Copy link
Copy Markdown
Member

tc39/ecma262#3776 updates these two methods to throw a RangeError during parameter evaluation for very large finite Number values.

While I was in there, I fixed up the metadata for each of the files I touched. If that's unwanted, I can revert it.

Disclaimer: I used AI in the process of creating this PR.

@michaelficarra
michaelficarra requested a review from a team as a code owner May 28, 2026 03:07
@michaelficarra michaelficarra added the has consensus This has committee consensus label May 28, 2026
ljharb added a commit to es-shims/iterator-helpers that referenced this pull request Jul 10, 2026
…angeError when `limit` is finite and > 2 ** 53 - 1

Per tc39/ecma262#3776 and tc39/test262#5065, `take`/`drop` now throw a
RangeError (closing the underlying iterator) when `limit` is a finite Number
greater than `2 ** 53 - 1`; `Number.MAX_SAFE_INTEGER` and `Infinity` remain
valid. The redundant `remaining !== Infinity` closure guard is dropped (the
amended spec decrements unconditionally, since `Infinity - 1` is `Infinity`),
and the polyfill feature-detect now requires this behavior.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

has consensus This has committee consensus needs review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants