@webnotion-net/typescript-model-validator
Version:
Flexible and extensible library for validating data models in TypeScript
20 lines (19 loc) • 601 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var Length = /** @class */ (function () {
function Length(min, max) {
this.min = min;
this.max = max;
}
Length.prototype.validate = function (data) {
if (typeof data == 'undefined') {
return false;
}
return data.length > this.min && data.length < this.max;
};
Length.prototype.getErrorMessage = function () {
return "Length must be between ".concat(this.min, " and ").concat(this.max);
};
return Length;
}());
exports.default = Length;