From 5079e0078084749651ac4e5f159f0283c2611333 Mon Sep 17 00:00:00 2001 From: ppc Date: Wed, 7 Aug 2024 20:00:45 +0100 Subject: [PATCH] move regex to const --- aimenet-web/lib/aime-card.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/aimenet-web/lib/aime-card.ts b/aimenet-web/lib/aime-card.ts index 0e24ba6..9993aa3 100644 --- a/aimenet-web/lib/aime-card.ts +++ b/aimenet-web/lib/aime-card.ts @@ -1,3 +1,5 @@ +export const CARD_ID_REGEX = /^(?:[0-9]{4} ?){5}$/i; + /** * Generates a random Aime card id. */ @@ -16,5 +18,5 @@ export function generateAimeCardId(): string { * @param id The card id to validate */ export function validateAimeCardId(id: string): boolean { - return id[0] !== '3' && /^[0-9A-F]{20}$/i.test(id); + return id[0] !== '3' && CARD_ID_REGEX.test(id); } \ No newline at end of file