Here is an example array I have:
[
{
data: [
{ a: "a", b: "b" },
{ x: "x", y: "y" },
],
},
{
data: [
{ c: "c", d: "d" },
{ z: "z", f: "f" },
],
},
{
data: [
{ d: "d", e: "e" },
{ g: "g", h: "h" },
],
},
];
I am looking to merge all items in the 'data' arrays into one single array, resulting in:
[
{ a: "a", b: "b" },
{ x: "x", y: "y" },
{ c: "c", d: "d" },
{ z: "z", f: "f" },
{ d: "d", e: "e" },
{ g: "g", h: "h" },
];
I prefer not to use lodash as suggested in other questions, and would like to achieve this using only ES6 features.