2023-01-19 13:53:24 +01:00
|
|
|
// Thanks https://gist.github.com/iwill/a83038623ba4fef6abb9efca87ae9ccb
|
2019-07-16 11:33:22 +02:00
|
|
|
function compareSemVer (a: string, b: string) {
|
2023-01-19 13:53:24 +01:00
|
|
|
if (a.startsWith(b + '-')) return -1
|
|
|
|
if (b.startsWith(a + '-')) return 1
|
2019-07-16 11:33:22 +02:00
|
|
|
|
2023-01-19 13:53:24 +01:00
|
|
|
return a.localeCompare(b, undefined, { numeric: true, sensitivity: 'case', caseFirst: 'upper' })
|
2019-07-16 11:33:22 +02:00
|
|
|
}
|
|
|
|
|
2019-04-24 15:10:37 +02:00
|
|
|
export {
|
2021-12-17 11:58:15 +01:00
|
|
|
compareSemVer
|
2019-04-24 15:10:37 +02:00
|
|
|
}
|