mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:07:47 +00:00
LibJS: Add spec step comments to Object.hasOwn()
This commit is contained in:
parent
8195c31965
commit
4f2af65836
1 changed files with 7 additions and 2 deletions
|
@ -409,13 +409,18 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::create)
|
|||
// 1 Object.hasOwn ( O, P ), https://tc39.es/proposal-accessible-object-hasownproperty/#sec-object.hasown
|
||||
JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::has_own)
|
||||
{
|
||||
// 1. Let obj be ? ToObject(O).
|
||||
auto* object = vm.argument(0).to_object(global_object);
|
||||
if (vm.exception())
|
||||
return {};
|
||||
auto property_key = vm.argument(1).to_property_key(global_object);
|
||||
|
||||
// 2. Let key be ? ToPropertyKey(P).
|
||||
auto key = vm.argument(1).to_property_key(global_object);
|
||||
if (vm.exception())
|
||||
return {};
|
||||
return Value(object->has_own_property(property_key));
|
||||
|
||||
// 3. Return ? HasOwnProperty(obj, key).
|
||||
return Value(object->has_own_property(key));
|
||||
}
|
||||
|
||||
// 20.1.2.1 Object.assign ( target, ...sources ), https://tc39.es/ecma262/#sec-object.assign
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue