eol
is an opensource
newline
conversion node
module.
eol
helps you smoothly convert line endings
in node applications.
eol
is written in JavaScript and supports TypeScript too.
The words newline, linebreak, line ending
are used interchangeably here.
They mark an end of line.
Feel free to play with eol
in the console on this page for learning purposes.
eol.auto(text)
eol.crlf(text)
\r\nline endings
eol.lf(text)
\nline endings
eol.cr(text)
\rline endings
eol.dub(text)
eol.before(text)
eol.after(text)
eol.match(text)
eol.split(text)
eol.lf("hello\r\nworld\r\n")
// "hello\nworld\n"
eol.split(text).filter(line => line).join(eol.lf)
eol.match("hello\nworld\n")
// ["\n","\n"]
String(eol.lf) // "\n"
String(eol.cr) // "\r"
String(eol.crlf) // "\r\n"
let lflf = eol.dub("\n\n")
lflf("hello\nworld\n")
// "hello\n\nworld\n\n"