I want to create this function:
const hasObject = (myObjectSet: Set<MyObject>) => {
if (myObjectSet.size === 0) {
return false
}
// test if there is an object with id 4
}
The equivalent of some for an array.
EDIT
I made it like this at the end:
const hasObject = (myObjectSet: Set<MyObject>) => {
if (myObjectSet.size === 0) {
return false
}
let result = false
myObjectSet.forEach((myObject) => {
if(myObject.id === 4) {
result = true
}
})
return result
}