function generateLeaves(
  characters: List<CharacterMetadata>,
  offset: number,
  // $FlowFixMe[value-as-type]
): List<LeafRange> {
  const leaves = [];
  const inlineStyles = characters.map(c => c.getStyle()).toList();
  findRangesImmutable(inlineStyles, areEqual, returnTrue, (start, end) => {
    leaves.push(
      new LeafRange({
        start: start + offset,
        end: end + offset,
      }),
    );
  });
  return List(leaves);
}
Generate LeafRange records for a given character list.