mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-07 00:08:39 +09:00
Issue #2256 - Implement Object.hasOwn(object, property)
This is a convenience access function to hasOwnProperty. Trivial, self-hosted implementation providing the interface to the already existing hasOwnProperty cpp function with additional toObject for spec compliance. Resolves #2256
This commit is contained in:
parent
106de86dc4
commit
77bd81595d
2 changed files with 10 additions and 0 deletions
|
|
@ -1240,6 +1240,7 @@ static const JSFunctionSpec object_static_methods[] = {
|
|||
JS_FN("seal", obj_seal, 1, 0),
|
||||
JS_FN("isSealed", obj_isSealed, 1, 0),
|
||||
JS_SELF_HOSTED_FN("fromEntries", "ObjectFromEntries", 1, 0),
|
||||
JS_SELF_HOSTED_FN("hasOwn", "ObjectHasOwn", 2, 0),
|
||||
JS_FS_END
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -220,3 +220,12 @@ function ObjectFromEntries(iter) {
|
|||
|
||||
return obj;
|
||||
}
|
||||
|
||||
// Proposal https://github.com/tc39/proposal-accessible-object-hasownproperty
|
||||
// Object.hasOwn (Object, Property)
|
||||
function ObjectHasOwn(O, P) {
|
||||
// Step 1.
|
||||
var obj = ToObject(O);
|
||||
// Step 2-3.
|
||||
return callFunction(std_Object_hasOwnProperty, obj, P);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue