docs: function combineEntries(newEntries, existingEntries) {
    const resultSet = [];
  
    // We're iterating through newEntries, this keeps track of where we are in the existingEntries
    let existingEntriesIteratorIndex = existingEntries.length - 1;
  
    for (let i = newEntries.length - 1; i >= 0; i -= 1) {
      const currentEntry = newEntries[i];
      const indexInExistingEntries =
        findLastIndexUsingComparinator(
          existingEntries,
          currentEntry,
          areEqualEntries,
          existingEntriesIteratorIndex);
      const hasEquivalentEntryInExistingEntries = indexInExistingEntries !== -1;
  
      if (hasEquivalentEntryInExistingEntries) {
        // If the same entry exists in existing entries, we should add all of the entries that
        // come before to maintain order
        for (let j = existingEntriesIteratorIndex; j > indexInExistingEntries; j -= 1) {
          const existingEntry = existingEntries[j];
  
          // If this entry also exists in new entries, we'll add as part of iterating through
          // new entries so that if there's a conflict between existing entries and new entries,
          // new entries order wins
          const hasMatchingEntryInNewEntries =
            findLastIndexUsingComparinator(newEntries, existingEntry, areEqualEntries, i) !== -1;
  
          if (!hasMatchingEntryInNewEntries) {
            resultSet.unshift(existingEntry);
          }
          existingEntriesIteratorIndex -= 1;
        }
  
        uniteEntries(currentEntry, existingEntries[existingEntriesIteratorIndex]);
        // uniteEntries mutates the second parameter to be a merged version, so that's what's pushed
        resultSet.unshift(existingEntries[existingEntriesIteratorIndex]);
  
        existingEntriesIteratorIndex -= 1;
      } else {
        const alreadyHasMatchingEntryInResultSet =
          findLastIndexUsingComparinator(resultSet, currentEntry, areEqualEntries) !== -1;
  
        if (!alreadyHasMatchingEntryInResultSet) {
          resultSet.unshift(currentEntry);
        }
      }
  
    }
  
    // Add remaining existing entries
    for (existingEntriesIteratorIndex; existingEntriesIteratorIndex >= 0;
      existingEntriesIteratorIndex -= 1) {
  
      const existingEntry = existingEntries[existingEntriesIteratorIndex];
      const alreadyHasMatchingEntryInResultSet =
        findLastIndexUsingComparinator(resultSet, existingEntry, areEqualEntries) !== -1;
  
      if (!alreadyHasMatchingEntryInResultSet) {
        resultSet.unshift(existingEntry);
      }
    }
  
    return resultSet;
  }