{"version":3,"file":"removeSpaces-CNhYTYuz.cjs","names":["isNonEmptyString","isNonEmptyString","isPlainObject"],"sources":["../src/strings/sanitizations/normalizeString.ts","../src/strings/sanitizations/removeSpaces.ts"],"sourcesContent":["import { isNonEmptyString } from \"@/predicates/is/isNonEmptyString\";\n\n/** ----------------------------------------------------------\n * * ***Utility: `normalizeString`.***\n * -----------------------------------------------------------\n * **Normalizes a string by ensuring it is a valid string and trimming whitespace.**\n *\n * ---\n * - **Behavior:**\n *     - If the input is `undefined`, `null`, or an `empty string` after trimming,\n *       it returns an empty string `(\"\")`.\n *\n * ---\n * @param {string | undefined | null} input - The input string to be normalize. If `null` or `undefined`, returns an empty string.\n *\n * ---\n * @returns {string} A trimmed string or an empty string if the input is invalid.\n *\n * ---\n * @example\n * normalizeString(\"   Hello World   \");\n * // ➔ \"Hello World\"\n * normalizeString(\"   Hello    World   \");\n * // ➔ \"Hello    World\"\n * normalizeString(\"\");\n * // ➔ \"\"\n * normalizeString(null);\n * // ➔ \"\"\n * normalizeString(undefined);\n * // ➔ \"\"\n */\nexport const normalizeString = (input: string | null | undefined): string => {\n  return isNonEmptyString(input) ? input.trim() : \"\";\n};\n","import { isPlainObject } from \"@/predicates/is/isPlainObject\";\nimport { isNonEmptyString } from \"@/predicates/is/isNonEmptyString\";\n\ntype RemoveSpacesOptions = {\n  /** ---------------------------------------------------------\n   * * If `true`, only trims the string, defaultValue: `false`.\n   * ----------------------------------------------------------\n   *\n   * @default false\n   */\n  trimOnly?: boolean;\n};\n\n/** -----------------------------------------------------------\n * * ***Utility: `removeSpaces`.***\n * ------------------------------------------------------------\n * **Removes all spaces from a string or trims only, based on the options provided.**\n *\n * ---\n * - **Behavior:**\n *     - If `trimOnly` is `true`, the string is simply trimmed.\n *     - Otherwise, removes **all spaces**, tabs, newlines, etc.\n *     - If the input is `null` or `undefined`, returns an empty string `(\"\")`.\n *\n * ---\n * @param {string | null | undefined} value - The input string to be processed. If `null` or `undefined`, returns an empty string.\n * @param {RemoveSpacesOptions} [options] - The options object.\n * @param {RemoveSpacesOptions[\"trimOnly\"]} [options.trimOnly=false] - If `true`, only trims the string without removing spaces inside.\n *\n * ---\n * @returns {string} The processed string.\n *\n * ---\n * @example\n * removeSpaces(\"  Hello   World  \");\n * // ➔ \"HelloWorld\"\n * removeSpaces(\"  Hello   World  \", { trimOnly: true });\n * // ➔ \"Hello   World\"\n * removeSpaces(null);\n * // ➔ \"\"\n */\nexport const removeSpaces = (\n  value: string | null | undefined,\n  options?: RemoveSpacesOptions\n): string => {\n  if (!isNonEmptyString(value)) return \"\";\n  if (!isPlainObject(options)) options = {};\n\n  const { trimOnly = false } = options;\n\n  if (trimOnly) return value.trim();\n\n  // Remove all spaces (including tabs, newlines, etc.)\n  return value.replace(/\\s+/g, \"\");\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,MAAa,mBAAmB,UAA6C;CAC3E,OAAOA,gCAAiB,KAAK,IAAI,MAAM,KAAK,IAAI;AAClD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACQA,MAAa,gBACX,OACA,YACW;CACX,IAAI,CAACC,gCAAiB,KAAK,GAAG,OAAO;CACrC,IAAI,CAACC,6BAAc,OAAO,GAAG,UAAU,CAAC;CAExC,MAAM,EAAE,WAAW,UAAU;CAE7B,IAAI,UAAU,OAAO,MAAM,KAAK;CAGhC,OAAO,MAAM,QAAQ,QAAQ,EAAE;AACjC"}
