I want to get an object on the basis on ids.I am having object containing key value pairs. Values are in array of objects and i need to manipulate it to get desired result.
This is simple javascript that needs to be manipulated
let myObject = {
12 : [{
isAmber : true,
isBreached : false ,
priority:"High"
},
{
isAmber : false,
isBreached : true ,
priority:"Medium"
}
],
14 : [{
isAmber : false,
isBreached : false ,
priority:"High"
},
{
isAmber : false,
isBreached : true ,
priority:"Low"
}
]
}
Condition : 1)if isAmber == false && isBreached == true result should be "Red"
2)if isAmber == true && isBreached == false result should be "Amber"
3)if isAmber == false && isBreached == false result should be "Green"
I want output like this
{
12 : {
status : ["Amber","Red"],
priority:["High","Medium"]
},
14 : {
status : ["Green","Red"] ,
priority:["High","Low"]
}
}