mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-19 22:10:33 +00:00
Implemented in operator support for JsonNode objects
This commit is contained in:
@@ -848,6 +848,16 @@ proc hasKey*(node: JsonNode, key: string): bool =
|
||||
assert(node.kind == JObject)
|
||||
result = node.fields.hasKey(key)
|
||||
|
||||
proc contains*(node: JsonNode, key: string): bool =
|
||||
## Checks if `key` exists in `node`.
|
||||
assert(node.kind == JObject)
|
||||
node.fields.hasKey(key)
|
||||
|
||||
proc contains*(node: JsonNode, val: JsonNode): bool =
|
||||
## Checks if `val` exists in array `node`.
|
||||
assert(node.kind == JArray)
|
||||
find(node.elems, val) >= 0
|
||||
|
||||
proc existsKey*(node: JsonNode, key: string): bool {.deprecated.} = node.hasKey(key)
|
||||
## Deprecated for `hasKey`
|
||||
|
||||
|
||||
Reference in New Issue
Block a user