Repository navigation
[Bug] objForEachKey fails if there is a throwing getter for the property #627 - #637
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Throwing getters cause object entries/values polyfills to diverge from native error propagation, while iterator callback types omit the possible undefined fallback, allowing unsafe consumers to type-check.
2 open issues
What changed in this PR
This PR addresses #627 by making the library’s object iterators continue when a property getter throws, passing undefined to the callback for that key.
Changes:
- Share tolerant string-key iteration logic and apply equivalent handling to symbol keys.
- Resolve callback
thisvalues once and add regression coverage for getter failures, early exit, and callback behavior. - Document the new behavior and its effect on
polyObjKeys.
| File | Description |
|---|---|
lib/test/src/common/polyfills/object.test.ts |
Tests polyObjKeys with a throwing getter. |
lib/test/src/common/object/forEachOwnKeySafe.test.ts |
Tests getter failures and callback context for string and symbol iteration. |
lib/test/src/common/object/for_each_key.test.ts |
Tests getter failures, early exit, callback exceptions, and context. |
lib/src/object/forEachOwnKey.ts |
Reuses string-key iteration and handles throwing symbol getters. |
lib/src/object/for_each_key.ts |
Adds shared tolerant iteration and documents the fallback. |
CHANGELOG.md |
Records the getter-handling fix and affected helpers. |
Review effort: Balanced
nev21
force-pushed
the
nev21/objForEachKey
branch
from
November 8, 2026 03:36
2dc187d to
ff02a05
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #637 +/- ##
==========================================
+ Coverage 99.19% 99.21% +0.02%
==========================================
Files 180 180
Lines 5573 5590 +17
Branches 1248 1295 +47
==========================================
+ Hits 5528 5546 +18
+ Misses 45 44 -1
🚀 New features to boost your workflow:
|
nev21
force-pushed
the
nev21/objForEachKey
branch
from
November 8, 2026 04:17
ff02a05 to
6e49da4
Compare
nevware21-bot
approved these changes
Nov 8, 2026
nevware21-bot
left a comment
Contributor
There was a problem hiding this comment.
Approved by nevware21-bot
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.

No description provided.