mirror of
https://github.com/ClaytonWWilson/CS307-Team24.git
synced 2026-03-10 21:25:04 +00:00
Code refactoring
This commit is contained in:
17
functions/util/validator.js
Normal file
17
functions/util/validator.js
Normal file
@@ -0,0 +1,17 @@
|
||||
const isEmpty = (str) => {
|
||||
if (str.trim() === '') return true;
|
||||
else return false;
|
||||
};
|
||||
|
||||
exports.validateUpdateProfileInfo = (profileData) => {
|
||||
let errors = {}
|
||||
|
||||
if (isEmpty(profileData.email)) {
|
||||
errors.email = "Must not be empty.";
|
||||
}
|
||||
|
||||
return {
|
||||
errors,
|
||||
valid: Object.keys(errors).length === 0 ? true : false
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user