(raw: string)
| 66 | // --- Version comparison --- |
| 67 | |
| 68 | export function parseVersion(raw: string): ParsedVersion | undefined { |
| 69 | const stripped = raw.startsWith('v') ? raw.slice(1) : raw; |
| 70 | const match = stripped.match(/^(\d+)\.(\d+)\.(\d+)(?:-([a-zA-Z0-9.-]+))?(?:\+[a-zA-Z0-9.-]+)?$/); |
| 71 | if (!match) return undefined; |
| 72 | return { |
| 73 | major: Number(match[1]), |
| 74 | minor: Number(match[2]), |
| 75 | patch: Number(match[3]), |
| 76 | prerelease: match[4], |
| 77 | }; |
| 78 | } |
| 79 | |
| 80 | function comparePrereleaseIdentifiers(a: string, b: string): number { |
| 81 | const aParts = a.split('.'); |
no outgoing calls
no test coverage detected