Chore(medusa,utils,types,inventory,stock-location): remove core dependency modules (#3531)
This commit is contained in:
committed by
GitHub
parent
bfef22b33e
commit
4e9d257d3b
@@ -0,0 +1,20 @@
|
||||
import { isEmail } from "class-validator"
|
||||
import { MedusaError } from "./errors"
|
||||
|
||||
/**
|
||||
* Used to validate user email.
|
||||
* @param {string} email - email to validate
|
||||
* @return {string} the validated email
|
||||
*/
|
||||
export function validateEmail(email: string): string {
|
||||
const validatedEmail = isEmail(email)
|
||||
|
||||
if (!validatedEmail) {
|
||||
throw new MedusaError(
|
||||
MedusaError.Types.INVALID_DATA,
|
||||
"The email is not valid"
|
||||
)
|
||||
}
|
||||
|
||||
return email.toLowerCase()
|
||||
}
|
||||
Reference in New Issue
Block a user