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

120
Views
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 answers
Answer question

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 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!