Code refactoring

This commit is contained in:
2019-09-29 01:35:06 -04:00
parent 262e59df65
commit 15f976398a
6 changed files with 123 additions and 121 deletions

View 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
}
};