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

135
Views
Return an entire object where filter and includes matches

I currently have several objects like so:

// not correct syntax just showing what members is
       const members = "-Lz8YxIL-XJotORQ3Bk1": Object {
            "address": "14539 Fasdfadsfrd Ave",
            "bDay": "10/01/2004",
            "city": "Norwalk",
            "email": "wasdfsadfga2@yahoo.com",
            "first": "Frank",
        }, ...

I also have an object with a few UIDs like so:

const attendanceGroup.members =  {
  "-MxQvetKWRGNVO6EWIko": "-Lz8YxHiwp8QZW3TqAFn",
  "-MxSvxI-D53qlXtp1nzT": "-Lz8YxHiwp8QZW3TqAFn",
}

I would like to get the object returned of each object where the uid matches. I'm doing it like so:

  const groupMembers = Object.keys(members).filter(item => {
    return Object.values(attendanceGroup.members).includes(item);
  });

But this only returns the keys of the matching uid. I would like the whole object. How can I accomplish this?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Object.entries will give you the key, value pairs:

const attendanceGroupMembers = new Set(Object.values(attendanceGroup.members));
const groupMembers = Object.entries(members)
  .filter(([key]) => attendanceGroupMembers.has(key))
  .map(([_, members]) => members);
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!