v/vlib/semver
Delyan Angelov 9f6c4030f6 tests: fix `-cstrict` self compilation on m0 with clang 2021-06-07 18:23:18 +03:00
..
LICENSE.md
README.md
compare.v fmt: smarter if condition wrapping (#8201) 2021-01-23 10:33:22 +02:00
parse.v
range.v tests: fix `-cstrict` self compilation on m0 with clang 2021-06-07 18:23:18 +03:00
semver.v semver: add custom errors (#9493) 2021-03-29 11:17:00 +02:00
semver_test.v
util.v
v.mod all: add #pkgconfig directive using the new vlib modules (#6673) 2020-10-26 18:05:18 +01:00

README.md

semver

A library for working with versions in semver format.

Usage

import semver

fn main() {
	ver1 := semver.from('1.2.4') or {
		println('Invalid version')
		return
	}
	ver2 := semver.from('2.3.4') or {
		println('Invalid version')
		return
	}
	println(ver1.gt(ver2))
	println(ver2.gt(ver1))
	println(ver1.satisfies('>=1.1.0 <2.0.0'))
	println(ver2.satisfies('>=1.1.0 <2.0.0'))
	println(ver2.satisfies('>=1.1.0 <2.0.0 || >2.2.0'))
}
false
true
true
false
true

For more details see semver.v file.