chore(utils): clean util package deps (#4146)
This commit is contained in:
@@ -1,6 +1,16 @@
|
||||
import { isEmail } from "class-validator"
|
||||
import { MedusaError } from "./errors"
|
||||
|
||||
const EMAIL_REGEX =
|
||||
/^(([^<>()[\]\\.,;:\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,}))$/
|
||||
|
||||
/**
|
||||
* Check whether provided string is an email.
|
||||
* @param email - string to check
|
||||
*/
|
||||
function isEmail(email: string) {
|
||||
return email.toLowerCase().match(EMAIL_REGEX)
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to validate user email.
|
||||
* @param {string} email - email to validate
|
||||
|
||||
Reference in New Issue
Block a user