code: function insertAndMergeSlot(slot, slotNext, mergeWithPrev, mergeWithNext) {
                      insertSlot(slot, slotNext);
  
                      var slotPrev = slot.prev;
  
                      if (slotPrev.lastInSequence) {
                          if (mergeWithPrev) {
                              delete slotPrev.lastInSequence;
                          } else {
                              slot.firstInSequence = true;
                          }
  
                          if (mergeWithNext) {
                              delete slotNext.firstInSequence;
                          } else {
                              slot.lastInSequence = true;
                          }
                      }
                  }
docs: Inserts a slot in the middle of a sequence or between sequences.  If the latter, mergeWithPrev and mergeWithNext parameters specify whether to merge the slot with the previous sequence, or next, or neither.