title: Map and reduce array of objects with a children array down to array of children with parent's id
body: <p>I'm  trying to take an array of objects like this</p>
  
  <pre><code>[
    {
      "id": "uniqueParentId1",
      "children": [
        {
          "childProp1": "test1",
          "childProp2": "test3"
        }
      ]
    },
    {
      "id": "uniqueParentId2",
      "children": [
        {
          "childProp1": "somevals",
          "childProp2": "other vals"
        },
        {
          "childProp1": "somevals 1",
          "childProp2": "other vals 1"
        }
      ]
    }
  ]
  </code></pre>
  
  <p>And return an array of all the children combined, with each child object having an additional value, the "id" of the parent.</p>
  
  <p>Above examples, result.</p>
  
  <pre><code>[
    {
      "parentId": "uniqueParentId1",
      "childProp1": "test1",
      "childProp2": "test3"
    },
    {
      "parentId": "uniqueParentId2",
      "childProp1": "somevals",
      "childProp2": "other vals"
    }
    {
      "parentId": "uniqueParentId2",
      "childProp1": "somevals 1",
      "childProp2": "other vals 1"
    }
  ]
  </code></pre>
  
  <p>I'm just not sure how to approach this. I'm familiar with flattening and array of arrays. But I'm only able to get the output as an array of the original children without adding the parentId</p>