update Iterator.prototype.{take,drop} for new RangeError#5065
Open
michaelficarra wants to merge 1 commit into
Open
update Iterator.prototype.{take,drop} for new RangeError#5065michaelficarra wants to merge 1 commit into
michaelficarra wants to merge 1 commit into
Conversation
michaelficarra
force-pushed
the
iterator-counter-numbers
branch
from
May 28, 2026 03:08
469477b to
4038d43
Compare
linusg
approved these changes
Jul 9, 2026
ljharb
approved these changes
Jul 9, 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.
bakkot
approved these changes
Jul 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.