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

148
Views
How to filter mapped array items within a object?

I have a table, which displays a list of Approved Attachments along with their document type in a table section called 'Attachments'. Which is part of a much larger tableData object.

These attachments have a property of `'isApproved' (along with .name & .typeName), I only want to display the properties where this is true, however I'm not sure how to filter the below code to say 'where x.isApproved === true' for example.

attachments: {
              name: data.attachments.map((x) => x.name).join(','),
              documentGroup: data.attachments.map((x) => x.typeName).join(','),
             },
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Adding a filter in the beginning of the chain should do the trick

attachments: {
  name: data.attachments.filter(x => x.isApproved).map((x) => x.name).join(','),
  documentGroup: data.attachments.filter(x => x.isApproved).map((x) => x.typeName).join(','),
},
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!