(array, entry)
| 26 | } |
| 27 | |
| 28 | function pushUnique(array, entry) { |
| 29 | const index = array.indexOf(entry); |
| 30 | |
| 31 | if (index > -1) { |
| 32 | // the entry already exists in the array, but since the presedence between |
| 33 | // addons is "last right wins". We first remove the duplicate entry, and |
| 34 | // append it to the end of the array. |
| 35 | array.splice(index, 1); |
| 36 | } |
| 37 | |
| 38 | // At this point, the entry is not in the array. So we must append it. |
| 39 | array.push(entry); |
| 40 | |
| 41 | // All this ensures: |
| 42 | // pushUnique([a1,a2,a3], a1) |
| 43 | // results in: |
| 44 | // |
| 45 | // [a2, a3, a1] |
| 46 | // |
| 47 | // which results in the most "least surprising" addon ordering. |
| 48 | } |
| 49 | |
| 50 | /** |
| 51 | * Class that stores information about a single package (directory tree with |
no outgoing calls
no test coverage detected
searching dependent graphs…