Function compareVersions
- compareVersions(v1: string, v2: string): -1 | 0 | 1
Parameters
- v1: string
First version to compare
- v2: string
Second version to compare
Returns -1 | 0 | 1
Numeric value compatible with the Array.sort(fn) interface.
- v1: string
Compare semver version strings to find greater, equal or lesser. This library supports the full semver specification, including comparing versions with different number of digits like
1.0.0
,1.0
,1
, and pre-release versions like1.0.0-alpha
.