UNPKG

node-web-mvc

Version:
22 lines (21 loc) 899 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const Target_1 = __importDefault(require("../../servlets/annotations/Target")); const ElementType_1 = __importDefault(require("../../servlets/annotations/annotation/ElementType")); const Constraints_1 = __importDefault(require("./Constraints")); class NotNull extends Constraints_1.default { constructor() { super(...arguments); this.message = '{validation.constraints.NotNull.message}'; } isValid(value) { return value !== null && value !== undefined; } } /** * 验证配置元素的值不能为 `null`或者`undefined` */ exports.default = (0, Target_1.default)([ElementType_1.default.PROPERTY, ElementType_1.default.PARAMETER])(NotNull);