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

119
Vistas
How create a spam filter in express.js or how to filter objects based on the word in the key values?

I want create simple spam filter. I dont have an inbox yet but I was thinking when the emails are recived I could make a GET request and filter the object based on the words mentioned in the message. If the posted object is

[{"id":"1" "email":"xyz@gmail.com", "cc": "abc@gmail.com",
"message": "You have a chance to win a lottery and be a millionaire" },

{"id":"1" "email":"qwet@gmail.com", "cc": "ghj@gmail.com",
"message": "hello how are you doing" } ]

I want to filter the object with id===1 that contains a combination of words "lottery","win","millionaire" in the message

I have come across Naive Bayes spam filtering algorithm but I don't know how to integrate it with Express.

Any help is appreciated.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

you can do this way by using filter()

posted_object.filter(
  (item) => item.id != 1 || !item.message.includes("lottery") || !item.message.includes("win") || !item.message.includes("millionaire")
);
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