Repository navigation
util: use Map.prototype.getOrInsert() in circular reference formatting - #67451
Merged
nodejs-github-bot merged 1 commit intoNov 15, 2026
Merged
Conversation
Signed-off-by: LiviaMedeiros <livia@cirno.name>
ljharb
approved these changes
Nov 13, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #67451 +/- ##
========================================
Coverage 90.71% 90.72%
========================================
Files 801 802 +1
Lines 281889 282100 +211
Branches 54315 54352 +37
========================================
+ Hits 255709 255925 +216
- Misses 16307 16312 +5
+ Partials 9873 9863 -10
🚀 New features to boost your workflow:
|
Collaborator
bjohansebas
approved these changes
Nov 13, 2026
Collaborator
Renegade334
reviewed
Nov 14, 2026
Member
There was a problem hiding this comment.
I'm fairly sure this won't work on v26.x. Even if enabled, flagged features are not present during the bootstrapping phase when primordials.js is executed, so these methods never get copied onto SafeMap.prototype.
> process.version
'v26.13.1'
> Map.prototype.getOrInsert
[Function: getOrInsert]
> const { SafeMap } = require('internal/test/binding').primordials
> SafeMap.prototype.getOrInsert
undefined
> new SafeMap().getOrInsert('key', 'value')
Uncaught TypeError: (intermediate value).getOrInsert is not a function
Member
|
(upsert was unflagged in v8/v8@d9740b5, so this should be OK to land on v27.x. I've removed from commit-queue in the meantime to allow for the comment to be seen!) |
Member
Author
|
@Renegade334 thanks for the catch! Added |
Renegade334
approved these changes
Nov 15, 2026
Collaborator
|
Landed in b0aa887 |
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.
Minor refactoring. Native upsert is available starting from
v26.x.