mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 22:57:44 +00:00
LibJS: Add Object::get_enumerable_own_property_names() and use it
Object::get_own_properties() is a bit unwieldy to use - especially as StringOnly is about to no longer be the default value. The spec has an abstract operation specifically for this (EnumerateObjectProperties), so let's use that. No functionality change.
This commit is contained in:
parent
afc86abe24
commit
1416027486
4 changed files with 13 additions and 4 deletions
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
|
||||
* Copyright (c) 2020-2021, Linus Groh <mail@linusgroh.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -262,6 +263,12 @@ Value Object::get_own_properties(PropertyKind kind, bool only_enumerable_propert
|
|||
return properties_array;
|
||||
}
|
||||
|
||||
// 7.3.23 EnumerableOwnPropertyNames, https://tc39.es/ecma262/#sec-enumerableownpropertynames
|
||||
Value Object::get_enumerable_own_property_names(PropertyKind kind) const
|
||||
{
|
||||
return get_own_properties(kind, true, Object::GetOwnPropertyReturnType::StringOnly);
|
||||
}
|
||||
|
||||
Optional<PropertyDescriptor> Object::get_own_property_descriptor(const PropertyName& property_name) const
|
||||
{
|
||||
VERIFY(property_name.is_valid());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue