mirror of
https://github.com/jimeh/undent.git
synced 2026-02-19 11:56:39 +00:00
b2057429a1181724ae50acaed26fe434231362b4
This effectively cleans up what I consider syntactical sugar required
due to Go's syntax. For example:
str := undent.String(`
hello
world`,
)
In the above example I would consider the initial line-break after the
opening back-tick (`) character syntactical sugar, and hence should be
discarded from the final undented string.
However if the literal string contains more than one initial line-break,
only the first one should be removed, as the rest would intentionally be
part of the input.
undent
Go package which removes leading indentation/white-space from strings and byte slices.
s := undent.String(`
{
"hello": "world"
}`,
)
fmt.Println(s)
{
"hello": "world"
}
Documentation
Please see the Go Reference for documentation and examples.
Benchmarks
Benchmark reports and graphs are available here: https://jimeh.me/undent/dev/bench/
License
Languages
Go
89.6%
Makefile
10.4%