code: function bmpCharAt(str, index) {
    const s = str + '';
    let i = index;
    const end = s.length;
  
    const pairs = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
    while (pairs.exec(s)) {
      const li = pairs.lastIndex;
      if (li - 2 < i) {
        i++;
      } else {
        break;
      }
    }
  
    if (i >= end || i < 0) {
      return '';
    }
  
    let result = s.charAt(i);
  
    if (/[\uD800-\uDBFF]/.test(result) && /[\uDC00-\uDFFF]/.test(s.charAt(i + 1))) {
      result += s.charAt(i + 1);
    }
  
    return result;
  }
docs: **Returns the character at a particular index in a string, taking double-width
  <abbr title="Basic Multilingual Plane">BMP</abbr> characters into account.**
  
  This is a BMP version of the standard JavaScript `string.charAt` function. The index is adjusted to account for
  double-width characters in the input string, and if the resulting character is double-width, it will be returned as a
  two-character string. The second half of these double-width characters don't get assigned an index at all, so it
  works seemlessly between character widths.
  
  @function charAt
  @memberof module:xduce.util.bmp
  
  @param {string} str The input string whose character at the given index is sought.
  @param {number} index The index in the input string of the character being sought.
  @return {string} The character at the given index in the provided string. If this character is a BMP character,
  the full character will be returned as a two-character string.