I have a Map generated from an arbitrary array of objects. An example entry of the Map: { id: 2, parent: 1 } => { id: 2, parent: 1, type: 'any' }.
Now say there is a function that receives the id as a parameter and has to return a value with matching id. From what I understand, the .get method of the Map requires a full object to compare to.
getItem(id) {
//always returns null
return this.treeMap.get({id: id}) || null
}
How could I get an entry from the said Map provided with only one key value to compare to? TIA!