mirror of
https://github.com/status-im/nim-json-serialization.git
synced 2025-02-19 21:38:09 +00:00
Other changes: * Migrate many procs accepting JsonReader to JsonLexer in order to reduce the number of generic instantiations and the resulting code bloat
13 lines
343 B
Nim
13 lines
343 B
Nim
import strutils
|
|
|
|
# `dedent` exists in newer Nim version and doesn't behave the same
|
|
func test_dedent*(s: string): string =
|
|
var
|
|
s = s.strip(leading = false)
|
|
minIndent = high(int)
|
|
for l in s.splitLines:
|
|
let indent = count(l, ' ')
|
|
if indent == 0: continue
|
|
if indent < minIndent: minIndent = indent
|
|
s.unindent(minIndent)
|