v/vlib/semver
2024-03-25 12:18:27 +02:00
..
compare.v all: update attributes to use new syntax 2023-11-15 16:16:01 +11:00
LICENSE.md
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 doc: update trim_doc_node_description, make module readmes more uniform (#20792) 2024-02-12 12:38:47 +02:00
semver.v all: fix typos (#21089) 2024-03-25 12:18:27 +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.5 2024-03-20 07:09:37 +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.