mirror of
https://github.com/waku-org/nwaku.git
synced 2025-01-30 16:47:48 +00:00
13 lines
281 B
Nim
13 lines
281 B
Nim
|
import
|
||
|
strutils
|
||
|
|
||
|
proc dedent*(s: string): string =
|
||
|
var s = s.strip(leading = false)
|
||
|
var minIndent = high(int)
|
||
|
for l in s.splitLines:
|
||
|
let indent = count(l, ' ')
|
||
|
if indent == 0: continue
|
||
|
if indent < minIndent: minIndent = indent
|
||
|
result = s.unindent(minIndent)
|
||
|
|