# `core/charts/semver.ts`

<p class="generated-note">Generated from the exports of <a href="https://github.com/altasystem-ai/alta/blob/main/core/charts/semver.ts"><code>core/charts/semver.ts</code></a> · <code>npm run docs:gen</code></p>

Versions and ranges of alta.chart/0.1 (docs/standards/alta-chart-0.1.md §7). Pure. A version is semver: MAJOR.MINOR.PATCH, an optional pre-release (-rc.1) and build (+sha). A range is one comparator or several separated by a space, all of which must hold: &gt;=, &gt;, &lt;=, &lt;, =, and the shorthands ^1.2.3 (same major) and ~1.2.3 (same minor). No `||`, no `*`, no `x`. A pre-release only matches a range that names a pre-release of the same MAJOR.MINOR.PATCH.

**Standards that cite this file**: No standard page cites this file yet.

## Exports

### `Version` 
```ts
interface Version { major: number; minor: number; patch: number; pre: string[]; build?: string }
```

### `VERSION_PATTERN` 
```ts
const VERSION_PATTERN = VERSION_RE.source
```

### `parseVersion` 
```ts
function parseVersion(v: unknown): Version | null
```

### `isVersion` 
```ts
const isVersion = (v: unknown) => …
```

### `compare` 
-1, 0 or 1; the build is ignored. Throws on a malformed version.

```ts
function compare(a: string | Version, b: string | Version): number
```

### `Comparator` 
```ts
interface Comparator { op: Op; v: Version }
```

### `parseRange` 
The comparators of a range, or null when it is not in the grammar.

```ts
function parseRange(r: unknown): Comparator[] | null
```

### `isRange` 
```ts
const isRange = (r: unknown) => …
```

### `satisfies` 
Does a version satisfy a range? A malformed range or version never does.

```ts
function satisfies(version: string, range: string): boolean
```

### `highest` 
The highest version of a list that satisfies a range, or undefined.

```ts
function highest(versions: readonly string[], range: string): string | undefined
```
