summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorDominik Picheta <dominikpicheta@googlemail.com>2015-05-17 18:18:33 +0100
committerDominik Picheta <dominikpicheta@googlemail.com>2015-05-17 18:18:33 +0100
commitd937b4cd850b3ee93815622609f7cd1d8a38d484 (patch)
treef0bea7fea58277de016660c332a7a36b59bcb5ae
parent0ab2dc2954b5d510525da29ef56112fe60e1c01e (diff)
downloadNim-d937b4cd850b3ee93815622609f7cd1d8a38d484.tar.gz
Removes superfluous toUgly, documents toUgly better.
-rw-r--r--lib/pure/json.nim10
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/pure/json.nim b/lib/pure/json.nim
index 7ab4d9ad9..4f7f11108 100644
--- a/lib/pure/json.nim
+++ b/lib/pure/json.nim
@@ -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)