param str param length param char copyright license export function splitText ( str , length , char = ' ' ) { const x = str . substring ( 0 , length ) . lastIndexOf ( char ) ; const pos = x === - 1 ? length : x ; return str . substring ( 0 , pos ) ; }