code: function createNodes(entityRanges, decoratorRanges = [], textArray, block) {
    let lastIndex = 0;
    const mergedRanges = [...entityRanges, ...decoratorRanges].sort((a, b) => a.offset - b.offset);
    const nodes = [];
    // if thers no entities will return just a single item
    if (mergedRanges.length < 1) {
      nodes.push(new ContentNode({ block, start: 0, end: textArray.length }));
      return nodes;
    }
  
    mergedRanges.forEach((range) => {
      // create an empty node for content between previous and this entity
      if (range.offset > lastIndex) {
        nodes.push(new ContentNode({ block, start: lastIndex, end: range.offset }));
      }
      // push the node for the entity
      nodes.push(new ContentNode({
        block,
        entity: range.key,
        decorator: range.component,
        decoratorProps: range.decoratorProps,
        decoratedText: range.component
          ? getString(textArray, range.offset, range.offset + range.length)
          : undefined,
        start: range.offset,
        end: range.offset + range.length,
        contentState: range.contentState,
      }));
      lastIndex = range.offset + range.length;
    });
  
    // finaly add a node for the remaining text if any
    if (lastIndex < textArray.length) {
      nodes.push(new ContentNode({
        block,
        start: lastIndex,
        end: textArray.length,
      }));
    }
    return nodes;
  }
docs: creates nodes with entity keys and the endOffset