• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

89
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 3 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 3 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 Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error