English
core/charts/semver.ts
Generated from the exports of core/charts/semver.ts · npm run docs:gen
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: >=, >, <=, <, =, 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 interface
ts
interface Version { major: number; minor: number; patch: number; pre: string[]; build?: string }VERSION_PATTERN const
ts
const VERSION_PATTERN = VERSION_RE.sourceparseVersion function
ts
function parseVersion(v: unknown): Version | nullisVersion const
ts
const isVersion = (v: unknown) => …compare function
-1, 0 or 1; the build is ignored. Throws on a malformed version.
ts
function compare(a: string | Version, b: string | Version): numberComparator interface
ts
interface Comparator { op: Op; v: Version }parseRange function
The comparators of a range, or null when it is not in the grammar.
ts
function parseRange(r: unknown): Comparator[] | nullisRange const
ts
const isRange = (r: unknown) => …satisfies function
Does a version satisfy a range? A malformed range or version never does.
ts
function satisfies(version: string, range: string): booleanhighest function
The highest version of a list that satisfies a range, or undefined.
ts
function highest(versions: readonly string[], range: string): string | undefined