A Roc implementation of semver 2.0.0.
Many thanks to the Rust implementation here by David Tolnay.
import semver.Semver
import semver.VersionReq
versionRes = Semver.parse "1.2.3-alpha.beta+build--"
versionReqRes = VersionReq.parse ">=1.2.3-alpha.beta, <2"
expect
versionRes == Ok {
major: 1,
minor: 2,
patch: 3,
preRelease: ["alpha", "beta"],
build: ["build--"],
}
expect
when (versionRes, versionReqRes) is
(Ok version, Ok versionReq) ->
versionReq |> VersionReq.matches version
_other -> Bool.false