CS307-Team24/functions/util/validator.js
2019-09-29 01:35:06 -04:00

17 lines
360 B
JavaScript

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