1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 12:17:44 +00:00

AK: Add JsonValue::to_bool().

This commit is contained in:
Andreas Kling 2019-07-08 14:06:03 +02:00
parent 56563cb305
commit 5b19911025

View file

@ -67,6 +67,13 @@ public:
return IPv4Address::from_string(as_string()); return IPv4Address::from_string(as_string());
} }
bool to_bool(bool default_value = false) const
{
if (!is_bool())
return default_value;
return as_bool();
}
int as_int() const int as_int() const
{ {
ASSERT(is_int()); ASSERT(is_int());