MCPcopy Create free account
hub / github.com/anomalyco/opencode / normalizeLineEndings

Function normalizeLineEndings

packages/core/src/tool/edit.ts:42–42  ·  view source on GitHub ↗
(text: string)

Source from the content-addressed store, hash-verified

40export type Output = typeof Output.Type
41
42const normalizeLineEndings = (text: string) => text.replaceAll("\r\n", "\n")
43const detectLineEnding = (text: string): "\n" | "\r\n" => (text.includes("\r\n") ? "\r\n" : "\n")
44const convertToLineEnding = (text: string, ending: "\n" | "\r\n") =>
45 ending === "\n" ? normalizeLineEndings(text) : normalizeLineEndings(text).replaceAll("\n", "\r\n")

Callers 2

convertToLineEndingFunction · 0.70
previewLinesFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected