1.2.1 • Published 2 years ago
sy-validator v1.2.1
function validateEmail(emailValue, pattern) {
if(emailValue.match(pattern)) {
return true
} else {
return false
}
}
- emailValue - will take the value of the input
- pattern - accepts regular expressions
function validateLogin(loginValue, pattern, minLength, maxLength) {
if (typeof loginValue !== 'string') {
return false;
}
loginValue = loginValue.trim();
if (loginValue.length < minLength || loginValue.length > maxLength) {
return false;
} else if (!loginValue.match(pattern)) {
return false;
} else {
return true;
}
}
- loginValue - will take the value of the input
- pattern - accepts regular expressions
- minLength - minimum number of value to enter
- maxLength - maximum number of value to enter
function validatePassword(passwordValue, pattern) {
if(pattern.test(passwordValue)) {
return true;
} else {
return false;
}
}
- passwordValue - will take the value of the input
- pattern - accepts regular expressions __ link to GitHub Page