1 min read

Force Update - Compare Version

javascript typescript app

A utility to check whether we should prompt force update or not

type ShouldForceUpdateParams = {
  currentVersion: string; 
  minVersion: string;
}

const shouldForceUpdate = ({ currentVersion, minVersion }: ShouldForceUpdateParams) => {
  return minVersion.localeCompare(
    currentVersion, 
    undefined, 
    { 
      numeric: true, 
      sensitivity: 'case' 
    }
  ) > 0;
}