2023-05-09 13:57:01 +02:00
|
|
|
export const isHexColor = (str) => {
|
|
|
|
const pattern = /^#([0-9A-F]{3}){1,2}$/i;
|
|
|
|
return pattern.test(str);
|
|
|
|
}
|
2023-05-09 16:01:19 +02:00
|
|
|
|
|
|
|
export const verifyUsername = (username) => {
|
|
|
|
const alphanumeric = /^[a-zA-Z0-9]+$/;
|
|
|
|
if (username.length > 20) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (!alphanumeric.test(username)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|