lib/text.js
function breakInsideToken(tokens, tokenIndex, breakIndex, removeBreakChar) {
    let newBreakToken = {
        type: TYPE_NEWLINE
    };
    let newTextToken = {
        type: TYPE_TEXT,
        value: tokens[tokenIndex].value.substring(breakIndex + (removeBreakChar ? 1 : 0))
    };
    tokens.splice(tokenIndex + 1, 0, newBreakToken, newTextToken);
    return tokens[tokenIndex].value.substring(0, breakIndex);
}
function breakInsideToken(tokens, tokenIndex, breakIndex, removeBreakChar) {
    let newBreakToken = {
        type: TYPE_NEWLINE
    };
    let newTextToken = {
        type: TYPE_TEXT,
        value: tokens[tokenIndex].value.substring(breakIndex + (removeBreakChar ? 1 : 0))
    };
    tokens.splice(tokenIndex + 1, 0, newBreakToken, newTextToken);
    return tokens[tokenIndex].value.substring(0, breakIndex);
}
function breakInsideToken ( tokens , tokenIndex , breakIndex , removeBreakChar ) { let newBreakToken = { type : TYPE_NEWLINE } ; let newTextToken = { type : TYPE_TEXT , value : tokens [ tokenIndex ] . value . substring ( breakIndex + ( removeBreakChar ? 1 : 0 ) ) } ; tokens . splice ( tokenIndex + 1 , 0 , newBreakToken , newTextToken ) ; return tokens [ tokenIndex ] . value . substring ( 0 , breakIndex ) ; }
Create new tokens and insert them into the stream
@param {object[]} tokens
@param {int} tokenIndex Token being processed
@param {int} breakIndex Index within current token's value
@param {bool} removeBreakChar Do we want to remove the breaking character?
@returns {string} remaining unbroken token value
Create new tokens and insert them into the stream