2021-04-16 13:18:13 +00:00
|
|
|
export const isPhoneE164 = value => !!value.match(/^\+[1-9]\d{1,14}$/);
|
|
|
|
export const isPhoneE164OrEmpty = value => isPhoneE164(value) || value === '';
|
2021-09-28 07:03:08 +00:00
|
|
|
export const shouldBeUrl = (value = '') =>
|
|
|
|
value ? value.startsWith('http') : true;
|
2022-04-12 05:38:12 +00:00
|
|
|
export const isValidPassword = value => {
|
|
|
|
const containsUppercase = /[A-Z]/.test(value);
|
|
|
|
const containsLowercase = /[a-z]/.test(value);
|
|
|
|
const containsNumber = /[0-9]/.test(value);
|
|
|
|
const containsSpecialCharacter = /[!@#$%^&*()_+\-=[\]{}|'"/\\.,`<>:;?~]/.test(
|
|
|
|
value
|
|
|
|
);
|
|
|
|
return (
|
|
|
|
containsUppercase &&
|
|
|
|
containsLowercase &&
|
|
|
|
containsNumber &&
|
|
|
|
containsSpecialCharacter
|
|
|
|
);
|
|
|
|
};
|