← Back to context

Comment by jdthedisciple

2 hours ago

> Upsert (https://github.com/tc39/proposal-upsert): [Weak]Map.prototype.getOrInsert(), [Weak]Map.prototype.getOrInsertComputed()

Their usage of upsert appears different than I was used to:

Me: Upsert = Update or Insert

Them: Upsert = Get or Insert

Reminds me of the weird C++ map operator[] behavior.

If you use that operator and the value doesn't exist, it'll default create one and return a reference to that.

And as I'm writing this I realize why... references cannot be `null`.

The proposal used to do more thing and we didn't change the URL after we ultimately arrived at this set of APIs.