Update semver.er

This commit is contained in:
Shunsuke Shibayama 2024-02-10 12:46:20 +09:00
parent 7e961e37ed
commit 027009680a

View file

@ -38,6 +38,11 @@
if self.major == 0, do:
self.compatible_with::return self == other
self.major == other.major
is_valid s: Str =
match s.split("."):
[major, minor, patch] -> major.isnumeric() and minor.isnumeric() and patch.isnumeric()
[major, minor, patch, pre] -> major.isnumeric() and minor.isnumeric() and patch.isnumeric() and pre.isalnum()
_ -> False
#[
greater self, other: .Version =
match [self.major > other.major, self.major >= other.major, self.minor > other.minor, self.minor >= other.minor, self.patch > other.patch]: