diff options
author | Varriount <Varriount@users.noreply.github.com> | 2014-07-24 18:05:44 -0400 |
---|---|---|
committer | Varriount <Varriount@users.noreply.github.com> | 2014-07-24 18:05:44 -0400 |
commit | 99aaefeaaecf015ee6d2432ed3a48c963b395eb6 (patch) | |
tree | 1963d8b35afe826be51e080dafc6693653d2158f /lib/pure | |
parent | 835f7007e055ce801d3465daa1e6c7cd94e8061a (diff) | |
parent | bd8f5c8392fc6f28381170d029f67801789fd78d (diff) | |
download | Nim-99aaefeaaecf015ee6d2432ed3a48c963b395eb6.tar.gz |
Merge pull request #1289 from fowlmouth/patch-5
json.== handles nil now
Diffstat (limited to 'lib/pure')
-rw-r--r-- | lib/pure/json.nim | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/pure/json.nim b/lib/pure/json.nim index 508e564c5..a45900f29 100644 --- a/lib/pure/json.nim +++ b/lib/pure/json.nim @@ -621,9 +621,13 @@ proc `%`*(elements: openArray[PJsonNode]): PJsonNode = proc `==`* (a,b: PJsonNode): bool = ## Check two nodes for equality - if a.kind != b.kind: false + if a.isNil: + if b.isNil: return true + return false + elif b.isNil or a.kind != b.kind: + return false else: - case a.kind + return case a.kind of JString: a.str == b.str of JInt: |