src/file/FileUtils.js
function translateLineEndings(text, lineEndings) {
        if (lineEndings !== LINE_ENDINGS_CRLF && lineEndings !== LINE_ENDINGS_LF) {
            lineEndings = getPlatformLineEndings();
        }

        var eolStr = (lineEndings === LINE_ENDINGS_CRLF ? "\r\n" : "\n");
        var findAnyEol = /\r\n|\r|\n/g;

        return text.replace(findAnyEol, eolStr);
    }
function translateLineEndings(text, lineEndings) {
        if (lineEndings !== LINE_ENDINGS_CRLF && lineEndings !== LINE_ENDINGS_LF) {
            lineEndings = getPlatformLineEndings();
        }

        var eolStr = (lineEndings === LINE_ENDINGS_CRLF ? "\r\n" : "\n");
        var findAnyEol = /\r\n|\r|\n/g;

        return text.replace(findAnyEol, eolStr);
    }
function translateLineEndings ( text , lineEndings ) { if ( lineEndings !== LINE_ENDINGS_CRLF && lineEndings !== LINE_ENDINGS_LF ) { lineEndings = getPlatformLineEndings ( ) ; } var eolStr = ( lineEndings === LINE_ENDINGS_CRLF ? "\r\n" : "\n" ) ; var findAnyEol = / \r\n|\r|\n / g ; return text . replace ( findAnyEol , eolStr ) ; }
Translates any line ending types in the given text to the be the single form specified
@param {!string} text
@param {null|LINE_ENDINGS_CRLF|LINE_ENDINGS_LF} lineEndings
@return {string}
Translates any line ending types in the given text to the be the single form specified