charsToCodePoints = ({ node, position }) => {
  const chars = node.textContent.substr(0, position);
  const codePoints = [...chars].length;

  return { node, position: codePoints };
}
Fix position in node from chars count to code points count
In python and other modern tools complex unicode symbols handled as code points, not UTF chars
So for external usage js length should be converted to code points count
string to array conversion splits string into code points array, that's the easiest way
@param {{ node: Node, position: number }} container
@return {{ node: Node, position: number }}