client/client.js
// detect dominant line ending style (CRLF vs LF)
detect dominant line ending style (CRLF vs LF)
detect dominant line ending style ( CRLF vs LF )
function dominantLineEnding(str) {
    var numCRLF = (str.match(/\r\n/gm) || []).length;
    var numLF = (str.split("").reverse().join("").match(/\n(?!(\r))/gm) || []).length;
    return (numCRLF > numLF) ? "\r\n" : "\n";
  }
function dominantLineEnding ( str ) { var numCRLF = ( str . match ( / \r\n / gm ) || [ ] ) . length ; var numLF = ( str . split ( "" ) . reverse ( ) . join ( "" ) . match ( / \n(?!(\r)) / gm ) || [ ] ) . length ; return ( numCRLF > numLF ) ? "\r\n" : "\n" ; }
detect dominant line ending style (CRLF vs LF)
detect dominant line ending style ( CRLF vs LF )
// emulating negative lookbehind by reversing the string