title: transform an array of objects into an array of objects with a different format
body: <p>There is a use case whereby <code>data</code> needs to be transformed into <code>result</code> for the purpose of displaying the data in the UI in a pivoted format.  In <code>result</code> the numbered keys are the month numbers and their values are the quantity for that month.</p>
  <pre><code>const data = [
              { date: '10/1/2021', quantity: 47 },
              { date: '11/1/2021', quantity: 58 },
              { date: '12/1/2021', quantity: 96 },
              { date: '1/1/2022', quantity: 88 },
              { date: '2/1/2022', quantity: 90 },
          ];
  
  const result = [
              { year: 2021, 10: 47, 11: 58, 12: 96 },
              { year: 2022, 1: 88, 2: 90 }
          ];
  </code></pre>
  <p>So far I have created <code>intermediate</code> but don't know how to get that into the final <code>result</code> format in a concise manner.  ES6 solutions are preferred.</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const data = [
      { date: '10/1/2021', quantity: 47 },
      { date: '11/1/2021', quantity: 58 },
      { date: '12/1/2021', quantity: 96 },
      { date: '1/1/2022', quantity: 88 },
      { date: '2/1/2022', quantity: 90 },
  ];
  
  const intermediate = data.map(o =&gt; {
      // eslint-disable-next-line no-unused-vars
      const [month, day, year] = o.date.split('/');    // destructuring assignment
      return { year: year, [month]: o.quantity }
  });
  
  console.log(intermediate);</code></pre>
  </div>
  </div>
  </p>