mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-25 11:48:06 +00:00
AK+Everywhere: Store JSON strings as String
This commit is contained in:
parent
e591636419
commit
bc54c0cdfb
Notes:
github-actions[bot]
2025-02-21 00:29:21 +00:00
Author: https://github.com/trflynn89
Commit: bc54c0cdfb
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3631
Reviewed-by: https://github.com/awesomekling ✅
33 changed files with 163 additions and 152 deletions
|
@ -116,11 +116,17 @@ Optional<bool> JsonObject::get_bool(StringView key) const
|
|||
return {};
|
||||
}
|
||||
|
||||
Optional<String const&> JsonObject::get_string(StringView key) const
|
||||
{
|
||||
if (auto value = get(key); value.has_value() && value->is_string())
|
||||
return value->as_string();
|
||||
return {};
|
||||
}
|
||||
|
||||
Optional<ByteString> JsonObject::get_byte_string(StringView key) const
|
||||
{
|
||||
auto maybe_value = get(key);
|
||||
if (maybe_value.has_value() && maybe_value->is_string())
|
||||
return maybe_value->as_string();
|
||||
if (auto value = get_string(key); value.has_value())
|
||||
return value->to_byte_string();
|
||||
return {};
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue