@silicon.js/app-updates
Version:
lightweight react package for checking app updates from ios app store and android play store using react context
21 lines (15 loc) • 534 B
text/typescript
const compareVersions = (current: string, latest: string): boolean => {
const currentParts = current.split('.').map(Number);
const latestParts = latest.split('.').map(Number);
const maxLength = Math.max(currentParts.length, latestParts.length);
for (let i = 0; i < maxLength; i++) {
const currentPart = currentParts[i] || 0;
const latestPart = latestParts[i] || 0;
if (latestPart > currentPart) return true;
if (latestPart < currentPart) return false;
}
return false;
};
export const utils = {
compareVersions,
};