Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

294
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda