From 602b005e43d767612fa4bb7d7c370c3647a4e49b Mon Sep 17 00:00:00 2001 From: hburn7 Date: Tue, 24 Dec 2024 21:54:29 -0500 Subject: [PATCH] apply suggestions from code review --- app/actions/tournaments.ts | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/app/actions/tournaments.ts b/app/actions/tournaments.ts index 0e432f7..4577817 100644 --- a/app/actions/tournaments.ts +++ b/app/actions/tournaments.ts @@ -43,14 +43,9 @@ export async function tournamentSubmissionFormAction( } // Try to extract the id using regex - const match = MatchLinkPattern.exec(s); - - if (match == null) { - return ""; - } - - const url = match[0]; - return match ? parseFloat(url.substring(url.lastIndexOf('/') + 1)) : s; + return MatchLinkPattern.test(s) + ? parseFloat(s.substring(s.lastIndexOf('/') + 1)) + : s; }), beatmapIds: value => value .split(/\r?\n/g)