Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/smores56/roc-semver

Roc implementation of Semantic Versioning
https://github.com/smores56/roc-semver

roc-lang semver

Last synced: 3 months ago
JSON representation

Roc implementation of Semantic Versioning

Awesome Lists containing this project

README

        

roc-semver
==========

A [Roc](https://roc-lang.org) implementation of [semver 2.0.0](https://semver.org/).

Many thanks to the [Rust](https://rust-lang.org) implementation [here](https://github.com/dtolnay/semver)
by David Tolnay.

## Example

```roc
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
```