This is part of the Fake.Core.SemVer module.

SemVer

Parser which allows to deal with Semantic Versioning (SemVer). Make sure to read the documentation in the SemVerInfo record as well if you manually create versions.

Functions and values

Function or valueDescription
SemVer.isValid(version)
Signature: version:string -> bool

Returns true if input appears to be a parsable semver string

SemVer.parse(version)
Signature: version:string -> SemVerInfo

Parses the given version string into a SemVerInfo which can be printed using ToString() or compared according to the rules described in the SemVer docs.

Sample

1: 
2: 
3: 
4: 
5: 
parse "1.0.0-rc.1"     < parse "1.0.0"          // true
parse "1.2.3-alpha"    > parse "1.2.2"          // true
parse "1.2.3-alpha2"   > parse "1.2.3-alpha"    // true
parse "1.2.3-alpha002" > parse "1.2.3-alpha1"   // false
parse "1.5.0-beta.2"   > parse "1.5.0-rc.1"     // false