# VersionUtils

**Kind:** Class

**Source:** [`atloria-monorepo/libs/parser-core/src/generators/versioning/version-config.ts`](https://github.com/sherkety/atloria/blob/main/atloria-monorepo/libs/parser-core/src/generators/versioning/version-config.ts#L65)

Version utilities

## Methods

| Method | Signature | Returns |
|---|---|---|
| `parseVersion` | `parseVersion(version: string)` | `[number, number, number] | null` |
| `compare` | `compare(a: string, b: string)` | `VersionComparison` |
| `sort` | `sort(versions: VersionInfo[], ascending: undefined)` | `VersionInfo[]` |
| `findLatest` | `findLatest(versions: VersionInfo[], includePrerelease: undefined)` | `VersionInfo | null` |
| `isPrerelease` | `isPrerelease(version: string)` | `boolean` |
| `isEOL` | `isEOL(version: VersionInfo)` | `boolean` |
| `generateLabel` | `generateLabel(version: VersionInfo, isLatest: boolean)` | `string` |
| `groupByMajor` | `groupByMajor(versions: VersionInfo[])` | `Map<number, VersionInfo[]>` |
| `getBadgeColor` | `getBadgeColor(version: VersionInfo)` | `string` |

## Where it refuses work

- `VersionUtils` stops the work with an early return when `parts.length !== 3`.
- `VersionUtils` stops the work with an early return when `isNaN(major) || isNaN(minor) || isNaN(patch)`.
- `VersionUtils` stops the work with an early return when `!versionA || !versionB`.
- `VersionUtils` stops the work with an early return when `versionA[i] < versionB[i]`.
- `VersionUtils` stops the work with an early return when `versionA[i] > versionB[i]`.
- `VersionUtils` stops the work with an early return when `candidates.length === 0`.
