This repository has been archived on 2026-10-14. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files

11 lines
409 B
JavaScript

export function updateState(installed, latest) {
const parse = value => typeof value === 'string' && /^\d+(\.\d+){0,3}$/.test(value) ? value.split('.').map(Number) : null;
const a = parse(installed), b = parse(latest);
if (!a || !b) return '';
for (let i = 0; i < 4; i++) {
if ((a[i] || 0) < (b[i] || 0)) return 'Update available';
if ((a[i] || 0) > (b[i] || 0)) return '';
}
return '';
}