Normalizes line endings to LF (\n), converting both CRLF (\r\n) and lone CR (\r) -- useful for comparing or hashing text that may have come from different platforms (e.g. Windows-authored input).
\n
\r\n
\r
Text to normalize.
The text with all line endings converted to \n.
normalizeLineEndings('line1\r\nline2\rline3'); // 'line1\nline2\nline3' Copy
normalizeLineEndings('line1\r\nline2\rline3'); // 'line1\nline2\nline3'
Normalizes line endings to LF (
\n), converting both CRLF (\r\n) and lone CR (\r) -- useful for comparing or hashing text that may have come from different platforms (e.g. Windows-authored input).