I have the following object:
{
"thumbnail": {
"height": 150,
"width": 150,
},
"medium": {
"height": 165,
"width": 300,
},
"large": {
"height": 352,
"width": 640,
}
}
I want to create the following array from the object.
[
{
"slug": "thumbnail",
"name": "Thumbnail"
},
{
"slug": "medium",
"name": "Medium"
},
{
"slug": "large",
"name": "Large"
},
{
"slug": "full",
"name": "Full"
}
]
How can I get the object key name to add to the array? I tried the following:
map( imageSizesArray,
( { key } ) => ( { value: key, label: key.toUpperCase() } )
);
but it does not work