v/vlib/semver
zakuro 33694665f0
fmt: align each contiguous field of struct. not the whole. (#7981)
2021-01-12 04:38:43 +01:00
..
LICENSE.md
README.md
compare.v
parse.v fmt: align each contiguous field of struct. not the whole. (#7981) 2021-01-12 04:38:43 +01:00
range.v semver: add input information in error and panic output (#7712) 2020-12-30 17:07:21 +01:00
semver.v semver: add input information in error and panic output (#7712) 2020-12-30 17:07:21 +01:00
semver_test.v
util.v semver: add input information in error and panic output (#7712) 2020-12-30 17:07:21 +01:00
v.mod

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.