Notes

1 min read

Force Update - Compare Version

javascripttypescriptapp

compare version to check should force update or not

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

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

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

Search