@nka212bg/backend-utils 0.1.37 → 0.1.38
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/db/dbUtils.js +4 -8
- package/package.json +1 -1
package/db/dbUtils.js
CHANGED
|
@@ -19,17 +19,13 @@ exports.paramsSanitize = (params) => {
|
|
|
19
19
|
if (!Array.isArray(params)) params = [params];
|
|
20
20
|
|
|
21
21
|
return params.map((param) => {
|
|
22
|
-
if (typeof param == "object" && param !== null)
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
if (typeof param == "object" && param !== null) return JSON.stringify(param);
|
|
23
|
+
if (typeof param == "boolean") return param ? 1 : 0;
|
|
24
|
+
if (typeof param == "number") return param;
|
|
25
25
|
|
|
26
26
|
param = String(param).trim();
|
|
27
27
|
const pLowerCase = param.toLowerCase();
|
|
28
|
-
|
|
29
|
-
if (pLowerCase === "true") return 1;
|
|
30
|
-
if (pLowerCase === "false") return 0;
|
|
31
|
-
if (!param || pLowerCase == "null" || pLowerCase == "undefined") return undefined;
|
|
32
|
-
// if (!isNaN(param)) return Number(param);
|
|
28
|
+
if (pLowerCase === "null" || pLowerCase === "undefined") return undefined;
|
|
33
29
|
|
|
34
30
|
return param;
|
|
35
31
|
});
|