Consolidate Persimmons source
This commit is contained in:
1 parent
f1880a6ad1
commit
b0e5d84d9c
1 file changed
+10
@@ -0,0 +1,10 @@
|
||||
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 '';
|
||||
}
|
||||
Reference in new issue
Block a user