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

112
Vistas
Search nested JS object using object-scan lib to find grand parent elements

Using Object-Scan JS lib, want to find all the grand parent elements that have key "referenceField". Any help is much appreciated.

JS Fiddle Link

const find = (item, input) => objectScan(['**'], {
    abort: true,
    rtn: 'parent',
    filterFn: ({
      key
    }) => key === item.key
  })(input);

console.log(find('referenceField', data));

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Object-scan was somehow not returning grand parent using gparent option, but based on the assumption that your properties will always have the same nesting, you can take help of parents option and change your code to this-

const find = (item, input) => objectScan([`**.${item}`], {
    abort: true,
    rtn: 'parents'
})(input)[1];
about 4 years ago · Juan Pablo Isaza Denunciar
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