Created
August 3, 2024 04:01
-
-
Save StalinMazaEpn/e6f812ed30196bbe2d33fc4f9087a038 to your computer and use it in GitHub Desktop.
validationsJavascript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```js | |
export function validateCorporativeEmail(control: AbstractControl) { | |
const valueEmail: string | null = control.value; | |
const emailToVerify = valueEmail ||''; | |
const emailDomain = emailToVerify.substring(emailToVerify.indexOf("@") + 1, emailToVerify.lastIndexOf(".")); | |
if (emailToVerify === '' || ["gmail", "outlook", "hotmail", "yahoo", "icloud", "aol", "live", "msn", "yopmail", "mail"].includes(emailDomain)) { | |
return { invalidCorporativeEmail: true }; | |
} | |
return null; | |
} | |
``` | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment