code: function truncate(string, length) {
    if (Buffer.byteLength(string, 'utf8') <= length) {
      return string;
    }
    string = string.substr(0, length - 3);
    while (Buffer.byteLength(string, 'utf8') > length - 3) {
      string = string.substr(0, string.length - 1);
    }
    return string + '...';
  }
docs: Truncates the provided `string` to be at most `length` bytes
  after utf8 encoding and the appending of '...'.
  We produce the result by iterating over input characters to
  avoid truncating the string potentially producing partial unicode
  characters at the end.