Code coverage report for string/normalizeLineBreaks.js

Statements: 100% (6 / 6)      Branches: 100% (2 / 2)      Functions: 100% (3 / 3)      Lines: 100% (5 / 5)     

All files » string/ » normalizeLineBreaks.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 181           1 3 3           1      
define(function () {
 
    /**
     * Convert line-breaks from DOS/MAC to a single standard (UNIX by default)
     * @version 0.1.0 (2011/12/17)
     */
    function normalizeLineBreaks(str, lineEnd) {
        lineEnd = lineEnd || '\n';
        return str
                .replace(/\r\n/g, lineEnd) // DOS
                .replace(/\r/g, lineEnd)   // Mac
                .replace(/\n/g, lineEnd);  // Unix
    }
 
    return normalizeLineBreaks;
 
});