UNPKG

validations-br

Version:
16 lines (14 loc) 613 B
//#region src/validations/validateEmail.ts /** * The function `validateEmail` uses a regular expression to check if a given string is a valid email * address. * @param {string} value - The `value` parameter is a string that represents the email address that * needs to be validated. * @returns The `validateEmail` function returns a boolean value. It returns `true` if the email is * valid, and `false` otherwise. */ function validateEmail(value) { return /^[\w!#$%&'*+/=?`{|}~^-]+(?:\.[\w!#$%&'*+/=?`{|}~^-]+)*@(?:[A-Z0-9-]+\.)+[A-Z]{2,10}$/i.test(value); } //#endregion exports.validateEmail = validateEmail;