summary refs log tree commit diff stats
path: root/lib/pure
diff options
context:
space:
mode:
authorVarriount <Varriount@users.noreply.github.com>2014-07-24 18:05:44 -0400
committerVarriount <Varriount@users.noreply.github.com>2014-07-24 18:05:44 -0400
commit99aaefeaaecf015ee6d2432ed3a48c963b395eb6 (patch)
tree1963d8b35afe826be51e080dafc6693653d2158f /lib/pure
parent835f7007e055ce801d3465daa1e6c7cd94e8061a (diff)
parentbd8f5c8392fc6f28381170d029f67801789fd78d (diff)
downloadNim-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.nim8
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: