From 3fe6453b0cffc75e15d057ea0e66657917332349 Mon Sep 17 00:00:00 2001 From: Mathis Date: Thu, 2 May 2024 12:23:05 +0200 Subject: [PATCH] style(utils): improve code readability in email validator Improved code readability by formatting the regular expression in the `isEmail` function in `utils/validators/email.ts` and also ensured a newline at the end of the file. Issue: #18 Signed-off-by: Mathis --- src/utils/validators/email.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/utils/validators/email.ts b/src/utils/validators/email.ts index 700259f..3871d69 100644 --- a/src/utils/validators/email.ts +++ b/src/utils/validators/email.ts @@ -1,4 +1,5 @@ export function isEmail(email: string) { - const re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; + const re = + /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; return re.test(String(email).toLowerCase()); -} \ No newline at end of file +}