mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-03 03:32:32 +00:00
Removes superfluous toUgly, documents toUgly better.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user