MCPcopy Create free account
hub / github.com/PerpetualSoftware/pad / normalizeBody

Function normalizeBody

internal/artifact/encode.go:87–90  ·  view source on GitHub ↗

normalizeBody trims a trailing run of whitespace/newlines and ensures the body ends with exactly one trailing "\n". An empty body becomes "\n".

(body string)

Source from the content-addressed store, hash-verified

85// normalizeBody trims a trailing run of whitespace/newlines and ensures the
86// body ends with exactly one trailing "\n". An empty body becomes "\n".
87func normalizeBody(body string) string {
88 trimmed := strings.TrimRight(body, "\n")
89 return trimmed + "\n"
90}
91
92// toString coerces a scalar frontmatter value to string. Values originate as
93// strings in practice; non-strings are rendered defensively.

Callers 1

EncodeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected