v/vlib/semver
Alexander Medvednikov ac2dcc2bc0 V 0.4.4
2024-01-09 16:54:06 +03:00
..
compare.v all: update attributes to use new syntax 2023-11-15 16:16:01 +11:00
LICENSE.md all: add #pkgconfig directive using the new vlib modules (#6673) 2020-10-26 18:05:18 +01:00
parse.v builtin: deprecate string.last_index/1 for string.index_last/1, and string.last_index_u8/1 for string.index_u8_last/1 (#20095) 2023-12-05 13:56:59 +02:00
range.v all: unwrap const() blocks 2023-11-25 10:02:51 +03:00
README.md docs: adding skeleton README.md files for all vlib modules (#13034) 2022-01-05 18:06:08 +02:00
semver.v semver: use operator overloading (#19935) 2023-11-19 16:50:12 +02:00
semver_test.v all: unwrap const() blocks 2023-11-25 10:02:51 +03:00
util.v all: update attributes to use new syntax 2023-11-15 16:16:01 +11:00
v.mod V 0.4.4 2024-01-09 16:54:06 +03:00

Description:

semver is a library for processing versions, that use the semver format.

Examples:

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.