Ensured server version is properly parsed to avoid errors due to invalid semver

This commit is contained in:
Alejandro Celaya
2019-10-18 17:39:38 +02:00
parent d9a8243d36
commit 12f6b94ece
4 changed files with 67 additions and 13 deletions

View File

@@ -60,3 +60,11 @@ export const compareVersions = (firstVersion, operator, secondVersion) => compar
secondVersion,
operator
);
export const versionIsValidSemVer = (version) => {
try {
return compareVersions(version, '=', version);
} catch (e) {
return false;
}
};