Provides basic functionality for handling semantic version numbers. Follows the Semver 2.0.0 standard strictly. No loose mode, no prefixes to version numbers.
For the definition of semantic versioning with Semver 2.0.0, see http://semver.org.
{ major : Basics.Int
, minor : Basics.Int
, patch : Basics.Int
, prerelease : List String
, build : List String
}
Represents a version with major, minor and patch number, as well as optionally a prerelease version and build metadata.
version : Basics.Int -> Basics.Int -> Basics.Int -> List String -> List String -> Version
Creates a version.
isValid : Version -> Basics.Bool
Checks whether a version is valid according to the specification.
compare : Version -> Version -> Basics.Order
Compares two versions for precedence.
Implements the ordering procedure defined in Semver 2.0.0.
lessThan : Version -> Version -> Basics.Bool
Shorthand for determining whether versionA
precedes versionB
.
greaterThan : Version -> Version -> Basics.Bool
Shorthand for determining whether versionA
is preceded by versionB
.
print : Version -> String
Produce a version's string representation.
The output format is such that
v |> print |> parse == v
parse : String -> Maybe Version
Parses a version string.
Parsing fails if the string is not legal according to Semver 2.0.0.
Does not accept loose syntax or prefixes ('v') to the version string.