I am sure this has been asked before, but I cannot find it.
Basically, assuming you are parsing a text file of unknown origin and want to replace line breaks with so
Just replace /[\r\n]+/g with an empty string "".
/[\r\n]+/g
""
It'll replace all \r and \n no matter what order they appear in the string.
\r
\n