src/core/utils.js
function trimLines(text) {
    let linebreak = determineLinebreaks(text);
    if (linebreak === "") return text;

    let lines = [];
    lines = text.split(linebreak);
    text = "";

    for (let i = 0; i < lines.length; i++) {
        let line = lines[i];

        while (true) {
            let lastChar = line.slice(line.length-1, line.length);
            let repeat = false;

            switch (lastChar) {
                case " ":
                case "\t":
                    line = line.slice(0, -1)
                    repeat = true;
            }

            if (!repeat) break;
        }

        text += line + linebreak;
    }

    return text;
}
function trimLines(text) {
    let linebreak = determineLinebreaks(text);
    if (linebreak === "") return text;

    let lines = [];
    lines = text.split(linebreak);
    text = "";

    for (let i = 0; i < lines.length; i++) {
        let line = lines[i];

        while (true) {
            let lastChar = line.slice(line.length-1, line.length);
            let repeat = false;

            switch (lastChar) {
                case " ":
                case "\t":
                    line = line.slice(0, -1)
                    repeat = true;
            }

            if (!repeat) break;
        }

        text += line + linebreak;
    }

    return text;
}
function trimLines ( text ) { let linebreak = determineLinebreaks ( text ) ; if ( linebreak === "" ) return text ; let lines = [ ] ; lines = text . split ( linebreak ) ; text = "" ; for ( let i = 0 ; i < lines . length ; i ++ ) { let line = lines [ i ] ; while ( true ) { let lastChar = line . slice ( line . length - 1 , line . length ) ; let repeat = false ; switch ( lastChar ) { case " " : case "\t" : line = line . slice ( 0 , - 1 ) repeat = true ; } if ( ! repeat ) break ; } text += line + linebreak ; } return text ; }
Remove any trailing spaces or tabs at the end of each line of a given text.

@param  {String} text Original text
@return {String} Trimed text
Remove any trailing spaces or tabs at the end of each line of a given text .