Contact emails
ol...@google.com
Specification
https://github.com/tc39/proposal-upsert
Summary
ECMAScript proposal for Map.prototype.getOrInsert, Map.prototype.getOrInsertComputed, WeakMap.prototype.getOrInsert, and WeakMap.prototype.getOrInsertComputed.
Blink component
Blink>JavaScript>Language
Web Feature ID
getorinsert
Motivation
No information provided
Initial public proposal
No information provided
TAG review
No information provided
TAG review status
Not applicable
Risks
Interoperability and Compatibility
No information provided
Gecko: Shipped/Shipping (
https://www.firefox.com/en-US/firefox/144.0/releasenotes) Firefox now supports the upsert proposal. This adds getOrInsert and getOrInsertComputed methods to Map and WeakMap. These methods either return the value associated with a key, or insert a default value, and then return that value, simplifying handling of cases where it's not known if a key is already present in the Map or WeakMap.
WebKit: Shipped/Shipping (
https://developer.apple.com/documentation/safari-release-notes/safari-18_4-release-notes) Added support for Map.prototype.getOrInsert and WeakMap.prototype.getOrInsert. (138955824)
Web developers: No signals
Other signals:
WebView application risks
Does this intent deprecate or change behavior of existing APIs,
such that it has potentially high risk for Android WebView-based
applications?
No information provided
Debuggability
No information provided
Will this feature be supported on all six Blink platforms
(Windows, Mac, Linux, ChromeOS, Android, and Android WebView)?
No
No
https://github.com/tc39/test262/pull/4454
Flag name on about://flags
--js-flags=--js_upsert
Finch feature name
V8Flag_js_upsert
Rollout plan
Will ship enabled for all users
Requires code in //chrome?
False
Tracking bug
https://issues.chromium.org/u/1/issues/434977728
Estimated milestones
| Shipping on desktop | 145 |
| DevTrial on desktop | 143 |
| Shipping on Android | 145 |
| DevTrial on Android | 143 |
Anticipated spec changes
Open questions about a feature may be a source of future web compat or
interop issues. Please list open issues (e.g. links to known github
issues in the project for the feature specification) whose resolution
may introduce web compat/interop risk (e.g., changing to naming or
structure of the API in a non-backward-compatible way).
No information provided
Link to entry on the Chrome Platform Status
https://chromestatus.com/feature/5201653661827072?gate=6583456041664512