code: function bmpLength(str) {
    const s = str + '';
  
    const matches = s.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g);
    const count = matches ? matches.length : 0;
    return s.length - count;
  }
docs: **Calculates the length of a string, taking double-width <abbr title="Basic Multilingual Plane">BMP</abbr>
  characters into account.**
  
  Since this function takes double-width characters into account and the build in string `length` property does not,
  it is entirely possible for this function to provide a different result than querying the same string's `length`
  property.
  
  @function length
  @memberof module:xduce.util.bmp
  
  @param {string} str The string whose length is being determined.
  @return {number} The number of characters in the string, counting double-width BMP characters as single characters.