1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00
v/vlib/semver
2020-12-21 21:25:19 +02:00
..
compare.v semver: run v fmt (#7439) 2020-12-21 21:25:19 +02:00
LICENSE.md all: add #pkgconfig directive using the new vlib modules (#6673) 2020-10-26 18:05:18 +01:00
parse.v semver: run v fmt (#7439) 2020-12-21 21:25:19 +02:00
range.v semver: run v fmt (#7439) 2020-12-21 21:25:19 +02:00
README.md check-md: verify code example formatting (#7143) 2020-12-05 22:54:41 +01:00
semver_test.v all: add #pkgconfig directive using the new vlib modules (#6673) 2020-10-26 18:05:18 +01:00
semver.v semver: run v fmt (#7439) 2020-12-21 21:25:19 +02:00
util.v semver: run v fmt (#7439) 2020-12-21 21:25:19 +02:00
v.mod all: add #pkgconfig directive using the new vlib modules (#6673) 2020-10-26 18:05:18 +01:00

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.