I have an array:
const arr = [
{
countries : {countryCode :"US", value: true},
vendors: [{vendorName: 'TES', value: true}, {vendorName: 'HPEFS', value: true}]
},
{
countries : {countryCode :"CA", value: true},
vendors: [{vendorName: 'TES', value: true}, {vendorName: 'HPEFS', value: false}]
}
];
expected result: [{vendor: "TES", countries: [US, CA]}, {vendor: "HPEFS", countries: [US]}]
Any idea is appreciated, Thanks in advance