main
Last change
on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 4 days ago |
F4 Finalna Verzija
|
-
Property mode
set to
100644
|
File size:
397 bytes
|
Line | |
---|
1 | function ruleSorter(s1, s2) {
|
---|
2 | return s1[1] > s2[1] ? 1 : -1;
|
---|
3 | }
|
---|
4 |
|
---|
5 | function tidyRuleDuplicates(rules) {
|
---|
6 | var list = [];
|
---|
7 | var repeated = [];
|
---|
8 |
|
---|
9 | for (var i = 0, l = rules.length; i < l; i++) {
|
---|
10 | var rule = rules[i];
|
---|
11 |
|
---|
12 | if (repeated.indexOf(rule[1]) == -1) {
|
---|
13 | repeated.push(rule[1]);
|
---|
14 | list.push(rule);
|
---|
15 | }
|
---|
16 | }
|
---|
17 |
|
---|
18 | return list.sort(ruleSorter);
|
---|
19 | }
|
---|
20 |
|
---|
21 | module.exports = tidyRuleDuplicates;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.