compare

external fun compare(v1: String, v2: String): Int(source)
external fun compare(v1: String, v2: String, optionsOrLoose: Boolean = definedExternally): Int(source)
external fun compare(v1: String, v2: String, optionsOrLoose: Options = definedExternally): Int(source)
external fun compare(v1: String, v2: SemVer): Int(source)
external fun compare(v1: String, v2: SemVer, optionsOrLoose: Boolean = definedExternally): Int(source)
external fun compare(v1: String, v2: SemVer, optionsOrLoose: Options = definedExternally): Int(source)
external fun compare(v1: SemVer, v2: String): Int(source)
external fun compare(v1: SemVer, v2: String, optionsOrLoose: Boolean = definedExternally): Int(source)
external fun compare(v1: SemVer, v2: String, optionsOrLoose: Options = definedExternally): Int(source)
external fun compare(v1: SemVer, v2: SemVer): Int(source)
external fun compare(v1: SemVer, v2: SemVer, optionsOrLoose: Boolean = definedExternally): Int(source)
external fun compare(v1: SemVer, v2: SemVer, optionsOrLoose: Options = definedExternally): Int(source)

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

Sorts in ascending order when passed to Array.sort().

Return

  • 0 if v1 == v2

  • 1 if v1 is greater

  • -1 if v2 is greater.