Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

286
Views
Get an entry from Map which has objects as keys, with partial comparison

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!

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!