2
0

️ Format email input to lower case (#1520)

Closes #897

---------

Co-authored-by: Baptiste Arnaud <baptiste.arnaud95@gmail.com>
This commit is contained in:
Ankit
2024-05-21 15:43:10 +05:30
committed by GitHub
parent ed02371bf6
commit 618322e13e
2 changed files with 7 additions and 5 deletions

View File

@ -1,4 +1,6 @@
const emailRegex =
/^(([^<>()[\]\\.,;:\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,}))$/
export const validateEmail = (email: string) => emailRegex.test(email)
export const formatEmail = (email: string) => {
if (emailRegex.test(email)) return email.toLowerCase()
}