I have two Array of objects [{id:'KS001', name: 'albedo'}] this is the first array which consist of 900+ objects.
{
"changePoints": [
{
"Point": {
"name": "001",
"id": "KS001",
"siteID": "258628",
"connectorGroups": [
{
"connectorGroupID": 1,
"connectors": [
{
"connectorID": "1",
"connectorStatus": "AVAILABLE"
}
]
},
{
"connectorGroupID": 2,
"connectors": [
{
"connectorID": "2",
"connectorStatus": "AVAILABLE"
}
]
}
]
}
},
],
}
this is the second array that contains objects which have a point and id this id map with the first array as an identifier I need to check each connectorStatus in the second array with the corresponding id and add a new key to the first array status set "AVAILABLE" else not "NOT AVAILABLE"
I need to find the fastest way to do this
const object1 = {
name: 'Flavio'
}
const object2 = {
age: 35
}
const object3 = {...object1, ...object2 } //{name: "Flavio", age: 35}
const a = { b: 1, c: 2 };
const d = { e: 1, f: 2 };
const ad = { ...a, ...d }; // { b: 1, c: 2, e: 1, f: 2 }