This commit is contained in:
Benjamin Toby
2025-01-12 18:19:20 +01:00
parent a3561da53d
commit 186cc76ffb
46 changed files with 344 additions and 211 deletions
@@ -6,7 +6,7 @@ import _ from "lodash";
* @description this function takes in a text(or number) and returns a sanitized
* text, usually without spaces
*/
function sanitizeSql(text: any, spaces: boolean, regex?: RegExp | null): any {
function sanitizeSql(text: any, spaces?: boolean, regex?: RegExp | null): any {
if (!text) return "";
if (typeof text == "number" || typeof text == "boolean") return text;
if (typeof text == "string" && !text?.toString()?.match(/./)) return "";
@@ -55,7 +55,7 @@ function sanitizeSql(text: any, spaces: boolean, regex?: RegExp | null): any {
*
* @returns {object}
*/
function sanitizeObjects(object: any, spaces: boolean): object {
function sanitizeObjects(object: any, spaces?: boolean): object {
/** @type {any} */
let objectUpdated: any = { ...object };
const keys = Object.keys(objectUpdated);
@@ -92,7 +92,7 @@ function sanitizeObjects(object: any, spaces: boolean): object {
*/
function sanitizeArrays(
array: any[],
spaces: boolean
spaces?: boolean
): string[] | number[] | object[] {
let arrayUpdated = _.cloneDeep(array);