Chore(medusa,utils,types,inventory,stock-location): remove core dependency modules (#3531)

This commit is contained in:
Carlos R. L. Rodrigues
2023-03-23 08:07:32 -03:00
committed by GitHub
parent bfef22b33e
commit 4e9d257d3b
159 changed files with 1769 additions and 693 deletions
+20
View File
@@ -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()
}