Made VersionType enum

This commit is contained in:
Kir_Antipov 2022-06-07 17:21:26 +03:00
parent 537780acea
commit b4d00806ed

View file

@ -1,14 +1,20 @@
export enum VersionType {
Alpha = "alpha",
Beta = "beta",
Release = "release",
}
export function parseVersionFromName(name: string): string { export function parseVersionFromName(name: string): string {
const match = name.match(/[a-z]{0,2}\d+\.\d+.*/i); const match = name.match(/[a-z]{0,2}\d+\.\d+.*/i);
return match ? match[0] : name; return match ? match[0] : name;
} }
export function parseVersionTypeFromName(name: string): "alpha" | "beta" | "release" { export function parseVersionTypeFromName(name: string): VersionType {
if (name.match(/[+-_]alpha/i)) { if (name.match(/[+-_]alpha/i)) {
return "alpha"; return VersionType.Alpha;
} else if (name.match(/[+-_]beta/i)) { } else if (name.match(/[+-_]beta/i)) {
return "beta"; return VersionType.Beta;
} else { } else {
return "release"; return VersionType.Release;
} }
} }