Closed ljharb closed 3 years ago
The note is copied directly from Object.prototype.hasOwnProperty
's spec text: https://tc39.es/ecma262/#sec-object.prototype.hasownproperty
And #7 does the renaming to hasOwn
and updates the links for the repo to github.com/tc39/proposal-accessible-object-hasownproperty
that I was waiting to merge until transferred
The second one tho - Object.prototype.hasOwnProperty
needs that note to justify its weird exception ordering as "legacy behavior". Object.hasOwn
doesn't need to have that legacy baggage.
Oh okay, I just re-read what ToPropertyKey
does, I thought I was preserving the same exceptions, didn't realize it no longer threw any at all.
Should I note the order of operations is different from hasOwnProperty
?
ToPropertyKey
definitely throws an exception - for example, on { toString() { throw 42; } }
.
My preference is to do the ToObject first, and then sure, a note explaining the difference between that and hasOwnProperty seems great!
Please mark my review as complete in #6.
hasOwn
ToPropertyKey
throws beforeToObject
, but the wording implies it's for legacy compatibility, and there is no previousObject.hasOwn
. In other words, if it's important to make the function truly be identical toObject.prototype.hasOwnProperty
, the note needs better wording; however, it seems better to me to do the ToObject first?