This commit is contained in:
shamoon committed 2026-11-19 22:50:48 -08:00
1 parent b6a85dcb13
commit ec1cdf9855
1 file changed
+2 -2
+2 -2
View File
@@ -3,8 +3,8 @@
* Returns a positive number if a > b, negative if a < b, 0 if equal.
*/
export function compareVersions(a: string, b: string): number {
const partsA = a.split('.').map((p) => parseInt(p, 10) || 0)
const partsB = b.split('.').map((p) => parseInt(p, 10) || 0)
const partsA = a.split('.').map((p) => Number.parseInt(p, 10) || 0)
const partsB = b.split('.').map((p) => Number.parseInt(p, 10) || 0)
for (let i = 0; i < Math.max(partsA.length, partsB.length); i++) {
const diff = (partsA[i] ?? 0) - (partsB[i] ?? 0)
if (diff !== 0) return diff