Function compareFirmwareVersionsDesc

  • Compares two firmware versions so that the newest sorts first, for use as an Array#sort comparator.

    Firmware versions have to be compared per numeric component rather than as text: a major version of 10 or above precedes every 5.x.x version alphabetically, so comparing the strings ranks it as the oldest.

    Older firmware versions sometimes included invalid build metadata, which is removed before comparing, the same way firmwareVersionSatisfies does. A version that is still not valid SemVer afterwards sorts last, so one unparseable package filename cannot throw and take the ordering of the rest with it.

    Parameters

    • a: string
    • b: string

    Returns number

Generated using TypeDoc