assets/src/services/history.js
/**
   * Invert RemoteChange from add to remove and vice versa.
   *
   * @param {import('./remote_change').RemoteChange} change
   * @param {Number} lamport
   * @return {import('./remote_change').RemoteChange}
   */
Invert RemoteChange from add to remove and vice versa.
Invert RemoteChange from add to remove and vice versa .
invert (change, lamport) {
    const char = change[1]
    switch (change[0]) {
      case 'add':
        return ['remove', Char.create(char.position, char.lamport, char.value)]
      case 'remove':
        return ['add', Char.create(char.position, lamport, char.value)]
    }
  }
invert ( change , lamport ) { const char = change [ 1 ] switch ( change [ 0 ] ) { case 'add' : return [ 'remove' , Char . create ( char . position , char . lamport , char . value ) ] case 'remove' : return [ 'add' , Char . create ( char . position , lamport , char . value ) ] } }
Invert RemoteChange from add to remove and vice versa.
Invert RemoteChange from add to remove and vice versa .
// Add new character but with updated lamport value since we're inserting // a new character