I am working with an array of objects that looks like this:
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 my goal is to transform it into an object structured as follows:
{
USD:
{
buy:1.5781,
sell:1.6484,
},
EUR:
{
buy:1.948,
sell:1.963,
},
GBP:
{
buy:2.1184,
sell:2.1894,
}
}
Currently, I am manually assigning the values, but I believe there must be a more efficient and scalable approach.