import semver from 'semver' ; import type { SemverVersion } from './types' ; export const compareVersions = ( versionToCheck , checkAgainst ) => { if ( versionToCheck && checkAgainst ) { return semver . compare ( semver . coerce ( versionToCheck ) , semver . coerce ( checkAgainst ) ) ; } if ( versionToCheck && checkAgainst == null ) { return 1 ; } if ( checkAgainst && versionToCheck == null ) { return - 1 ; } return 0 ; } ;