There has been a change in the data structure.
- We have more information about the messages: email address of the messages (from) and subject.
- Rules can apply to the from field or to the subject
This means that the filter function should filter out messages if any of the two conditions are given:
- the subject matches the "subject" fiter rule
- the from matches the "from" filter rule.
The interface of the demo app remains the same.
var rules = [{
from : "spam.com"
},
{
from : "compratutto.it"
},
{
subject : "special offer"
}];
var msgs = [{
from : "[email protected]",
subject : "we have a special offer for you"
},
{
from : "[email protected]",
subject : "let's meet on monday"
},
{
from : "[email protected]",
subject : "xmas is near"
},
{
from : "[email protected]",
subject : "exam on tuesday"
},
{
from : "[email protected]",
subject : "special offers just for you"
}];
MailModel.init()
MailModel.filter()
-> ["[email protected]", "[email protected]"]