laravel-jstools
Version:
JS tools for building front-side of Laravel applications
20 lines (19 loc) • 645 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ValidateError = void 0;
class ValidateError {
constructor(field, rule, replaceList = [], text = '') {
this.field = field;
this.rule = rule;
this.replaceList = replaceList;
this.addReplace('attribute', this.field);
this.text = text;
}
addReplace(name, value) {
this.replaceList[name] = value;
}
toText(translateService) {
return this.text !== '' ? this.text : translateService.t__validate(this.rule, this.replaceList);
}
}
exports.ValidateError = ValidateError;