title: How to groupBy with sum using lodash
body: <p>I have productId which is an array of values.</p>
  <pre><code>const groupByvalue= [1, 2];
  </code></pre>
  <p>I have products that have multiple product arrays.</p>
  <pre><code>const products = [
    {
      id: 1,
      name: 'milk',
      qty: 2
    },
    {
      id: 2,
      name: 'butter',
      qty: 2
    },
    {
      id: 3,
      name: 'milk',
      qty: 2
    },
    {
      id: 2,
      name: 'butter',
      qty: 2
    },
    {
      id: 1,
      name: 'milk',
      qty: 2
    },
    {
      id: 3,
      name: 'butter',
      qty: 2
    },
    {
      id: 1,
      name: 'milk',
      qty: 2
    },
    {
      id: 3,
      name: 'butter',
      qty: 2
    }
  ];
  </code></pre>
  <pre><code>
  const groupByKey = 'id';
  </code></pre>
  <p>I need to group the products based on the product's id.</p>
  <pre><code>conditions
  </code></pre>
  <p>i)groupBy should be based on the <code>groupByvalue</code> with <code>groupBykey</code> array (only groupBy 1 , 2)
  ii) after the group it should sum all the qty</p>
  <p><strong>expected</strong></p>
  <pre><code>[
    {
      id: 1,
      name : &quot;milk&quot;, 
      qty : sum of all qty
    },
    {
      id: 2,
      name : &quot;butter&quot;, 
      qty : sum of all qty
    }
  ];
  </code></pre>
  <p>Thanks!!</p>