]>
Commit | Line | Data |
---|---|---|
6e06694f | 1 | // Thanks https://gist.github.com/iwill/a83038623ba4fef6abb9efca87ae9ccb |
6702a1b2 | 2 | function compareSemVer (a: string, b: string) { |
6e06694f C |
3 | if (a.startsWith(b + '-')) return -1 |
4 | if (b.startsWith(a + '-')) return 1 | |
6702a1b2 | 5 | |
6e06694f | 6 | return a.localeCompare(b, undefined, { numeric: true, sensitivity: 'case', caseFirst: 'upper' }) |
6702a1b2 C |
7 | } |
8 | ||
7c3b7976 | 9 | export { |
c55e3d72 | 10 | compareSemVer |
7c3b7976 | 11 | } |