validator-list
Version:
22 lines (21 loc) • 860 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.BaseRangeValidator = void 0;
const _ = require("lodash");
const base_validator_1 = require("./base-validator");
class BaseRangeValidator extends base_validator_1.BaseValidator {
constructor(attributeLabel, value, options) {
super(attributeLabel, value, options);
this.message = '{attribute} is invalid.';
this.strict = false;
this.not = false;
this.setOptions(options);
if (!((_.isArray(this.range) && !_.isEmpty(this.range)) || _.isFunction(this.range))) {
throw new Error('The `range` property must be set.');
}
}
getOptionNameList(...childrenList) {
return super.getOptionNameList(...childrenList, ['range', 'strict', 'not']);
}
}
exports.BaseRangeValidator = BaseRangeValidator;