I have the following array of objects
const sorted = [
{
IsoCode: "EUR",
Buy: 1.948,
Sell: 1.963
},
{
IsoCode: "GBP",
Buy: 2.1184,
Sell: 2.1894
},
{
IsoCode: "USD",
Buy: 1.5781,
Sell: 1.6484
},
]
and I want to create an Object looking like this
{
USD:
{
buy:1.5781,
sell:1.6484,
},
EUR:
{
buy:1.948,
sell:1.963,
},
GBP:
{
buy:2.1184,
sell:2.1894,
}
}
Currently I'am assigning the values manually, but I don't think this is scalable. I'm looking for more effective approach.
reduce().