graphite: auto detect version

This commit is contained in:
Alexander Zobnin
2017-10-20 16:26:00 +03:00
parent 89aea278a9
commit 6114f63d7c
3 changed files with 40 additions and 3 deletions
+7 -1
View File
@@ -1,4 +1,6 @@
const versionPattern = /(\d+)(?:\.(\d+))?(?:\.(\d+))?(?:-([0-9A-Za-z\.]+))?/;
import _ from 'lodash';
const versionPattern = /^(\d+)(?:\.(\d+))?(?:\.(\d+))?(?:-([0-9A-Za-z\.]+))?/;
export class SemVersion {
major: number;
@@ -20,6 +22,10 @@ export class SemVersion {
let compared = new SemVersion(version);
return !(this.major < compared.major || this.minor < compared.minor || this.patch < compared.patch);
}
isValid(): boolean {
return _.isNumber(this.major);
}
}
export function isVersionGtOrEq(a: string, b: string): boolean {