docs: function compareAnyKeyMessages(msg1, msg2, states, context) {
    const msg1State = states.get(msg1);
    const msg2State = states.get(msg2);
  
    const msg1Key = msg1State.key;
    const msg2Key = msg2State.key;
  
    const msg1SeqNos = msg1State.seqNos;
    const msg2SeqNos = msg2State.seqNos;
    const msg1SeqNo = msg1State.seqNo;
    const msg2SeqNo = msg2State.seqNo;
    const len1 = msg1SeqNos.length;
    const len2 = msg2SeqNos.length;
    const maxParts = Math.max(len1, len2);
    if (len1 < maxParts) {
      context.warn(`Message 1 with key ${msg1Key} has a sequence # ${msg1SeqNo} with too few parts vs message 2 with key ${msg2Key} & sequence # ${msg2SeqNo} - sorting message 1 AFTER message 2`);
      return +1;
    }
    if (len2 < maxParts) {
      context.warn(`Message 2 with key ${msg2Key} has a sequence # ${msg2SeqNo} with too few parts vs message 1 with key ${msg1Key} & sequence # ${msg1SeqNo} - sorting message 2 AFTER message 1`);
      return -1;
    }
  
    // Compare each sequence number part
    for (let p = 0; p < maxParts; ++p) {
      const msg1SeqNoPart = msg1SeqNos[p];
      const msg2SeqNoPart = msg2SeqNos[p];
  
      // Messages current sequence # part keys must be the same, but just in case ...
      const msg1PartKey = msg1SeqNoPart[0];
      const msg2PartKey = msg2SeqNoPart[0];
      const keyComparison = sorting.compareStrings(msg1PartKey, msg2PartKey, defaults.keyCompareOpts);
      if (keyComparison !== 0) {
        context.warn(`Message 1 with key ${msg1Key} has a different sequence # part ${p} key (${msg1PartKey}) vs message 2 with key ${msg2Key} & part ${p} key (${msg2PartKey}) - sorting messages based on these part keys, i.e. message 1 ${msg1SeqNo} ${keyComparison < 0 ? '<' : '>'} message 2 ${msg2SeqNo}`);
        return keyComparison;
      }
  
      // Messages current sequence # part keys are the same, so compare their part values
      const sortable1 = msg1SeqNoPart.sortable;
      const sortable2 = msg2SeqNoPart.sortable;
  
      const sortType1 = sortable1 ? sortable1.sortType : undefined;
      const sortType2 = sortable2 ? sortable2.sortType : undefined;
  
      if (sortType1 !== sortType2) {
        throwErrorOrWarn(`Message 1 with key ${msg1Key} has a different sequence # part ${p} key (${msg1PartKey}) sort type (${sortType1}) vs message 2 with key ${msg2Key} & sort type(${sortType2}) - message 1 ${msg1SeqNo} vs message 2 ${msg2SeqNo}`,
          true, context);
      }
      const sortable = sortable1 ? sortable1 : sortable2;
  
      const compare = sortable ? sortable.compare : undefined;
      if (!compare) {
        throwErrorOrWarn(`Missing compare function for comparison of message 1 with key ${msg1Key} sequence # part ${p} key (${msg1PartKey}) & sort type (${sortType1}) vs message 2 with key ${msg2Key} & sort type (${sortType2}) - message 1 ${msg1SeqNo} vs message 2 ${msg2SeqNo}`,
          true, context);
      }
      const msg1PartVal = msg1SeqNoPart[1];
      const msg2PartVal = msg2SeqNoPart[1];
      const valueComparison = compare(msg1PartVal, msg2PartVal, defaults.valueCompareOpts);
      if (valueComparison < 0) return -1;
      if (valueComparison > 0) return +1;
      // values are the same, so continue
    }
    return 0;
  }