aboutsummaryrefslogtreecommitdiff
path: root/v_windows/v/old/vlib/semver/README.md
blob: e7c8d20b62e788e74f07a8db0156ea07748a00aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# semver

A library for working with versions in [semver][semver] format.

## Usage

```v
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.

[semver]: https://semver.org/