qvc
Version:
Handle commands and queries from the client with validation
17 lines (14 loc) • 338 B
JavaScript
function NotEmpty(message){
this.message = message;
}
NotEmpty.prototype.constraint = function(){
return {
message: this.message
};
};
NotEmpty.prototype.isValid = function(value){
if(value == null) return false;
if(typeof value == "string" && value.length == 0) return false;
return true;
};
module.exports = NotEmpty;