(left: string, right: string)
| 36 | }; |
| 37 | |
| 38 | export const compareUpdateVersions = (left: string, right: string): number | null => { |
| 39 | const leftParts = parseVersionParts(left); |
| 40 | const rightParts = parseVersionParts(right); |
| 41 | if (!leftParts || !rightParts) return null; |
| 42 | const length = Math.max(leftParts.length, rightParts.length); |
| 43 | for (let index = 0; index < length; index += 1) { |
| 44 | const l = leftParts[index] ?? 0; |
| 45 | const r = rightParts[index] ?? 0; |
| 46 | if (l !== r) return l > r ? 1 : -1; |
| 47 | } |
| 48 | return 0; |
| 49 | }; |
| 50 | |
| 51 | const isNewerUpdateVersion = (incomingVersion: string, declinedVersion: string): boolean => { |
| 52 | const comparison = compareUpdateVersions(incomingVersion, declinedVersion); |
no test coverage detected