code: function splitLongWords(str, max, truncationChar) {
    str = str.trim()
    var result = []
    var words = str.split(' ')
    var remainder = ''
  
    var truncationWidth = wcwidth(truncationChar)
  
    while (remainder || words.length) {
      if (remainder) {
        var word = remainder
        remainder = ''
      } else {
        var word = words.shift()
      }
  
      if (wcwidth(word) > max) {
        // slice is based on length no wcwidth
        var i = 0
        var wwidth = 0
        var limit = max - truncationWidth
        while (i < word.length) {
          var w = wcwidth(word.charAt(i))
          if (w + wwidth > limit) {
            break
          }
          wwidth += w
          ++i
        }
  
        remainder = word.slice(i) // get remainder
        // save remainder for next loop
  
        word = word.slice(0, i) // grab truncated word
        word += truncationChar // add trailing … or whatever
      }
      result.push(word)
    }
  
    return result.join(' ')
  }
docs: Add spaces and `truncationChar` between words of
  `str` which are longer than `max`.
  
  @param String str string to split
  @param Number max length of each line
  @param Number truncationChar character to append to split words
  @return String