Skip to content

VersionUtils

reference
1 min readUpdated

Kind: Class

Source: atloria-monorepo/libs/parser-core/src/generators/versioning/version-config.ts

Version utilities

Methods

MethodSignatureReturns
parseVersionparseVersion(version: string)`[number, number, number]
comparecompare(a: string, b: string)VersionComparison
sortsort(versions: VersionInfo[], ascending: undefined)VersionInfo[]
findLatestfindLatest(versions: VersionInfo[], includePrerelease: undefined)`VersionInfo
isPrereleaseisPrerelease(version: string)boolean
isEOLisEOL(version: VersionInfo)boolean
generateLabelgenerateLabel(version: VersionInfo, isLatest: boolean)string
groupByMajorgroupByMajor(versions: VersionInfo[])Map<number, VersionInfo[]>
getBadgeColorgetBadgeColor(version: VersionInfo)string

Where it refuses work

  • VersionUtils stops the work with an early return when parts.length !== 3.
  • VersionUtils stops the work with an early return when isNaN(major) || isNaN(minor) || isNaN(patch).
  • VersionUtils stops the work with an early return when !versionA || !versionB.
  • VersionUtils stops the work with an early return when versionA[i] < versionB[i].
  • VersionUtils stops the work with an early return when versionA[i] > versionB[i].
  • VersionUtils stops the work with an early return when candidates.length === 0.

Was this page helpful?

Download as PDF