code: function getRelevantIndexes(text, inlineRanges, entityRanges = [], decoratorRanges = []) {
    let relevantIndexes = [];
    // set indexes to corresponding keys to ensure uniquenes
    relevantIndexes = addIndexes(relevantIndexes, inlineRanges);
    relevantIndexes = addIndexes(relevantIndexes, entityRanges);
    relevantIndexes = addIndexes(relevantIndexes, decoratorRanges);
    // add text start and end to relevant indexes
    relevantIndexes.push(0);
    relevantIndexes.push(text.length);
    const uniqueRelevantIndexes = relevantIndexes.filter(
      (value, index, self) => self.indexOf(value) === index
    );
    // and sort it
    return uniqueRelevantIndexes.sort((aa, bb) => (aa - bb));
  }
docs: Creates an array of sorted char indexes to avoid iterating over every single character