(a: string, b: string)
| 91 | } |
| 92 | |
| 93 | export function customSemverCompare(a: string, b: string) { |
| 94 | [a, b] = [a.toLowerCase(), b.toLowerCase()]; |
| 95 | |
| 96 | // 'next' always bubbles to the front of the list |
| 97 | if ([a, b].includes('next')) { |
| 98 | return a === 'next' ? -1 : 1; |
| 99 | } |
| 100 | |
| 101 | const [majorA, minorA] = a.split('.').map(Number); |
| 102 | const [majorB, minorB] = b.split('.').map(Number); |
| 103 | |
| 104 | if (majorA === majorB) { |
| 105 | if (minorA === minorB) { |
| 106 | return 0; |
| 107 | } |
| 108 | return minorB > minorA ? 1 : -1; |
| 109 | } |
| 110 | |
| 111 | return majorB > majorA ? 1 : -1; |
| 112 | } |
no test coverage detected