title: Javascript - sum total and remove duplicate lines in array of objects
body: <p>I have an array of objects with some information.
  Lines with the same color and size, I want to make a total sum and delete the duplicated lines, that is, for each color and size equal, I only want to get one line.</p>
  <p><strong>My object array</strong></p>
  <pre><code>  data = [
  {
    tam: 'S',
    color: 'blue',
    total: 5
  },
  {
    tam: 'S',
    color: 'blue',
    total: 10
  },
  {
    tam: 'S',
    color: 'blue',
    total: 20
  },
  {
    tam: 'M',
    color: 'blue',
    total: 5
  },
  {
    tam: 'L',
    color: 'blue',
    total: 5
  }
  </code></pre>
  <p>];</p>
  <p><strong>The desired output</strong></p>
  <pre><code> data = [
      {
        tam: 'S',
        color: 'blue',
        total: 35
      },
      {
        tam: 'M',
        color: 'blue',
        total: 5
      },
      {
        tam: 'L',
        color: 'blue',
        total: 5
      }
    ];
  </code></pre>
  <p><a href="https://stackblitz.com/edit/angular-ivy-ji91bg?file=src%2Fapp%2Fapp.component.ts" rel="nofollow noreferrer">DEMO</a></p>