title: merge nested objects in lodash
body: <p>I have a nested Object: (Example of the form)</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 result = { '1':
     { 'a':
        [ { id: '1',
            sndid: 'a',
            type: 'ios',
            value: '55',
            weight: 2
          },
          { id: '1',
            sndid: 'a',
            sumvalue: 2 },
          { id: '1',
            sndid: 'a'},
          { id: '1',
            sndid: 'a',
            calcsum: '3' } ],
       '2':
        [ { id: '1',
            sndid: 'b',
            type: 'ios',
            value: '55',
            weight: 3
           },
          { id: '1',
            sndid: 'b',
            sumvalue: 3 },
          { id: '1',
            sndid: 'b'},
          { id: '1',
            sndid: 'b',
            calcsum: '7' } ] },
    '3':
     { 'a':
        [ { id: '3',
            sndid: 'a',
            type: 'ios',
            value: '55',
            weight: 23},
          { id: '3',
            sndid: 'a',
            sumvalue: 4 },
          { id: '3',
            sndid: 'a',
            sumvalue_old: '4' },
          { id: '3',
            sndid: 'a',
            calcsum: '5' } ] },    
  }
  
  const assignedobject = {};
  
   _.forEach(result, (values) =&gt; {
      _.forEach(values, (vals) =&gt; {
        _.forEach(vals, (val) =&gt; {
        _.assign(assignedobject, val);
        });
      });
    });
  
  console.log(assignedobject)</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.10/lodash.min.js"&gt;&lt;/script&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>With the Values in this Object I want to calc multiple values. Before that I want to transforme this Object into a (more readable) Object. </p>
  
  <p>Every <strong>"id"</strong> have multiple <strong>"sndid"</strong>. So I want to group the Object by <strong>"id"</strong> and <strong>"sndid"</strong>. </p>
  
  <p>(For example the transformed Object should have this structure) </p>
  
  <pre><code>  { id: '1',
    sndid: 'a',
    type: 'ios',
    values: '22',
    sumvalue: 8,
    weight: 20,
    calcsum: 2
    },
    { id: '1',
    sndid: 'b',
    type: 'ios',
    values: '22',
    sumvalue: 8,
    weight: 20,
    calcsum: 2
    },
    { id: '2',
    sndid: 'a',
    type: 'ios',
    values: '22',
    sumvalue: 8,
    weight: 20,
    calcsum: 2}
  </code></pre>
  
  <p>I tried to loop into all nested objects and assign it to a new object. But he just push the last loop into my Object. Also the code looks badly.</p>
  
  <p>The result is like above the example but he only take the last object.</p>