1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 04:48:14 +00:00

LibJS: Add Value::is_nullish()

This commit is contained in:
Andreas Kling 2020-10-02 16:00:15 +02:00
parent ef1b21004f
commit fa18baf3e8
9 changed files with 22 additions and 21 deletions

View file

@ -87,7 +87,7 @@ JS_DEFINE_NATIVE_FUNCTION(StringConstructor::raw)
auto raw = template_object->get("raw");
if (vm.exception())
return {};
if (raw.is_empty() || raw.is_undefined() || raw.is_null()) {
if (raw.is_empty() || raw.is_nullish()) {
vm.throw_exception<TypeError>(global_object, ErrorType::StringRawCannotConvert, raw.is_null() ? "null" : "undefined");
return {};
}