I am using the following firebase function
this.sensorService.getTest()
.snapshotChanges()
.pipe(
map(actions =>
actions.map(a => ({
[a.payload.key]: a.payload.val()
})))
).subscribe(sensors => {
this.sensors = sensors;
console.log(this.sensors);
});
The data is currently being returned to separate arrays, and the console log displays the following:
0: {groups: Array(8)}1: {links: Array(35)}2: {nodes: Array(35)}
I am looking for a way to merge all these arrays together and consolidate them into one object. Upon doing so, the console log should return:
{groups: Array(8), nodes: Array(35), links: Array(35)}