UNPKG

mgm

Version:

My generic modules

21 lines (18 loc) 513 B
const RuleException = require('../exception/RuleException'); module.exports = class BaseValidator { constructor() { this.messages = []; } verifyRules() { if (this.messages.length > 0) { let ruleException = new RuleException(this.messages.join(',')); this.messages = []; throw ruleException; } } checkRule(noChecked, message) { if (noChecked) { this.messages.push(message); } } }