I have couple of arrays that contain individual objects as represented below. I'd like to merge these 2 structures in a single one:
Changes
An array of changes which definition is:
{
app_name: "App 1"
2017: {fYear: 2017, changesCount: 37},
2018: {fYear: 2018, changesCount: 10}
}
Issues
An array of issues which definition is
{
app_name: "App 1",
2018: {fYear: 2018, all: 10, typeA: 1, typeB:5, TypeC: 1}
}
End result
Looking for an array of merged objects, each object being the merge of a Change and an Issue:
{
app_name: "App 1"
2017: {fYear: 2017, changesCount: 37},
2018: {fYear: 2018, changesCount: 10, all: 10, typeA: 1, typeB:5, TypeC: 1}
}
I can do a loop of course but seems not the best to me so I've been trying to look into the map & reduce functions but so far no luck.
Any recommendation?
Thank you!