I have an array of objects, where each object has a "standings" property (example data below). I want to flatten the standings array and add it to the end of the parent object.
[{
name: "Entry 1",
value: 0,
standings: [{
week: 1,
team: 'MIN'
}, {
week: 2,
team: 'NE'
}, {
week: 3,
team: null
}]
}, {
name: "my Other Entry",
value: 3,
standings: [{
week: 1,
team: 'BUF'
}, {
week: 2,
team: 'CIN'
}, {
week: 3,
team: 'TB'
}]
}];
How can I get:
[{name: "Entry 1", value: 0, w1: 'MIN', w2: 'NE', w3: null},
{name: "my Other Entry", value: 3, w1: 'BUF', w2: 'CIN', w3: 'TB'}]
I was thinking some variation of flatten?