1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-23 15:19:42 +02:00

Improve semver unit test

Now handles empty database scenario
This commit is contained in:
Harvey Kandola 2018-03-23 13:01:25 +00:00
parent c31711c130
commit 8077dd939a
4 changed files with 675 additions and 668 deletions

View file

@ -71,6 +71,9 @@ function isNewVersion(v1, v2, compareRevision) {
v1 = v1.trim().toLowerCase();
v2 = v2.trim().toLowerCase();
// Handle edge case of no prior version.
if (v1 === '' && v2 !== '') return true;
// Format expected is "1.2.3".
let v1parts = v1.split('.');
let v2parts = v2.split('.');