function getCodePoints(str) {
  const codePoints = [];
  for (let pos = 0; pos < str.length; pos += getUTF16Length(str, pos)) {
    codePoints.push(str.codePointAt(pos));
  }
  return codePoints;
}
Get a list of Unicode code-points from a String

@param {string} str        Valid Unicode string
@return {array<number>}    A list of code-points in [0..0x10FFFF]