ingeni-validation 1.1.15 → 1.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ingeni-validation.js +24 -0
- package/package.json +1 -1
package/ingeni-validation.js
CHANGED
|
@@ -82,6 +82,30 @@ async function validateOptional(req, res, optionalFields) {
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
|
|
85
|
+
//Check Null value (Not Allow null or "null"
|
|
86
|
+
async function isNullValue(...params) {
|
|
87
|
+
for (let param of params) {
|
|
88
|
+
|
|
89
|
+
if (param == null) return true;
|
|
90
|
+
|
|
91
|
+
if (typeof param === "string") {
|
|
92
|
+
const val = param.trim().toLowerCase();
|
|
93
|
+
|
|
94
|
+
if (
|
|
95
|
+
val === "" ||
|
|
96
|
+
val === "null" ||
|
|
97
|
+
val === "undefined"
|
|
98
|
+
) {
|
|
99
|
+
return true;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
85
109
|
|
|
86
110
|
//valid boolean
|
|
87
111
|
async function isValidBoolean(value){
|