Replace version page with supply event page

This commit is contained in:
Sakura Knoll
2021-12-27 23:26:24 +09:00 Unverified
parent 9cd2f1a5ce
commit 123ac57643
38 changed files with 551 additions and 460 deletions
+22
View File
@@ -0,0 +1,22 @@
export function isVersionString(version: string): boolean {
return /[0-9]+\.[0-9]+(\.[0-9]+)?/.test(version)
}
export function compareVersion(aVersion: string, bVersion: string): number {
const [aMajor, aMinor = '0', aPatch = '0'] = aVersion.split('.')
const [bMajor, bMinor = '0', bPatch = '0'] = bVersion.split('.')
let result = parseInt(aMajor, 10) - parseInt(bMajor, 10)
if (result !== 0) {
return result
}
result = parseInt(aMinor, 10) - parseInt(bMinor, 10)
if (result !== 0) {
return result
}
return parseInt(aPatch, 10) - parseInt(bPatch, 10)
}