(text: string, ending: "\n" | "\r\n")
| 42 | const normalizeLineEndings = (text: string) => text.replaceAll("\r\n", "\n") |
| 43 | const detectLineEnding = (text: string): "\n" | "\r\n" => (text.includes("\r\n") ? "\r\n" : "\n") |
| 44 | const convertToLineEnding = (text: string, ending: "\n" | "\r\n") => |
| 45 | ending === "\n" ? normalizeLineEndings(text) : normalizeLineEndings(text).replaceAll("\n", "\r\n") |
| 46 | |
| 47 | const splitBom = (text: string) => |
| 48 | text.startsWith("\uFEFF") ? { bom: true, text: text.slice(1) } : { bom: false, text } |
no test coverage detected