|
@@ -49,6 +49,7 @@ void ObjectPrototype::initialize(GlobalObject& global_object)
|
|
|
define_native_function(vm.names.toString, to_string, 0, attr);
|
|
|
define_native_function(vm.names.toLocaleString, to_locale_string, 0, attr);
|
|
|
define_native_function(vm.names.valueOf, value_of, 0, attr);
|
|
|
+ define_native_function(vm.names.propertyIsEnumerable, property_is_enumerable, 1, attr);
|
|
|
}
|
|
|
|
|
|
ObjectPrototype::~ObjectPrototype()
|
|
@@ -123,4 +124,18 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectPrototype::value_of)
|
|
|
return this_object->value_of();
|
|
|
}
|
|
|
|
|
|
+JS_DEFINE_NATIVE_FUNCTION(ObjectPrototype::property_is_enumerable)
|
|
|
+{
|
|
|
+ auto name = vm.argument(0).to_string(global_object);
|
|
|
+ if (vm.exception())
|
|
|
+ return {};
|
|
|
+ auto* this_object = vm.this_value(global_object).to_object(global_object);
|
|
|
+ if (!this_object)
|
|
|
+ return {};
|
|
|
+ auto property_descriptor = this_object->get_own_property_descriptor(name);
|
|
|
+ if (!property_descriptor.has_value())
|
|
|
+ return Value(false);
|
|
|
+ return Value(property_descriptor.value().attributes.is_enumerable());
|
|
|
+}
|
|
|
+
|
|
|
}
|