Removes superfluous toUgly, documents toUgly better.
This commit is contained in:
parent
0ab2dc2954
commit
d937b4cd85
1 changed files with 4 additions and 6 deletions
|
|
@ -951,8 +951,11 @@ proc pretty*(node: JsonNode, indent = 2): string =
|
|||
|
||||
proc toUgly*(result: var string, node: JsonNode) =
|
||||
## Converts `node` to its JSON Representation, without
|
||||
## regard for human readability. Meant to improve '$' string
|
||||
## regard for human readability. Meant to improve ``$`` string
|
||||
## conversion performance.
|
||||
##
|
||||
## This provides higher efficiency than the ``toPretty`` procedure as it
|
||||
## does **not** attempt to format the resulting JSON to make it human readable.
|
||||
var comma = false
|
||||
case node.kind:
|
||||
of JArray:
|
||||
|
|
@ -985,11 +988,6 @@ proc toUgly*(result: var string, node: JsonNode) =
|
|||
of JNull:
|
||||
result.add "null"
|
||||
|
||||
proc toUgly*(node: JsonNode): string =
|
||||
## Converts `node` to its JSON Representation on one line.
|
||||
result = newStringOfCap(node.len shl 1)
|
||||
toUgly(result, node)
|
||||
|
||||
proc `$`*(node: JsonNode): string =
|
||||
## Converts `node` to its JSON Representation on one line.
|
||||
result = newStringOfCap(node.len shl 1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue