1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:07:35 +00:00

LibJS: Add PrimitiveString::is_empty() and use it

If we're only interested in whether the string is empty, we can skip the
conversion from UTF-16 to UTF-8.
This commit is contained in:
Andreas Kling 2022-07-17 21:08:53 +02:00
parent 32480fbeb9
commit f4c68eb0a4
3 changed files with 12 additions and 1 deletions

View file

@ -382,7 +382,7 @@ bool Value::to_boolean() const
return false;
return m_value.as_double != 0;
case Type::String:
return !m_value.as_string->string().is_empty();
return !m_value.as_string->is_empty();
case Type::Symbol:
return true;
case Type::BigInt: