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

179
Vistas
How to use lodash to filter array and objects

Is there a better way for me to code this. The current code works, but I am looking for better way to code. Code must use lodash. I figure they may be a way to filter where I don't have to create 2 filters then join it together

const overwriteExisting = () => {
    // get data that does not have midiChannl = 5
    const filtered1 = filter(data, function (o) {
      return o.midiChannl !== 5;
    });

    // filter out everything that does not have same midiValue hello2
    const filtered2 = filter(dataWithoutCurrentUUID, function (o) {
      return (
       
        o.midiValue !== 'hello2';
      );
    });

    const joinAll = concat(filtered1, filtered2);
    console.log(joinAll)
}

{
    midiType: 1,
    midiValue: "hello",
    midiChannl: 5
},
{
    midiType: 10,
    midiValue: "hello2",
    midiChannl: 4
},
{
    midiType: 100,
    midiValue: "hello2",
    midiChannl: 4
},
{
    midiType: 1000,
    midiValue: "hello4",
    midiChannl: 4
}
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Would this work? It is not clear if the filters are applied to the same data array.

const overwriteExisting = () => {
    // get data that does not have midiChannl = 5 and does not have same midiValue hello2
    const filtered = filter(data, o =>
      o.midiChannl !== 5 && o.midiValue !== 'hello2'
    );

    console.log(filtered)
}
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