ingeni-validation 1.1.1 → 1.1.2
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 +22 -1
- package/package.json +1 -1
package/ingeni-validation.js
CHANGED
|
@@ -84,10 +84,31 @@ const optionMissingFields = optionalFields.filter(
|
|
|
84
84
|
//Check Boolean Parameters
|
|
85
85
|
async function checkBooleanParams(...params) {
|
|
86
86
|
for (let param of params) {
|
|
87
|
-
|
|
87
|
+
|
|
88
|
+
// Reject null or undefined
|
|
89
|
+
if (param === null || param === undefined) {
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// Reject boolean type
|
|
94
|
+
if (typeof param === "boolean") {
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Reject empty or space-only strings
|
|
99
|
+
if (typeof param === "string" && param.trim().length === 0) {
|
|
88
100
|
return false;
|
|
89
101
|
}
|
|
102
|
+
|
|
103
|
+
// Reject boolean strings
|
|
104
|
+
if (typeof param === "string") {
|
|
105
|
+
const val = param.trim().toLowerCase();
|
|
106
|
+
if (val === "true" || val === "false") {
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
90
110
|
}
|
|
111
|
+
|
|
91
112
|
return true;
|
|
92
113
|
}
|
|
93
114
|
|