@webnotion-net/typescript-model-validator
Version:
Flexible and extensible library for validating data models in TypeScript
27 lines (26 loc) • 728 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var NotBlank = /** @class */ (function () {
function NotBlank() {
}
NotBlank.prototype.validate = function (data) {
if (typeof data === 'undefined') {
return false;
}
if (data === null) {
return false;
}
if (typeof data === 'number' && data === 0) {
return false;
}
if (typeof data === 'string' && data.length === 0) {
return false;
}
return true;
};
NotBlank.prototype.getErrorMessage = function () {
return "The value must not be empty.";
};
return NotBlank;
}());
exports.default = NotBlank;