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

237
Views
Use lodash para filtrar la matriz de objetos y verifique si el valor de la propiedad del objeto existe en otra matriz

Estoy tratando de lograr la siguiente tarea con lodash o JS puro.

Tengo una matriz de objetos que filtro por un valor de propiedad dado

 let res = _.filter(array, {obj.property: "somevalue"}

Ahora tengo otra matriz como [val1, val2,val3] la que quiero comparar las propiedades de la matriz filtrada.

 let res = _.filter(array, {obj.property1: "somevalue", obj.property2: existsInOtherArray}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Puede usar un conjunto y el método de filtro de matriz como:

 const array = [ {property1: 'somevalue'}, {property1: 'somevalue', property2: 'val2'} ] const set = new Set(['val1', 'val2', 'val3']) const res = array.filter(obj => obj.property1 === 'somevalue' && set.has(obj.property2)) console.log(res)

about 4 years ago · Juan Pablo Isaza Report
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!