%PDF- %PDF-
Direktori : /home/emergentqj/actioncivile/pre-auth/.4cc3a2e1590a4463a5f392ddcc26929e/static/js/utils/ |
Current File : /home/emergentqj/actioncivile/pre-auth/.4cc3a2e1590a4463a5f392ddcc26929e/static/js/utils/fieldValidations.js |
const minPasswordChars = 10; const pattern = (pat) => (value) => (pat.test(value) ? undefined : "pattern"); export const emailPattern = pattern( /^(([^<>()\[\]\.,;:\s@\"]+(\.[^<>()\[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i, ); export const maxLength = (max) => (value) => (value && value.length > max ? "max-length" : undefined); export const maxPasswordLength45 = maxLength(45); export const minLength = (min) => (value) => (value && value.length < min ? "min-length" : undefined); export const minPasswordLength = (value) => (value && value.length < minPasswordChars ? { type: "Length", length: minPasswordChars } : undefined); export const namePattern = pattern(/^[a-zA-Z\u00C0-\u017F\- ]+$/); export const phonePattern = pattern(/^\+?[0-9]{3}-?[0-9]{4,12}$/); export const required = (value) => (value ? undefined : "Required"); export const numbersOnlyPattern = pattern(/^\d*$/);