e (iterator.next() != -1) {
      breaks.push(iterator.current(), getBreakType(iterator.breakType()));
    }

    return breaks;
  }

  function getBreakType(v8BreakType) {
    return v8BreakType == 'none' ? SOFT : HARD;
  }

  function getGraphemeBoundaries(text) {
    const segmenter = new Intl.Segmenter(['en'], {type: 'grapheme'});
    const segments = segmenter.segment(text);

    const graphemeBoundaries = [];
    for (const segment of segments) {
      graphemeBoundaries.push(segment.index);
    }
   