Given an object like this:
{
aaa: {
text: "Text1",
path: "Path1",
type: "Type1"
},
bbb: {
text: "Text2",
path: "Path2",
type: "Type2"
},
...
}
What is the simplest way to return this array:
[
{value: "aaa", label: "Text1"},
{value: "bbb", label: "Text2"}
]
Do I have to loop through the object? I thought there might be a way with Object.keys() and Object.values()
Object.entries()could help here