title: Group items in array based on key positions
body: <p>Given the following array:</p>
  <pre><code>const arr = [
    { id: 1, type: 'tab', content: 'Tab 1'},
    { id: 20, type: 'tabContent', content: 'Tab 1 content...' },
    { id: 2, type: 'tabContent', content: 'Tab 1 content...' },
    { id: 3, type: 'tabContent', content: 'Tab 1 content...' },
    { id: 5, type: 'tabContent', content: 'Tab 1 content...' },
    { id: 22, type: 'tab', content: 'Tab 2' },
    { id: 7, type: 'tabContent', content: 'Tab 2 content...' },
    { id: 8, type: 'tabContent', content: 'Tab 2 content...' },
    { id: 9, type: 'tabContent', content: 'Tab 2 content...' },
    { id: 10, type: 'tabContent', content: 'Tab 2 content...' },
    { id: 11, type: 'tabContent', content: 'Tab 2 content...' },
    { id: 12, type: 'tabContent', content: 'Tab 2 content...' },
    { id: 99, type: 'tab', content: 'Tab 3' },
    { id: 14, type: 'tabContent', content: 'Tab 3 content...' },
    { id: 15, type: 'tabContent', content: 'Tab 3 content...' },
    { id: 16, type: 'tabContent', content: 'Tab 3 content...' },
    { id: 17, type: 'tabContent', content: 'Tab 3 content...' },
  ];
  </code></pre>
  <p>Id like the array to end up looking like:</p>
  <pre><code>const arr = [
      { id: 1, type: 'tab', content: 'Tab 1', childContent: [
          { id: 20, type: 'tabContent', content: 'Tab 1 content...' },
          { id: 2, type: 'tabContent', content: 'Tab 1 content...' },
          { id: 3, type: 'tabContent', content: 'Tab 1 content...' },
          { id: 5, type: 'tabContent', content: 'Tab 1 content...' },
      ]},
      { id: 22, type: 'tab', content: 'Tab 2', childContent: [
          { id: 7, type: 'tabContent', content: 'Tab 2 content...' },
          { id: 8, type: 'tabContent', content: 'Tab 2 content...' },
          { id: 9, type: 'tabContent', content: 'Tab 2 content...' },
          { id: 10, type: 'tabContent', content: 'Tab 2 content...' },
          { id: 11, type: 'tabContent', content: 'Tab 2 content...' },
          { id: 12, type: 'tabContent', content: 'Tab 2 content...' },
      ] },
      { id: 99, type: 'tab', content: 'Tab 3', childContent: [
          { id: 14, type: 'tabContent', content: 'Tab 3 content...' },
          { id: 15, type: 'tabContent', content: 'Tab 3 content...' },
          { id: 16, type: 'tabContent', content: 'Tab 3 content...' },
          { id: 17, type: 'tabContent', content: 'Tab 3 content...' },
      ] },
  ];
  </code></pre>
  <p>Got the keys indexes:</p>
  <pre><code>const keys = []
  arr.map((item, index) =&gt; {
    if (item.type === 'tab') {
      keys.push(index)
    }
  })
  
  console.log('keys: ', keys)
  </code></pre>
  <p>&quot;keys: &quot;, [0, 5, 12]</p>
  <p>Based on the found indexes, how can I group the items within the array to their found indexes until the next occurrence happens?</p>