function replaceNewlines(str) {
  var replacement = arguments.length <= 1 || arguments[1] === undefined ? ' ' : arguments[1];

  return str.replace(NEWLINE_REGEX, replacement);
}
function replaceNewlines(str) {
  var replacement = arguments.length <= 1 || arguments[1] === undefined ? ' ' : arguments[1];

  return str.replace(NEWLINE_REGEX, replacement);
}
function replaceNewlines ( str ) { var replacement = arguments . length <= 1 || arguments [ 1 ] === undefined ? ' ' : arguments [ 1 ] ; return str . replace ( NEWLINE_REGEX , replacement ) ; }
Replace newline characters with the passed string
@param  {String} str String to replace
@param  {String} replacement Replacement characters
@return {String} Modified string
Replace newline characters with the passed string