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

1.4K
Views
¿Cómo puedo almacenar y filtrar objetos JSON grandes (más de 70 000)?
const users = [ {id:1, email:"abc@email.com"}, {id:2, email:"xyz@email.com"}, {....}(~70,000 objects) ] function a(){ const id = 545 users.filter((value)=>{ if(value.id === id) return true }) }

Tenemos 70.000 objetos de usuarios. necesitamos filtrar el correo electrónico según la identificación.

usuarios = [{id: '1001', correo electrónico: "abc@gmail.com"}, {{id: '1002', correo electrónico: "spc@gmail.com"} , ..];

Usar array y array.filter() termina en el error. Error

¿Cuál es la mejor manera de abordar esto?

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

0

Puede ser mejor convertir su matriz en un mapa para que se puedan realizar búsquedas sin escanear toda la matriz. Como tal:

 const lookupMap = new Map(users.map((u) => [u.id, u]));

así que ahora puedes

 const user = lookupMap.get(userId)

sin tener que escanear los 70000 objetos de usuario.

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!