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