Function compareBuild

Compares two versions including build identifiers (the bit after + in the semantic version string).

compareBuild('1.2.3foo', '1.2.3-foo') // 0
  • Parameters

    • v1: string

      first version string

    • v2: string

      second version string

    • OptionaloptionsOrLoose: boolean | Options

      an options object { loose } (where loose is the only available option) or a boolean indicating whether to enable loose mode. In loose mode, the parser is more forgiving with imperfectly formatted semver strings

    Returns -1 | 0 | 1

    • 0 if v1 == v2
    • 1 if v1 > v2
    • -1 if v1 < v2