UNPKG

740 BJavaScriptView Raw
1module.exports = {
2 exact: list => list.filter(m => m.match(/^[^*!]+$/)),
3 contain: list =>
4 list.filter(m => m.match(/^\*.+\*$/)).map(m => m.substr(1, m.length - 2)),
5 endWith: list => list.filter(m => m.match(/^\*[^*]+$/)).map(m => m.substr(1)),
6 startWith: list =>
7 list.filter(m => m.match(/^[^*!]+\*$/)).map(m => m.substr(0, m.length - 1)),
8 notExact: list =>
9 list.filter(m => m.match(/^![^*].*$/)).map(m => m.substr(1)),
10 notContain: list =>
11 list.filter(m => m.match(/^!\*.+\*$/)).map(m => m.substr(2, m.length - 3)),
12 notEndWith: list =>
13 list.filter(m => m.match(/^!\*[^*]+$/)).map(m => m.substr(2)),
14 notStartWith: list =>
15 list.filter(m => m.match(/^![^*]+\*$/)).map(m => m.substr(1, m.length - 2))
16};