title: updating a deeply nested object in a collection
body: <p>I have a structure like the below - </p>
  
  <pre><code>var a = {
    foo: {
      dates: {'2018-11-29': 2020.55},
      strategies: [
        {
          expiryDate: '2018-11-29',
          projects: [
            {
              expiryDate: '2018-11-29',
              name: 'foo',
              value: 500
            }
          ]
        }
      ]
    },
    bar: {
      dates: {'2018-11-29': 2020.55},
      strategies: [
        {
          expiryDate: '2018-11-29',
          projects: [
            {
              expiryDate: '2018-11-22',
              name: 'bar',
              value: 650
            },
            {
              expiryDate: '2018-11-22',
              name: 'mario',
              value: 700
            }
          ]
        }
      ]
    }
  }
  </code></pre>
  
  <p>I'm trying to figure out a way to be able to easily update the internal <code>projects</code> collection with lodash. But i'm getting an error</p>
  
  <p>i'm trying to do something like this</p>
  
  <pre><code>const finalTransformedData = _.mapValues(
    a,
    (value, key) =&gt; {
      value.strategies.map(strats =&gt;
        strats.projects.map(trade =&gt;
          Object.assign(
            {},
            { trade: 1 },
          ),
        ),
      );
    },
  );
  </code></pre>
  
  <p>but i'm getting the below output - where am i going wrong?</p>
  
  <pre><code>{ foo: undefined, bar: undefined }
  </code></pre>
  
  <p>The example code above is a bit oversimplified but what i'm looking for is to easily manipulate the objects in the projects array somehow - essentially get something like this - replace the object in the array by looping through it and assigning a new object (got from object.assign)</p>
  
  <pre><code>foo: {
      dates: {'2018-11-29': 2020.55},
      strategies: [
        {
          expiryDate: '2018-11-29',
          projects: [
            {
              trade: 1
            }
          ]
        }
      ]
    },
    bar: {
      dates: {'2018-11-29': 2020.55},
      strategies: [
        {
          expiryDate: '2018-11-29',
          projects: [
            {
              trade: 1
            },
            {
              trade: 1
            }
          ]
        }
      ]
    }
  </code></pre>