Variable compareVersionsConst

compareVersions: (v1: string, v2: string) => 0 | 1 | -1

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 like 1.0.0-alpha.

Type Declaration

    • (v1: string, v2: string): 0 | 1 | -1
    • Parameters

      • v1: string

        First version to compare

      • v2: string

        Second version to compare

      Returns 0 | 1 | -1

      Numeric value compatible with the Array.sort(fn) interface.