mirror of
https://github.com/Kir-Antipov/mc-publish.git
synced 2024-12-28 17:44:54 -05:00
Made VersionType
enum
This commit is contained in:
parent
537780acea
commit
b4d00806ed
1 changed files with 10 additions and 4 deletions
|
@ -1,14 +1,20 @@
|
|||
export enum VersionType {
|
||||
Alpha = "alpha",
|
||||
Beta = "beta",
|
||||
Release = "release",
|
||||
}
|
||||
|
||||
export function parseVersionFromName(name: string): string {
|
||||
const match = name.match(/[a-z]{0,2}\d+\.\d+.*/i);
|
||||
return match ? match[0] : name;
|
||||
}
|
||||
|
||||
export function parseVersionTypeFromName(name: string): "alpha" | "beta" | "release" {
|
||||
export function parseVersionTypeFromName(name: string): VersionType {
|
||||
if (name.match(/[+-_]alpha/i)) {
|
||||
return "alpha";
|
||||
return VersionType.Alpha;
|
||||
} else if (name.match(/[+-_]beta/i)) {
|
||||
return "beta";
|
||||
return VersionType.Beta;
|
||||
} else {
|
||||
return "release";
|
||||
return VersionType.Release;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue