1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.IsDefined = exports.isDefined = exports.IS_DEFINED = void 0;
|
4 | const ValidateBy_1 = require("./ValidateBy");
|
5 | const ValidationTypes_1 = require("../../validation/ValidationTypes");
|
6 |
|
7 | exports.IS_DEFINED = ValidationTypes_1.ValidationTypes.IS_DEFINED;
|
8 |
|
9 |
|
10 |
|
11 | function isDefined(value) {
|
12 | return value !== undefined && value !== null;
|
13 | }
|
14 | exports.isDefined = isDefined;
|
15 |
|
16 |
|
17 |
|
18 | function IsDefined(validationOptions) {
|
19 | return (0, ValidateBy_1.ValidateBy)({
|
20 | name: exports.IS_DEFINED,
|
21 | validator: {
|
22 | validate: (value) => isDefined(value),
|
23 | defaultMessage: (0, ValidateBy_1.buildMessage)(eachPrefix => eachPrefix + '$property should not be null or undefined', validationOptions),
|
24 | },
|
25 | }, validationOptions);
|
26 | }
|
27 | exports.IsDefined = IsDefined;
|
28 |
|
\ | No newline at end of file |