Skip to content

semver

Semantic version parsing, comparison, and constraint matching.

Functions

bump_major

semver::bump_major(v) -> string

Increment major; zero minor and patch; clear pre-release and build.

bump_minor

semver::bump_minor(v) -> string

Increment minor; zero patch; clear pre-release and build.

bump_patch

semver::bump_patch(v) -> string

Increment patch (or strip pre-release if present); clear build.

compare

semver::compare(a, b) -> int

Three-way ordering: returns -1 / 0 / 1.

eq

semver::eq(a, b) -> bool

True if a and b are the same version (including pre-release).

format

semver::format(version) -> string

Render a version (string or dict) back to its canonical string form.

gt

semver::gt(a, b) -> bool

True if a > b.

gte

semver::gte(a, b) -> bool

True if a >= b.

is_valid

semver::is_valid(s) -> bool

True if the string parses as a valid semantic version.

lt

semver::lt(a, b) -> bool

True if a < b.

lte

semver::lte(a, b) -> bool

True if a <= b.

parse

semver::parse(s) -> dict

Parse a version string into #{major, minor, patch, pre, build}. Errors on invalid input.

satisfies

semver::satisfies(version, req) -> bool

True if version matches the requirement string (e.g. ^1.0, ~1.2, >=1.0, <2.0).

Documentation reflects Ion v0.2.0-66-g3faa376.