From b4d00806ed295278b4e984dd83fbd04e3b4445f3 Mon Sep 17 00:00:00 2001 From: Kir_Antipov Date: Tue, 7 Jun 2022 17:21:26 +0300 Subject: [PATCH] Made `VersionType` enum --- src/utils/version-utils.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/utils/version-utils.ts b/src/utils/version-utils.ts index b8def7e..1f71da4 100644 --- a/src/utils/version-utils.ts +++ b/src/utils/version-utils.ts @@ -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; } }