I have some data that looks like this:
[
{
"name": "carrot",
"type": "veg"
},
{
"name": "raspberry",
"type": "berry"
},
{
"name": "apple",
"type": "fruit"
},
{
"name": "pear",
"type": "fruit"
},
]
I would like to convert the data into just a set of the types so I can range over that set. In JS I’ve been doing something similar to this:
const typeSet = new Set()
array.forEach(item => typeSet.add(item.type))
Then creating the markup in JavaScript, but this is less than ideal
I’ve tried to use .Scratch.SetInMap
to just use the map keys, but I’ve been limited by the scoping. Maybe I’ve just not been searching for the right thing and there is a way