brief-06-back/src/utils/validators.util.ts
Mathis 8e14bf77b4
refactor: reorganize code and enhance readability
Code imports rearranged and updated for better consistency. Missing semicolons were added in multiple files to improve code readability and standards compliance. The usage of whitespace and indentation was also standardized across multiple files to improve overall code clarity.
2024-05-23 12:31:57 +02:00

20 lines
509 B
TypeScript

const Validators = {
isEmail: (value: string) => {
const emailRegex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,32}$/;
return emailRegex.test(value);
},
isUsername: (value: string) => {
const usernameRegex = /^[a-zA-Z0-9._]{3,14}$/;
return usernameRegex.test(value);
},
//displayName
isPassword: (value: string) => {
const passwordRegex =
/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,32}$/;
return passwordRegex.test(value);
},
};
export default Validators;