bin/format.js
function maximizeLargeWord(word, hardBreakStr, maxWidth) {
    var availableWidth;
    var ch;
    var chWidth;
    var i;

    availableWidth = maxWidth - Format.width(hardBreakStr);

    for (i = 0; i < word.length; i++) {
        ch = word.charAt(i);
        chWidth = Format.width(ch);
        if (availableWidth >= chWidth) {
            availableWidth -= chWidth;
        } else {
            break;
        }
    }

    return {
        start: word.substr(0, i) + hardBreakStr,
        remaining: word.substr(i)
    };
}
function maximizeLargeWord(word, hardBreakStr, maxWidth) {
    var availableWidth;
    var ch;
    var chWidth;
    var i;

    availableWidth = maxWidth - Format.width(hardBreakStr);

    for (i = 0; i < word.length; i++) {
        ch = word.charAt(i);
        chWidth = Format.width(ch);
        if (availableWidth >= chWidth) {
            availableWidth -= chWidth;
        } else {
            break;
        }
    }

    return {
        start: word.substr(0, i) + hardBreakStr,
        remaining: word.substr(i)
    };
}
function maximizeLargeWord ( word , hardBreakStr , maxWidth ) { var availableWidth ; var ch ; var chWidth ; var i ; availableWidth = maxWidth - Format . width ( hardBreakStr ) ; for ( i = 0 ; i < word . length ; i ++ ) { ch = word . charAt ( i ) ; chWidth = Format . width ( ch ) ; if ( availableWidth >= chWidth ) { availableWidth -= chWidth ; } else { break ; } } return { start : word . substr ( 0 , i ) + hardBreakStr , remaining : word . substr ( i ) } ; }
If a word is too large for a line then find out how much will
fit on one line and return the result.
@param {string} word
@param {string} hardBreakStr
@param {number} maxWidth
@returns {object}
If a word is too large for a line then find out how much will fit on one line and return the result .