Skip to content

smores56/roc-semver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

roc-semver

A Roc implementation of semver 2.0.0.

Many thanks to the Rust implementation here by David Tolnay.

Example

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