diff options
author | flaviut <tamasflaviu@gmail.com> | 2014-04-13 17:25:43 -0400 |
---|---|---|
committer | flaviut <tamasflaviu@gmail.com> | 2014-04-13 17:27:47 -0400 |
commit | 64d3b9a34d0b51a6507a9be7ebd2d6fd25d64977 (patch) | |
tree | d664df030a7edd6b171c2d2c77ea4d90a0c2fd17 /lib/pure | |
parent | db7fee6303652572812a57ae70e3f2ca28e8829d (diff) | |
download | Nim-64d3b9a34d0b51a6507a9be7ebd2d6fd25d64977.tar.gz |
Fix subtle mistake in docs and formatting
Diffstat (limited to 'lib/pure')
-rw-r--r-- | lib/pure/json.nim | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/pure/json.nim b/lib/pure/json.nim index 7b2a0eed6..38cdcc3db 100644 --- a/lib/pure/json.nim +++ b/lib/pure/json.nim @@ -629,13 +629,13 @@ proc len*(n: PJsonNode): int = else: discard proc `[]`*(node: PJsonNode, name: string, default: PJsonNode = nil): PJsonNode = - ## Gets a field from a `JObject`. If node is nil, this returns default + ## Gets a field from a `JObject`. If node is nil, this returns `default` ## This is to allow for chaining such as the following: ## .. code-block Nimrod ## foo["field1"]["field2"] ## ## If `field1` is undefined, it will return nil, and the access on `field2` will - ## pass through and return nil. Also returns default if the key is not found. + ## pass through and return `default`. Also returns `default` if the key is not found. if isNil(node): return default assert(node.kind == JObject) @@ -645,8 +645,9 @@ proc `[]`*(node: PJsonNode, name: string, default: PJsonNode = nil): PJsonNode = return default proc `[]`*(node: PJsonNode, index: int, default: PJsonNode = nil): PJsonNode = - ## Gets the node at `index` in an Array.If `node` is nil, this returns nil to - ## allow for chaining. Results are undefined if the index is out of range. + ## Gets the node at `index` in an Array.If `node` is nil, this returns `result`, + ## which is by default `nil` to allow for chaining. Results are undefined if + ## the index is out of range. if isNil(node): return default assert(node.kind == JArray) |