📜 ⬆️ ⬇️

JS Programming Contest: Email Filters

UPDATE: The results of the competition are published.

Hola again announces a JS programming contest with a solid prize pool:

  1. First place: 1500 USD
  2. Second place: 1000 USD
  3. Third place: 500 USD
  4. Perhaps we will decide to mark someone's extremely original decision with a special prize of 350 USD.
  5. If you send someone a link to this competition, putting our address in the CC, and this person will take the prize, you will receive the same amount as he.

We are looking for talented programmers, so authors of interesting decisions will be invited for interviews.
')


rules


Some of those who remember our previous contests were unhappy that the conditions of the tasks were not clearly formulated, and the participant was required to "guess" what we had in mind. This time the condition is formulated very clearly, and at the disposal of the participants - the reference implementation of the solution. Wins the one whose code will be the fastest, subject to passing tests for correctness.

Competition terms in English are posted on our website . Below is a translation into Russian.


Formulation of the problem


You are developing a filter application system for the mail system. You need to write a module for Node.js that exports one function:

filter(messages, rules)


ASCII 0x20 0x7F .

, , from to , . ; * (0 ) , ? — . from to , *. , from to, .

, , . filter , . action , , rules. , .


filter:

filter({
    msg1: {from: 'jack@example.com', to: 'jill@example.org'},
    msg2: {from: 'noreply@spam.com', to: 'jill@example.org'},
    msg3: {from: 'boss@work.com', to: 'jack@example.com'}
}, [
    {from: '*@work.com', action: 'tag work'},
    {from: '*@spam.com', action: 'tag spam'},
    {from: 'jack@example.com', to: 'jill@example.org', action: 'folder jack'},
    {to: 'jill@example.org', action: 'forward to jill@elsewhere.com'}
])


filter :

{
    msg1: ['folder jack', 'forward to jill@elsewhere.com'],
    msg2: ['tag spam', 'forward to jill@elsewhere.com'],
    msg3: ['tag work']
}



filter http://hola.org/challenge_mail_filter/reference. . ( ). , , . , , , .

, 10 10 . .

HTTP- POST application/json. : messages rules, — filter. , JSON, , . HTTP 400 text/plain.

!

Source: https://habr.com/ru/post/270847/


All Articles