Migration

This commit is contained in:
ousttrue
2021-03-30 21:39:41 +09:00
parent a15b497b85
commit bf73c96847
7 changed files with 160 additions and 15 deletions

View File

@@ -66,6 +66,27 @@ namespace UniJSON
return self.ContainsKey(ukey);
}
public static bool TryGet(this JsonNode self, Utf8String key, out JsonNode found)
{
foreach (var kv in self.ObjectItems())
{
if (kv.Key.GetUtf8String() == key)
{
found = kv.Value;
return true;
}
}
found = default;
return false;
}
public static bool TryGet(this JsonNode self, String key, out JsonNode found)
{
var ukey = Utf8String.From(key);
return self.TryGet(ukey, out found);
}
public static Utf8String KeyOf(this JsonNode self, JsonNode node)
{
foreach (var kv in self.ObjectItems())