title: Split array into dynamic groups
body: <p>I am attempting to split the below array into chunks based on the size property:</p>
  
  <pre><code>[
      { size:6, value:1 },
      { size:6, value:2 },
      { size:12, value:3 },
      { size:6, value:4 },
      { size:6, value:5 }
  ]
  </code></pre>
  
  <p>The idea is to split the array into groups of 2 but if an item in the array has a size of 6 the group must only have 1 item.</p>
  
  <p>so ideally I want the array to look like the following after it has been run through the splitting function:</p>
  
  <pre><code>[
      [
          { size: 6, value: 1 },
          { size: 6, value: 2 }
      ],
      [
          { size: 12, value: 3 },
      ]
      [
          { size: 6, value: 4 },
          { size: 6, value: 5 }
      ]
  ]
  </code></pre>