Add some helpers

This commit is contained in:
2022-10-29 22:05:19 +02:00
parent 30634f7433
commit 9f5824fd41
3 changed files with 61 additions and 0 deletions

6
email-validator.js Normal file
View File

@ -0,0 +1,6 @@
export const validateEmail = (control, value) => {
if (typeof value !== 'string') {
return false;
}
return value.toLowerCase().match(/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/) !== null;
}