title: Group objects in array based on sequence
body: <p>I have an array of objects that are a log of actions taken by users.
  This is an example of what the array looks like:</p>
  <pre><code>   [
      {
          &quot;timestamp&quot;: &quot;2022-07-14T14:53:32.925Z&quot;,
          &quot;action&quot;: &quot;Action 1&quot;,
          &quot;user&quot;: &quot;User A&quot;
      },
      {
          &quot;timestamp&quot;: &quot;2022-07-13T14:53:32.925Z&quot;,
          &quot;action&quot;: &quot;Action 1&quot;,
          &quot;user&quot;: &quot;User A&quot;
      },
      {
          &quot;timestamp&quot;: &quot;2022-07-12T14:53:32.925Z&quot;,
          &quot;action&quot;: &quot;Action 1&quot;,
          &quot;user&quot;: &quot;User A&quot;
      },
      {
          &quot;timestamp&quot;: &quot;2022-07-11T14:53:32.925Z&quot;,
          &quot;action&quot;: &quot;Action 2&quot;,
          &quot;user&quot;: &quot;User A&quot;
      },
      {
          &quot;timestamp&quot;: &quot;2022-07-10T14:53:32.925Z&quot;,
          &quot;action&quot;: &quot;Action 2&quot;,
          &quot;user&quot;: &quot;User A&quot;
      },
      {
          &quot;timestamp&quot;: &quot;2022-07-09T14:53:32.925Z&quot;,
          &quot;action&quot;: &quot;Action 1&quot;,
          &quot;user&quot;: &quot;User A&quot;
      },
      {
          &quot;timestamp&quot;: &quot;2022-07-08T14:53:32.925Z&quot;,
          &quot;action&quot;: &quot;Action 1&quot;,
          &quot;user&quot;: &quot;User A&quot;
      },
      {
          &quot;timestamp&quot;: &quot;2022-07-07T14:53:32.925Z&quot;,
          &quot;action&quot;: &quot;Action 3&quot;,
          &quot;user&quot;: &quot;User B&quot;
      }
  ]
  </code></pre>
  <p>The result I am trying to achieve is that the array should be:</p>
  <pre><code>[
      {
          &quot;timestamp&quot;: &quot;2022-07-14T14:53:32.925Z&quot;,
          &quot;action&quot;: &quot;Action 1&quot;,
          &quot;user&quot;: &quot;User A&quot;
      },
      {
          &quot;timestamp&quot;: &quot;2022-07-11T14:53:32.925Z&quot;,
          &quot;action&quot;: &quot;Action 2&quot;,
          &quot;user&quot;: &quot;User A&quot;
      },
      {
          &quot;timestamp&quot;: &quot;2022-07-09T14:53:32.925Z&quot;,
          &quot;action&quot;: &quot;Action 1&quot;,
          &quot;user&quot;: &quot;User A&quot;
      },
      {
          &quot;timestamp&quot;: &quot;2022-07-07T14:53:32.925Z&quot;,
          &quot;action&quot;: &quot;Action 3&quot;,
          &quot;user&quot;: &quot;User B&quot;
      }
  ]
  </code></pre>
  <p>The array is in order of time.</p>
  <p>I don't want to group all duplicates, for example all &quot;action 1&quot; by &quot;User A&quot;, only if they occurred one after the other, save the most recent</p>
  <p>Any suggestions would be greatly appreciated, TIA!</p>