-
Couldn't load subscription status.
- Fork 0
Home
喵喵大人 edited this page Dec 3, 2019
·
2 revisions
This is Bucket's implementation of Semver version (main) and Calendar version control, and provides additional constraints on this basis And verified support.
-
Semantic version: support based on Semver semantic version implementation -
Calendar Version: also compatible with Calendar Calendar version support -
Standard version: (major, minor, patch, revision) parsing support (for Microsoft rules) -
Version Constrainer: Allows to establish a version constraint and get whether the versions match -
Stability Control: Allows to establish minimum version stability (Minimum Stability) version control -
Major Version Wildcard: Added support forTilde(^) andCaret(~) -
AND/OR: For version matching, it allows complex version constraints established by AND (AND) or (OR) -
Special Version: In addition to the regular version, it is allowed to use branch names starting withdev-as special branch constraints. -
Wild Version: Allows you to use-to link different version ranges, and to build wild versions via*.
GreaterThan(a, b)GreaterThanOrEqual(a, b)LessThan(a, b)LessThanOrEqual(a, b)Equal(a, b)NotEqual(a, b)
Comparator.GreaterThan("1.5.0", "1.2.0"); // 1.5.0 > 1.2.0 = trueCompare(a, operator, b)
The valid comparison operators are:==, <, <=, >, >=, !=
Comparator.Compare("1.5.0", ">=", "1.2.0"); // 1.5.0 >= 1.2.0 = trueThe Satisfies matching function allows you to use semantic-version for matching satisfaction.
Satisfies(version, constraints)
Semver.Satisfies("1.0", "^1.5"); // false
Semver.Satisfies("1.6", "^1.5"); // trueWith SatisfiesBy you can match an array of versions, and the function returns the versions that match the conditions:
SatisfiesBy(versions, constraints)
Semver.SatisfiesBy(new[]{ "1.1", "1.6", "1.8" }, "^1.5"); // new[] { "1.6", "1.8" }With Sort, you can sort a set of versions. The second parameter determines whether to sort from large to small.
Sort(versions, desc)
Semver.Sort(new[] { "1.1", "1.8", "1.3", "0.6", "2.1" }); // new[] { "0.6", "1.1", "1.3", "1.8", "2.1" }
Semver.Sort(new[] { "1.1", "1.8", "1.3", "0.6", "2.1" }, true); // new[] { "2.1", "1.8", "1.3", "1.1", "0.6" }VersionParser can build complex semantic-version
ParseStability(version)
VersionParser.ParseStability("1.2.0-beta"); // Extracting stability flags:betaParseConstraints(version)
var versionParser = new VersionParser();
var constraint = versionParser.ParseConstraints("^1.2");
constraint.Matches(new Constraint("=", "1.5")); // true