[CodeHealth] Simplify code as follow-up to #4354 (#4400)

This commit is contained in:
filtered
2025-07-10 06:08:33 +10:00
committed by Terry Jia
parent 68fe1ca4f5
commit ec38957c36
4 changed files with 52 additions and 31 deletions

View File

@@ -386,8 +386,10 @@ export const downloadUrlToHfRepoUrl = (url: string): string => {
}
}
export const isSemVer = (version: string) => {
const regex = /^(\d+)\.(\d+)\.(\d+)$/
export const isSemVer = (
version: string
): version is `${number}.${number}.${number}` => {
const regex = /^\d+\.\d+\.\d+$/
return regex.test(version)
}