Uses regex for parsing versions, as more efficient

This commit is contained in:
Alicia Sykes 2021-08-26 23:01:36 +01:00
parent fe57a266f1
commit f16059d5e9

View File

@ -5,7 +5,7 @@ const currentVersion = require('../package.json').version;
const packageUrl = 'https://raw.githubusercontent.com/Lissy93/dashy/master/package.json'; const packageUrl = 'https://raw.githubusercontent.com/Lissy93/dashy/master/package.json';
const makeMsg = (latestVersion) => { const makeMsg = (latestVersion) => {
const parse = (version) => parseInt(version.replaceAll('.', ''), 10); const parse = (version) => parseInt(version.replace(/\./g, ''), 10);
const difference = parse(latestVersion) - parse(currentVersion); const difference = parse(latestVersion) - parse(currentVersion);
let msg = ''; let msg = '';
if (difference <= 0) { if (difference <= 0) {