Skip to content

Update Map.json: getOrInsert, getOrInsertComputed for NodeJS 26#29618

Closed
ajvincent wants to merge 2 commits into
mdn:mainfrom
ajvincent:patch-1
Closed

Update Map.json: getOrInsert, getOrInsertComputed for NodeJS 26#29618
ajvincent wants to merge 2 commits into
mdn:mainfrom
ajvincent:patch-1

Conversation

@ajvincent
Copy link
Copy Markdown

Summary

NodeJS 26 now supports Map.prototype.getOrInsert() and Map.prototype.getOrInsertComputed().

Test results and supporting details

[ajvincent@fedora ~]$ nvm install 26
Downloading and installing node v26.0.0...
Downloading https://nodejs.org/dist/v26.0.0/node-v26.0.0-linux-x64.tar.xz...
######################################################################### 100.0%
Computing checksum with sha256sum
Checksums matched!
Now using node v26.0.0 (npm v11.12.1)
[ajvincent@fedora ~]$ node
Welcome to Node.js v26.0.0.
Type ".help" for more information.
> typeof Map.prototype.getOrInsert
'function'
> typeof Map.prototype.getOrInsertComputed
'function'
> const A = new Map
undefined
> A.set(1, "one")
Map(1) { 1 => 'one' }
> A.getOrInsert(1, "ONE")
'one'
> A.getOrInsert(2, "two")
'two'
> A.getOrInsert(2, "two")
'two'
> A.get(2)
'two'
> A.values()
[Map Iterator] { 'one', 'two' }
> A.getOrInsertComputed(3, "three")
Uncaught TypeError: Map.prototype.getOrInsertComputed is not a function
    at Map.getOrInsertComputed (<anonymous>)
> A.getOrInsertComputed(3, () => "three")
'three'
> A.values()
[Map Iterator] { 'one', 'two', 'three' }
> A.entries()
[Map Entries] { [ 1, 'one' ], [ 2, 'two' ], [ 3, 'three' ] }

NodeJS v26.0.0 release notes, specifically about v8

Related issues

@github-actions github-actions Bot added the data:js Compat data for JS/ECMAScript features. https://developer.mozilla.org/docs/Web/JavaScript label May 6, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 2026

Tip: Review these changes grouped by change (recommended for most PRs), or grouped by feature (for large PRs).

@github-actions github-actions Bot added the size:s [PR only] 7-24 LoC changed label May 6, 2026
@ajvincent
Copy link
Copy Markdown
Author

Closing: this PR is covered by #29619

@ajvincent ajvincent closed this May 7, 2026
@ajvincent ajvincent deleted the patch-1 branch May 7, 2026 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

data:js Compat data for JS/ECMAScript features. https://developer.mozilla.org/docs/Web/JavaScript size:s [PR only] 7-24 LoC changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant