nm_.find(columns, function(displayName, column) { if (!nmValidator.isNull(instance.get(column))) { valid = true; return true; } });
export function validateTweet(data) { let errors = {}; if(Validator.isNull(data.tweet)) { errors.tweet = 'Tweet cannot be empty.'; } else if(!Validator.isLength(data.tweet, {min: 10})) { errors.tweet = 'Tweet should be atleast 10 characters long.'; } else if(!Validator.isLength(data.tweet, {max: 160})) { errors.tweet = 'Tweet should be less than 160 characters long.'; } return { errors, isValid: isEmpty(errors) } }
export function validateUserRegister(data) { let errors = {}; if(Validator.isNull(data.username)) { errors.username = 'Username cannot be empty.'; } else if(!Validator.isLength(data.username, {min: 6})) { errors.username = 'Username should be atleast 6 characters long.'; } if(Validator.isNull(data.password)) { errors.password = 'Password cannot be empty.'; } else if(!Validator.isLength(data.password, {min: 6})) { errors.password = 'Password should be atleast 6 characters long.'; } return { errors, isValid: isEmpty(errors) } }
}); if(validator.isNull(title)){ ep.emit("create_error","title","Title can't be empty"); return; if(validator.isNull(tags)){ ep.emit("create_error","tags","Tags can't be empty"); return; if(validator.isNull(Markdown)){ ep.emit("create_error","content","Content can't be empty"); return; showNameArray.forEach(function (showName) { tagName = showName.toUpperCase(); if(!validator.isNull(tagName) && tagNameArray.indexOf(tagName) == '-1' ){ tagNameArray.push(tagName); tagArray.push({
}); if(validator.isNull(content)){ ep.emit("comment_error","content","Content can't be empty"); return;
export function validateUserLogin(data) { let errors = {}; if(Validator.isNull(data.username)) { errors.username = 'Username cannot be empty.'; } else if(!Validator.isLength(data.username, {min: 6})) { errors.username = 'Username should be atleast 6 characters long.'; } if(Validator.isNull(data.password)) { errors.password = 'Password cannot be empty.'; } else if(!Validator.isLength(data.password, {min: 6})) { errors.password = 'Password should be atleast 6 characters long.'; } return { errors, isValid: isEmpty(errors) } }