@rzl-zone/utils-js 3.12.1-beta.0 → 3.13.0-beta.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/README.md +15 -35
- package/dist/.references/index.d.cts +1 -3
- package/dist/.references/index.d.ts +1 -3
- package/dist/{assertIsArray-BfAbIUfa.js → assertIsArray-6BcSdNa-.js} +3 -3
- package/dist/{assertIsArray-BfAbIUfa.js.map → assertIsArray-6BcSdNa-.js.map} +1 -1
- package/dist/{assertIsArray-BChqwPiP.cjs → assertIsArray-BqjMoan3.cjs} +3 -3
- package/dist/{assertIsArray-BChqwPiP.cjs.map → assertIsArray-BqjMoan3.cjs.map} +1 -1
- package/dist/{assertIsBoolean-BlBct0Fc.js → assertIsBoolean-Bv6gL-xe.js} +8 -8
- package/dist/assertIsBoolean-Bv6gL-xe.js.map +1 -0
- package/dist/{assertIsBoolean-DozdtbNi.cjs → assertIsBoolean-amRiJHnh.cjs} +8 -8
- package/dist/assertIsBoolean-amRiJHnh.cjs.map +1 -0
- package/dist/{assertIsString-DqV9NwbI.js → assertIsString-1WiUjgqf.js} +3 -3
- package/dist/{assertIsString-DqV9NwbI.js.map → assertIsString-1WiUjgqf.js.map} +1 -1
- package/dist/{assertIsString-Bvk7bUL7.cjs → assertIsString-C0b28AU1.cjs} +3 -3
- package/dist/{assertIsString-Bvk7bUL7.cjs.map → assertIsString-C0b28AU1.cjs.map} +1 -1
- package/dist/assertions/index.cjs +5 -5
- package/dist/assertions/index.d.cts +2 -2
- package/dist/assertions/index.d.ts +2 -2
- package/dist/assertions/index.js +5 -5
- package/dist/conversions/index.cjs +6 -6
- package/dist/conversions/index.d.cts +2 -2
- package/dist/conversions/index.d.ts +2 -2
- package/dist/conversions/index.js +6 -6
- package/dist/{conversions-EMJa3g-D.js → conversions-BrI0GIOr.js} +16 -18
- package/dist/conversions-BrI0GIOr.js.map +1 -0
- package/dist/{conversions-CBs8-REq.cjs → conversions-lvvAYiZs.cjs} +16 -18
- package/dist/conversions-lvvAYiZs.cjs.map +1 -0
- package/dist/events/index.cjs +4 -4
- package/dist/events/index.cjs.map +1 -1
- package/dist/events/index.d.cts +153 -151
- package/dist/events/index.d.ts +153 -151
- package/dist/events/index.js +4 -4
- package/dist/events/index.js.map +1 -1
- package/dist/formatters/index.cjs +2 -2
- package/dist/formatters/index.d.cts +2 -2
- package/dist/formatters/index.d.ts +2 -2
- package/dist/formatters/index.js +2 -2
- package/dist/{formatters-lAYgA11L.cjs → formatters-DQr05EUA.cjs} +17 -15
- package/dist/formatters-DQr05EUA.cjs.map +1 -0
- package/dist/{formatters-QcZO_Cpx.js → formatters-zDzQvtb4.js} +17 -15
- package/dist/formatters-zDzQvtb4.js.map +1 -0
- package/dist/generators/index.cjs +12 -8
- package/dist/generators/index.cjs.map +1 -1
- package/dist/generators/index.d.cts +2 -2
- package/dist/generators/index.d.ts +2 -2
- package/dist/generators/index.js +12 -8
- package/dist/generators/index.js.map +1 -1
- package/dist/index-3jBnthag.d.cts +340 -0
- package/dist/index-BXwimNPA.d.cts +2361 -0
- package/dist/index-BlTCrSyc.d.cts +2158 -0
- package/dist/index-CEm8ZOvj.d.ts +2158 -0
- package/dist/index-CLq5kZmQ.d.cts +822 -0
- package/dist/index-Ckao53JY.d.ts +2361 -0
- package/dist/index-DHHrLc0B.d.ts +947 -0
- package/dist/index-DIeR8qa-.d.ts +340 -0
- package/dist/index-DxZlGbAH.d.ts +1716 -0
- package/dist/index-DyVWeYP3.d.cts +765 -0
- package/dist/index-GSUN6rjA.d.ts +822 -0
- package/dist/index-_dJhBl1h.d.ts +765 -0
- package/dist/index-bMa-0Yr4.d.cts +1716 -0
- package/dist/index-z_uCh5KW.d.cts +947 -0
- package/dist/{isBigInt-B1cijjqm.cjs → isBigInt-CIFRnsdx.cjs} +2 -2
- package/dist/{isBigInt-B1cijjqm.cjs.map → isBigInt-CIFRnsdx.cjs.map} +1 -1
- package/dist/{isBigInt-C0bN0Rhu.js → isBigInt-D-Pu9sxp.js} +2 -2
- package/dist/{isBigInt-C0bN0Rhu.js.map → isBigInt-D-Pu9sxp.js.map} +1 -1
- package/dist/{isEmptyObject-DI42NEo0.cjs → isEmptyObject-CEySmyHK.cjs} +3 -3
- package/dist/{isEmptyObject-DI42NEo0.cjs.map → isEmptyObject-CEySmyHK.cjs.map} +1 -1
- package/dist/{isEmptyObject-DeLVIJpl.js → isEmptyObject-CZ9DLi7R.js} +3 -3
- package/dist/{isEmptyObject-DeLVIJpl.js.map → isEmptyObject-CZ9DLi7R.js.map} +1 -1
- package/dist/{isEmptyString-BTUWYTbw.js → isEmptyString-DFDtBbNr.js} +3 -3
- package/dist/{isEmptyString-BTUWYTbw.js.map → isEmptyString-DFDtBbNr.js.map} +1 -1
- package/dist/{isEmptyString-CCK3bP74.cjs → isEmptyString-DI64RQCy.cjs} +3 -3
- package/dist/{isEmptyString-CCK3bP74.cjs.map → isEmptyString-DI64RQCy.cjs.map} +1 -1
- package/dist/{isEmptyValue-DMSMFTU8.cjs → isEmptyValue-Cw6ovu7z.cjs} +5 -5
- package/dist/{isEmptyValue-DMSMFTU8.cjs.map → isEmptyValue-Cw6ovu7z.cjs.map} +1 -1
- package/dist/{isEmptyValue-fjnfQnt5.js → isEmptyValue-aGyeClwA.js} +5 -5
- package/dist/{isEmptyValue-fjnfQnt5.js.map → isEmptyValue-aGyeClwA.js.map} +1 -1
- package/dist/{isEqual-DhyP8fB_.js → isEqual-Dtb2sXUv.js} +4 -4
- package/dist/{isEqual-DhyP8fB_.js.map → isEqual-Dtb2sXUv.js.map} +1 -1
- package/dist/{isEqual-B1fRgEuU.cjs → isEqual-UsvOwrlY.cjs} +4 -4
- package/dist/{isEqual-B1fRgEuU.cjs.map → isEqual-UsvOwrlY.cjs.map} +1 -1
- package/dist/{isFinite-BYMOo0os.js → isFinite-Cz_IFXuV.js} +3 -3
- package/dist/{isFinite-BYMOo0os.js.map → isFinite-Cz_IFXuV.js.map} +1 -1
- package/dist/{isFinite-sFkps2TY.cjs → isFinite-uukWvxJh.cjs} +3 -3
- package/dist/{isFinite-sFkps2TY.cjs.map → isFinite-uukWvxJh.cjs.map} +1 -1
- package/dist/{isInteger-FTCthMre.cjs → isInteger-DPYjliLZ.cjs} +2 -2
- package/dist/{isInteger-FTCthMre.cjs.map → isInteger-DPYjliLZ.cjs.map} +1 -1
- package/dist/{isInteger-DS9V7l_f.js → isInteger-DZ163OQg.js} +2 -2
- package/dist/{isInteger-DS9V7l_f.js.map → isInteger-DZ163OQg.js.map} +1 -1
- package/dist/isPlainObject-CBABRyEX.d.cts +339 -0
- package/dist/isPlainObject-Dr8gi89U.d.ts +339 -0
- package/dist/{isServer-D1TXfOs3.js → isServer-BDShLyVJ.js} +2 -2
- package/dist/{isServer-D1TXfOs3.js.map → isServer-BDShLyVJ.js.map} +1 -1
- package/dist/{isServer-q-QLFCqE.cjs → isServer-BzDeYuGg.cjs} +2 -2
- package/dist/{isServer-q-QLFCqE.cjs.map → isServer-BzDeYuGg.cjs.map} +1 -1
- package/dist/{isTypedArray-DiCoqffZ.cjs → isTypedArray-DaYAkyrt.cjs} +3 -3
- package/dist/{isTypedArray-DiCoqffZ.cjs.map → isTypedArray-DaYAkyrt.cjs.map} +1 -1
- package/dist/{isTypedArray-47R0wdrc.js → isTypedArray-DuUUA4CL.js} +3 -3
- package/dist/{isTypedArray-47R0wdrc.js.map → isTypedArray-DuUUA4CL.js.map} +1 -1
- package/dist/{isValidDomain-BSXshgkC.cjs → isValidDomain-BxyToAlh.cjs} +74 -8
- package/dist/isValidDomain-BxyToAlh.cjs.map +1 -0
- package/dist/{isValidDomain-DwA2EN79.js → isValidDomain-CTw5vZFY.js} +57 -9
- package/dist/isValidDomain-CTw5vZFY.js.map +1 -0
- package/dist/{noop-B2mTBhW-.cjs → noop-7KrqC9DC.cjs} +2 -2
- package/dist/{noop-B2mTBhW-.cjs.map → noop-7KrqC9DC.cjs.map} +1 -1
- package/dist/{noop-BzktGBVz.js → noop-DGg9vMSD.js} +2 -2
- package/dist/{noop-BzktGBVz.js.map → noop-DGg9vMSD.js.map} +1 -1
- package/dist/{normalizeSpaces-DQHR3Tlr.cjs → normalizeSpaces-B6ZQOZRX.cjs} +3 -3
- package/dist/{normalizeSpaces-DQHR3Tlr.cjs.map → normalizeSpaces-B6ZQOZRX.cjs.map} +1 -1
- package/dist/{normalizeSpaces-WS_iERJk.js → normalizeSpaces-C1eLwykD.js} +3 -3
- package/dist/{normalizeSpaces-WS_iERJk.js.map → normalizeSpaces-C1eLwykD.js.map} +1 -1
- package/dist/operations/index.cjs +10 -10
- package/dist/operations/index.cjs.map +1 -1
- package/dist/operations/index.d.cts +120 -120
- package/dist/operations/index.d.ts +120 -120
- package/dist/operations/index.js +10 -10
- package/dist/operations/index.js.map +1 -1
- package/dist/parsers/index.cjs +2 -2
- package/dist/parsers/index.d.cts +222 -222
- package/dist/parsers/index.d.ts +222 -222
- package/dist/parsers/index.js +2 -2
- package/dist/{parsers-DXtpsDyj.cjs → parsers-DEFpCYhw.cjs} +4 -4
- package/dist/{parsers-DXtpsDyj.cjs.map → parsers-DEFpCYhw.cjs.map} +1 -1
- package/dist/{parsers-Dpuq-V4u.js → parsers-bQQ9mStV.js} +4 -4
- package/dist/{parsers-Dpuq-V4u.js.map → parsers-bQQ9mStV.js.map} +1 -1
- package/dist/{parsing-B43x1sxn.js → parsing-BngARhmu.js} +3 -3
- package/dist/{parsing-B43x1sxn.js.map → parsing-BngARhmu.js.map} +1 -1
- package/dist/{parsing-lRoxn1Nz.cjs → parsing-lI5EN4LY.cjs} +3 -3
- package/dist/{parsing-lRoxn1Nz.cjs.map → parsing-lI5EN4LY.cjs.map} +1 -1
- package/dist/predicates/index.cjs +15 -16
- package/dist/predicates/index.d.cts +3 -3
- package/dist/predicates/index.d.ts +3 -3
- package/dist/predicates/index.js +14 -15
- package/dist/{predicates-DiaYA7Ps.cjs → predicates-CMmP3fPJ.cjs} +15 -16
- package/dist/{predicates-DiaYA7Ps.cjs.map → predicates-CMmP3fPJ.cjs.map} +1 -1
- package/dist/{predicates-gNepszvo.js → predicates-V87QD8hs.js} +13 -14
- package/dist/{predicates-gNepszvo.js.map → predicates-V87QD8hs.js.map} +1 -1
- package/dist/promises/index.cjs +4 -4
- package/dist/promises/index.d.cts +101 -101
- package/dist/promises/index.d.ts +101 -101
- package/dist/promises/index.js +4 -4
- package/dist/{punyCode-hmiFzLWT.js → punyCode-BeFYDjj0.js} +6 -6
- package/dist/punyCode-BeFYDjj0.js.map +1 -0
- package/dist/{punyCode-CTWXVVFo.cjs → punyCode-DmTsB7q_.cjs} +6 -6
- package/dist/punyCode-DmTsB7q_.cjs.map +1 -0
- package/dist/{removeSpaces-BE8lfh-4.js → removeSpaces-B96axxP6.js} +7 -4
- package/dist/removeSpaces-B96axxP6.js.map +1 -0
- package/dist/{removeSpaces-DRRxNWlb.cjs → removeSpaces-C8mu_yp3.cjs} +12 -3
- package/dist/removeSpaces-C8mu_yp3.cjs.map +1 -0
- package/dist/rzl-utils.global.js +21 -0
- package/dist/{safeJsonParse-BBnQElk8.cjs → safeJsonParse-BXbtX_j7.cjs} +9 -9
- package/dist/safeJsonParse-BXbtX_j7.cjs.map +1 -0
- package/dist/{safeJsonParse-CXruaP0p.js → safeJsonParse-DyCsTXlU.js} +9 -9
- package/dist/safeJsonParse-DyCsTXlU.js.map +1 -0
- package/dist/{safeStableStringify-BNh3D0K0.js → safeStableStringify-BrOcdX9n.js} +4 -4
- package/dist/{safeStableStringify-BNh3D0K0.js.map → safeStableStringify-BrOcdX9n.js.map} +1 -1
- package/dist/{safeStableStringify-Cc62pfRp.cjs → safeStableStringify-DRYQ56Dg.cjs} +4 -4
- package/dist/{safeStableStringify-Cc62pfRp.cjs.map → safeStableStringify-DRYQ56Dg.cjs.map} +1 -1
- package/dist/strings/index.cjs +12 -10
- package/dist/strings/index.cjs.map +1 -1
- package/dist/strings/index.d.cts +2 -2
- package/dist/strings/index.d.ts +2 -2
- package/dist/strings/index.js +11 -9
- package/dist/strings/index.js.map +1 -1
- package/dist/tailwind/index.cjs +6 -2
- package/dist/tailwind/index.d.cts +3 -3
- package/dist/tailwind/index.d.ts +3 -3
- package/dist/tailwind/index.js +3 -3
- package/dist/{tailwind-IJvOdkZp.js → tailwind-BZ2_MeNX.js} +18 -8
- package/dist/tailwind-BZ2_MeNX.js.map +1 -0
- package/dist/{tailwind-DJ4cmLUw.cjs → tailwind-C1YtxJ-K.cjs} +39 -5
- package/dist/tailwind-C1YtxJ-K.cjs.map +1 -0
- package/dist/{toStringArrayUnRecursive-xUaU8Ot9.cjs → toStringArrayUnRecursive-D1mPM4wg.cjs} +6 -6
- package/dist/{toStringArrayUnRecursive-xUaU8Ot9.cjs.map → toStringArrayUnRecursive-D1mPM4wg.cjs.map} +1 -1
- package/dist/{toStringArrayUnRecursive-CFs0jTEg.js → toStringArrayUnRecursive-tHp2a7KR.js} +6 -6
- package/dist/{toStringArrayUnRecursive-CFs0jTEg.js.map → toStringArrayUnRecursive-tHp2a7KR.js.map} +1 -1
- package/dist/urls/index.cjs +9 -119
- package/dist/urls/index.d.cts +656 -659
- package/dist/urls/index.d.ts +656 -659
- package/dist/urls/index.js +3 -113
- package/dist/urls-CoxDAoki.js +263 -0
- package/dist/urls-CoxDAoki.js.map +1 -0
- package/dist/urls-DCyx8Wpk.cjs +299 -0
- package/dist/urls-DCyx8Wpk.cjs.map +1 -0
- package/package.json +4 -25
- package/dist/assertIsBoolean-BlBct0Fc.js.map +0 -1
- package/dist/assertIsBoolean-DozdtbNi.cjs.map +0 -1
- package/dist/conversions-CBs8-REq.cjs.map +0 -1
- package/dist/conversions-EMJa3g-D.js.map +0 -1
- package/dist/formatEnvPort-DpIXzPAZ.js +0 -159
- package/dist/formatEnvPort-DpIXzPAZ.js.map +0 -1
- package/dist/formatEnvPort-hHNvOim-.cjs +0 -171
- package/dist/formatEnvPort-hHNvOim-.cjs.map +0 -1
- package/dist/formatters-QcZO_Cpx.js.map +0 -1
- package/dist/formatters-lAYgA11L.cjs.map +0 -1
- package/dist/index-26W7ItWx.d.ts +0 -760
- package/dist/index-BPPQjAfs.d.cts +0 -2359
- package/dist/index-BXjlgBLz.d.cts +0 -2139
- package/dist/index-B_Wwo91H.d.ts +0 -2359
- package/dist/index-CpufydcI.d.cts +0 -704
- package/dist/index-Czc4O526.d.ts +0 -333
- package/dist/index-DPs1_p5G.d.cts +0 -760
- package/dist/index-DRpOyBSC.d.ts +0 -1703
- package/dist/index-DWWvtHUn.d.cts +0 -822
- package/dist/index-DnM0LD0n.d.cts +0 -333
- package/dist/index-GUZ9fK6T.d.ts +0 -2139
- package/dist/index-I4fAzwXV.d.ts +0 -704
- package/dist/index-JDrOl_19.d.ts +0 -822
- package/dist/index-b66P49Qe.d.cts +0 -1703
- package/dist/isPlainObject-DcFGh3_5.d.ts +0 -530
- package/dist/isPlainObject-doTI11Ib.d.cts +0 -530
- package/dist/isURL-CQiowFq2.js +0 -14
- package/dist/isURL-CQiowFq2.js.map +0 -1
- package/dist/isURL-WZypXsax.cjs +0 -20
- package/dist/isURL-WZypXsax.cjs.map +0 -1
- package/dist/isValidDomain-BSXshgkC.cjs.map +0 -1
- package/dist/isValidDomain-DwA2EN79.js.map +0 -1
- package/dist/next/index.cjs +0 -129
- package/dist/next/index.cjs.map +0 -1
- package/dist/next/index.d.cts +0 -226
- package/dist/next/index.d.ts +0 -226
- package/dist/next/index.js +0 -124
- package/dist/next/index.js.map +0 -1
- package/dist/next/server/index.cjs +0 -28
- package/dist/next/server/index.cjs.map +0 -1
- package/dist/next/server/index.d.cts +0 -39
- package/dist/next/server/index.d.ts +0 -39
- package/dist/next/server/index.js +0 -26
- package/dist/next/server/index.js.map +0 -1
- package/dist/normalizeString-2WLth_Gj.js +0 -15
- package/dist/normalizeString-2WLth_Gj.js.map +0 -1
- package/dist/normalizeString-D8euBcRD.cjs +0 -21
- package/dist/normalizeString-D8euBcRD.cjs.map +0 -1
- package/dist/punyCode-CTWXVVFo.cjs.map +0 -1
- package/dist/punyCode-hmiFzLWT.js.map +0 -1
- package/dist/removeSpaces-BE8lfh-4.js.map +0 -1
- package/dist/removeSpaces-DRRxNWlb.cjs.map +0 -1
- package/dist/safeJsonParse-BBnQElk8.cjs.map +0 -1
- package/dist/safeJsonParse-CXruaP0p.js.map +0 -1
- package/dist/tailwind-DJ4cmLUw.cjs.map +0 -1
- package/dist/tailwind-IJvOdkZp.js.map +0 -1
- package/dist/urls/index.cjs.map +0 -1
- package/dist/urls/index.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["isNonEmptyString","isPlainObject","isNonEmptyString","isPlainObject","isString","isEmptyString","isNonEmptyString","isNumber","isString","getPreciseType"],"sources":["../../src/strings/capitalizations/capitalizeFirst.ts","../../src/strings/capitalizations/capitalizeWords.ts","../../src/strings/sanitizations/stripHtmlTags.ts","../../src/strings/utils/getInitialsName.ts","../../src/strings/utils/replaceAt.ts"],"sourcesContent":["import { isPlainObject } from \"@/predicates/is/isPlainObject\";\nimport { isNonEmptyString } from \"@/predicates/is/isNonEmptyString\";\n\ntype CapitalizeFirstOptions = {\n /** If true **(default)**, the rest of the string will be converted to lowercase after capitalizing the first letter.\n *\n * @default true\n */\n lowerCaseNextRest?: boolean;\n /** If true, the string will trimmed, default: `false`.\n *\n * @default false\n */\n trim?: boolean;\n};\n\n/** ----------------------------------------------------------\n * * ***Utility: `capitalizeFirst`.***\n * ----------------------------------------------------------\n * **Capitalizes the first letter of a string, with optionally lowercases the rest and trims whitespace.**\n * @param {string | null | undefined} string - The string to be processed.\n * @param {CapitalizeFirstOptions} [options] - Options to control behavior.\n * @param {CapitalizeFirstOptions[\"lowerCaseNextRest\"]} [options.lowerCaseNextRest=true] - If true, lowercases the rest (next first letter), default: `true`.\n * @param {CapitalizeFirstOptions[\"trim\"]} [options.trim=false] - If true, trims the string before processing, default: `false`.\n * @returns {string} The processed string, returns `\"\"` if input is `null`, `undefined`, or `not a valid string`.\n * @example\n * ```ts\n * capitalizeFirst(\" hello WORLD \");\n * // ➔ \" Hello world\"\n * capitalizeFirst(\" hello WORLD \", { trim: true });\n * // ➔ \"Hello world\"\n * capitalizeFirst(\"FOO\", { lowerCaseNextRest: false });\n * // ➔ \"FOO\"\n * capitalizeFirst(\" foo BAR \", { trim: true, lowerCaseNextRest: false });\n * // ➔ \"Foo BAR\"\n * ```\n * #### ℹ️ If null, undefined, or not a valid string input, return `\"\"`.\n * ```ts\n * capitalizeFirst(123);\n * capitalizeFirst(null);\n * capitalizeFirst(undefined);\n * // ➔ \"\"\n * ```\n */\nexport const capitalizeFirst = (\n string: string | null | undefined,\n options: CapitalizeFirstOptions = {\n lowerCaseNextRest: true,\n trim: false\n }\n): string => {\n if (!isNonEmptyString(string)) return \"\";\n\n if (!isPlainObject(options)) {\n options = {};\n }\n\n const lowerCaseNextRest = options.lowerCaseNextRest !== false;\n const trim = options.trim === true;\n\n if (trim) string = string.trim();\n\n return (\n string[0].toUpperCase() +\n (lowerCaseNextRest ? string.slice(1).toLowerCase() : string.slice(1))\n );\n};\n","import { isPlainObject } from \"@/predicates/is/isPlainObject\";\nimport { isNonEmptyString } from \"@/predicates/is/isNonEmptyString\";\n\ntype CapitalizeWordsOptions = {\n /** If `true`, removes leading and trailing spaces, default `false`.\n *\n * @default false\n */\n trim?: boolean;\n /** If `true`, collapses multiple spaces **between words** into a single space (while preserving leading/trailing spaces), default `false`.\n *\n * @default false\n */\n collapseSpaces?: boolean;\n};\n\n/** ----------------------------------------------------------\n * * ***Utility: `capitalizeWords`.***\n * ----------------------------------------------------------\n * **Capitalizes the first letter of each word in a string while converting the rest to lowercase.**\n * @param {string | null | undefined} value\n * ***The input string to be processed.***\n * - If `null` or `undefined`, returns an empty-string (`\"\"`).\n * @param {CapitalizeWordsOptions} [options]\n * ***Optional settings to control the output:***\n * - `trim`: If `true`, removes leading and trailing spaces, defaultValue: `false`.\n * - `collapseSpaces`: If `true`, collapses multiple spaces **between words** into a single space (while preserving leading/trailing spaces), defaultValue: `false`.\n * @returns {string} A new string where each word starts with an uppercase letter\n * and the remaining letters are lowercase.\n * - If `value` is `empty`, `null`, or `undefined`, returns an `empty-string`.\n * @example\n * ```ts\n * capitalizeWords(\" hello world \");\n * // ➔ \" Hello World \"\n * capitalizeWords(\" hello world \", { trim: true });\n * // ➔ \"Hello World\"\n * capitalizeWords(\" hello world \", { collapseSpaces: true });\n * // ➔ \" Hello World \"\n * capitalizeWords(\" hello world \", { trim: true, collapseSpaces: true });\n * // ➔ \"Hello World\"\n * ```\n * #### ℹ️ If null, undefined, or not a valid string input, return \"\".\n * ```ts\n * capitalizeWords(123);\n * capitalizeWords(null);\n * capitalizeWords(undefined);\n * // ➔ \"\"\n * ```\n */\nexport const capitalizeWords = (\n value: string | null | undefined,\n options: CapitalizeWordsOptions = {\n collapseSpaces: false,\n trim: false\n }\n): string => {\n if (!isNonEmptyString(value)) return \"\";\n\n let result = value;\n\n if (!isPlainObject(options)) {\n options = {};\n }\n\n const collapseSpaces = options.collapseSpaces === true;\n const trim = options.trim === true;\n\n if (trim) {\n result = result.trim();\n }\n\n if (collapseSpaces) {\n const leadingSpaces = result.match(/^\\s*/)?.[0] ?? \"\";\n const trailingSpaces = result.match(/\\s*$/)?.[0] ?? \"\";\n result = result.trim().replace(/\\s+/g, \" \");\n result = `${leadingSpaces}${result}${trailingSpaces}`;\n }\n\n return result\n .toLowerCase()\n .split(\" \")\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n .join(\" \");\n};\n","import type { Extends } from \"@rzl-zone/ts-types-plus\";\nimport { isString } from \"@/predicates/is/isString\";\nimport { isEmptyString } from \"@/predicates/is/isEmptyString\";\n\n/** ----------------------------------------------------------\n * * ***Utility: `stripHtmlTags`.***\n * ----------------------------------------------------------\n * **This function removes valid HTML tags (including nested and self-closing ones)\n * by replacing them with spaces, then collapses multiple whitespaces into a single space.**\n * - **It handles the following cases:**\n * - If the input is not a string (`null`, `undefined`, or any non-string), it is returned as undefined.\n * - If the input is an empty or whitespace-only string, it returns an empty string (`\"\"`).\n * - Otherwise, it returns the cleaned string with tags removed and normalized whitespace.\n * @template T - Input string type (string | null | undefined).\n * @param {string | null | undefined} input - A string potentially containing HTML tags.\n * @returns {string | undefined} Cleaned string if input is string, or original input otherwise.\n * @example\n * stripHtmlTags(\"<p>Hello</p>\");\n * // ➔ \"Hello\"\n * stripHtmlTags(\"<div><b>Bold</b> text</div>\");\n * // ➔ \"Bold text\"\n * stripHtmlTags(\"Line<br/>Break\");\n * // ➔ \"Line Break\"\n * stripHtmlTags(\"2 < 5 and 5 > 2\");\n * // ➔ \"2 < 5 and 5 > 2\"\n * stripHtmlTags(\"\");\n * // ➔ \"\"\n * stripHtmlTags(\" \");\n * // ➔ \"\"\n * stripHtmlTags(null);\n * // ➔ undefined\n * stripHtmlTags(undefined);\n * // ➔ undefined\n */\nexport function stripHtmlTags(input: string): string;\nexport function stripHtmlTags<T>(\n input: T\n): Extends<string, T> extends true ? string | undefined : undefined;\nexport function stripHtmlTags(input: unknown) {\n if (!isString(input)) {\n return undefined;\n }\n\n if (isEmptyString(input)) {\n return \"\";\n }\n\n // return input.replace(/<[^>]*>/g, \"\");\n const stripped = input.replace(/<\\/?[a-zA-Z][^<>]*\\/?>/g, \" \").trim();\n\n const cleaned = stripped.replace(/\\s+/g, \" \").trim();\n\n return cleaned;\n}\n","import { isNonEmptyString } from \"@/predicates/is/isNonEmptyString\";\n\n/** ----------------------------------------------------------\n * * ***Utility: `getInitialsName`.***\n * ----------------------------------------------------------\n * **Extracts initials from the given name string.**\n * - **Behavior:**\n * - For names with two or more words, returns the first letter of the first and second words.\n * - For a single word with 2+ characters, returns the first two letters.\n * - For a single character, returns that character.\n * - For `empty`, `null`, `undefined` or `whitespace-only input`, returns an empty string (`\"\"`).\n * @param {string | null | undefined} name - The name to extract initials from.\n * @returns {string} The extracted initials (e.g., \"JD\" for \"John Doe\").\n * @example\n * getInitialsName(\"Alice\"); // ➔ \"AL\"\n * getInitialsName(\"John Doe\"); // ➔ \"JD\"\n * getInitialsName(\" Bob Marley \"); // ➔ \"BM\"\n * getInitialsName(\"John Ronald Donal\"); // ➔ \"JR\"\n * getInitialsName(\"Lord John Doe Moe\"); // ➔ \"LJ\"\n * getInitialsName(\"X\"); // ➔ \"X\"\n * getInitialsName(\"\"); // ➔ \"\" (empty string)\n * getInitialsName(\" \"); // ➔ \"\" (empty string)\n * getInitialsName(null); // ➔ \"\" (null input)\n * getInitialsName(undefined); // ➔ \"\" (undefined input)\n */\nexport const getInitialsName = (name: string | null | undefined): string => {\n if (!isNonEmptyString(name)) return \"\"; // Handle empty string case\n\n // Trim spaces and remove duplicate spaces\n name = name.replace(/\\s+/g, \" \").trim();\n\n const nameParts = name.split(\" \");\n\n if (nameParts.length > 1) {\n // First letter of first and second words\n return nameParts[0][0] + nameParts[1][0].toUpperCase();\n }\n\n return name.length > 1\n ? name.substring(0, 2).toUpperCase()\n : // First two letters for single-word names\n name[0].toUpperCase();\n};\n","import { isNumber } from \"@/predicates/is/isNumber\";\nimport { isString } from \"@/predicates/is/isString\";\nimport { getPreciseType } from \"@/predicates/type/getPreciseType\";\n\n/** ----------------------------------------------------------\n * * ***Utility: `replaceAt`.***\n * ----------------------------------------------------------\n * **Replaces exactly one character at the specified index in the original string\n * with the provided `replaceTo` string.**\n * - **Behavior:**\n * - If `replaceTo` has more than one character,\n * the result will expand accordingly.\n * @param {number} index - The starting index where the replacement should occur.\n * @param {string} originalString - The original string to modify.\n * @param {string} replaceTo - The string to insert at the specified index.\n * @returns {string} The modified string with the replacement applied.\n * @example\n * replaceAt(3, \"hello\", \"X\");\n * // ➔ \"helXo\"\n * replaceAt(1, \"world\", \"AB\");\n * // ➔ \"wABrld\"\n * replaceAt(0, \"cat\", \"br\");\n * // ➔ \"brat\"\n * replaceAt(2, \"12345\", \"-\");\n * // ➔ \"12-45\"\n * replaceAt(4, \"ABCDE\", \"Z\");\n * // ➔ \"ABCDZ\"\n * // ❌ Examples that throw:\n * replaceAt(10, \"short\", \"X\");\n * // ➔ ❌ RangeError: First parameter (`index`) is out of range from second parameter `originalString`.\n * replaceAt(-1, \"test\", \"X\");\n * // ➔ ❌ RangeError: First parameter (`index`) is out of range from second parameter `originalString`.\n * replaceAt(\"1\", \"test\", \"X\");\n * // ➔ ❌ TypeError: First parameter `index` must be of type `number`, second parameter `originalString` and third parameter `replaceTo` must be of type `string`, but received: \"['index': `string`,...].\"\n * replaceAt(2, null, \"X\");\n * // ➔ ❌ TypeError: First parameter `index` must be of type `number`, second parameter `originalString` and third parameter `replaceTo` must be of type `string`, but received: \"['index': `string`,...].\"\n */\nexport const replaceAt = (\n index: number,\n originalString: string,\n replaceTo: string\n): string => {\n if (!isNumber(index) || !isString(replaceTo) || !isString(originalString)) {\n throw new TypeError(\n `First parameter (\\`index\\`) must be of type \\`number\\`, second parameter (\\`originalString\\`) and third parameter (\\`replaceTo\\`) must be of type \\`string\\`, but received: \"['index': \\`${getPreciseType(\n index\n )}\\`, 'originalString': \\`${getPreciseType(\n originalString\n )}\\`, 'replaceTo': \\`${getPreciseType(replaceTo)}\\`]\".`\n );\n }\n\n // Handle edge cases\n if (index < 0 || index >= originalString.length) {\n throw new RangeError(\n \"First parameter (`index`) is out of range from second parameter (`originalString`).\"\n );\n }\n\n return (\n originalString.slice(0, index) + // Extract before the index\n replaceTo + // Insert replacement\n originalString.slice(index + 1) // Extract after replacement\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4CA,MAAa,mBACX,QACA,UAAkC;CAChC,mBAAmB;CACnB,MAAM;CACP,KACU;CACX,IAAI,CAACA,yCAAiB,OAAO,EAAE,OAAO;CAEtC,IAAI,CAACC,sCAAc,QAAQ,EACzB,UAAU,EAAE;CAGd,MAAM,oBAAoB,QAAQ,sBAAsB;CAGxD,IAFa,QAAQ,SAAS,MAEpB,SAAS,OAAO,MAAM;CAEhC,OACE,OAAO,GAAG,aAAa,IACtB,oBAAoB,OAAO,MAAM,EAAE,CAAC,aAAa,GAAG,OAAO,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACfxE,MAAa,mBACX,OACA,UAAkC;CAChC,gBAAgB;CAChB,MAAM;CACP,KACU;CACX,IAAI,CAACC,yCAAiB,MAAM,EAAE,OAAO;CAErC,IAAI,SAAS;CAEb,IAAI,CAACC,sCAAc,QAAQ,EACzB,UAAU,EAAE;CAGd,MAAM,iBAAiB,QAAQ,mBAAmB;CAGlD,IAFa,QAAQ,SAAS,MAG5B,SAAS,OAAO,MAAM;CAGxB,IAAI,gBAAgB;EAClB,MAAM,gBAAgB,OAAO,MAAM,OAAO,GAAG,MAAM;EACnD,MAAM,iBAAiB,OAAO,MAAM,OAAO,GAAG,MAAM;EACpD,SAAS,OAAO,MAAM,CAAC,QAAQ,QAAQ,IAAI;EAC3C,SAAS,GAAG,gBAAgB,SAAS;;CAGvC,OAAO,OACJ,aAAa,CACb,MAAM,IAAI,CACV,KAAK,SAAS,KAAK,OAAO,EAAE,CAAC,aAAa,GAAG,KAAK,MAAM,EAAE,CAAC,CAC3D,KAAK,IAAI;;;;;AC5Cd,SAAgB,cAAc,OAAgB;CAC5C,IAAI,CAACC,iCAAS,MAAM,EAClB;CAGF,IAAIC,oCAAc,MAAM,EACtB,OAAO;CAQT,OAJiB,MAAM,QAAQ,2BAA2B,IAAI,CAAC,MAEvC,CAAC,QAAQ,QAAQ,IAAI,CAAC,MAEhC;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC3BhB,MAAa,mBAAmB,SAA4C;CAC1E,IAAI,CAACC,yCAAiB,KAAK,EAAE,OAAO;CAGpC,OAAO,KAAK,QAAQ,QAAQ,IAAI,CAAC,MAAM;CAEvC,MAAM,YAAY,KAAK,MAAM,IAAI;CAEjC,IAAI,UAAU,SAAS,GAErB,OAAO,UAAU,GAAG,KAAK,UAAU,GAAG,GAAG,aAAa;CAGxD,OAAO,KAAK,SAAS,IACjB,KAAK,UAAU,GAAG,EAAE,CAAC,aAAa,GAElC,KAAK,GAAG,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACJ3B,MAAa,aACX,OACA,gBACA,cACW;CACX,IAAI,CAACC,iCAAS,MAAM,IAAI,CAACC,iCAAS,UAAU,IAAI,CAACA,iCAAS,eAAe,EACvE,MAAM,IAAI,UACR,4LAA4LC,uCAC1L,MACD,CAAC,0BAA0BA,uCAC1B,eACD,CAAC,qBAAqBA,uCAAe,UAAU,CAAC,OAClD;CAIH,IAAI,QAAQ,KAAK,SAAS,eAAe,QACvC,MAAM,IAAI,WACR,sFACD;CAGH,OACE,eAAe,MAAM,GAAG,MAAM,GAC9B,YACA,eAAe,MAAM,QAAQ,EAAE"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["isNonEmptyString","isPlainObject","isNonEmptyString","isPlainObject","isString","isEmptyString","isNonEmptyString","isNumber","isString","getPreciseType"],"sources":["../../src/strings/capitalizations/capitalizeFirst.ts","../../src/strings/capitalizations/capitalizeWords.ts","../../src/strings/sanitizations/stripHtmlTags.ts","../../src/strings/utils/getInitialsName.ts","../../src/strings/utils/replaceAt.ts"],"sourcesContent":["import { isPlainObject } from \"@/predicates/is/isPlainObject\";\nimport { isNonEmptyString } from \"@/predicates/is/isNonEmptyString\";\n\ntype CapitalizeFirstOptions = {\n /** If true **(default)**, the rest of the string will be converted to lowercase after capitalizing the first letter.\n *\n * @default true\n */\n lowerCaseNextRest?: boolean;\n /** If true, the string will trimmed, default: `false`.\n *\n * @default false\n */\n trim?: boolean;\n};\n\n/** ----------------------------------------------------------\n * * ***Utility: `capitalizeFirst`.***\n * ----------------------------------------------------------\n * **Capitalizes the first letter of a string, with optionally lowercases the rest and trims whitespace.**\n * @param {string | null | undefined} string - The string to be processed.\n * @param {CapitalizeFirstOptions} [options] - Options to control behavior.\n * @param {CapitalizeFirstOptions[\"lowerCaseNextRest\"]} [options.lowerCaseNextRest=true] - If true, lowercases the rest (next first letter), default: `true`.\n * @param {CapitalizeFirstOptions[\"trim\"]} [options.trim=false] - If true, trims the string before processing, default: `false`.\n * @returns {string} The processed string, returns `\"\"` if input is `null`, `undefined`, or `not a valid string`.\n * @example\n * ```ts\n * capitalizeFirst(\" hello WORLD \");\n * // ➔ \" Hello world\"\n * capitalizeFirst(\" hello WORLD \", { trim: true });\n * // ➔ \"Hello world\"\n * capitalizeFirst(\"FOO\", { lowerCaseNextRest: false });\n * // ➔ \"FOO\"\n * capitalizeFirst(\" foo BAR \", { trim: true, lowerCaseNextRest: false });\n * // ➔ \"Foo BAR\"\n * ```\n * #### ℹ️ If null, undefined, or not a valid string input, return `\"\"`.\n * ```ts\n * capitalizeFirst(123);\n * capitalizeFirst(null);\n * capitalizeFirst(undefined);\n * // ➔ \"\"\n * ```\n */\nexport const capitalizeFirst = (\n string: string | null | undefined,\n options: CapitalizeFirstOptions = {\n lowerCaseNextRest: true,\n trim: false\n }\n): string => {\n if (!isNonEmptyString(string)) return \"\";\n\n if (!isPlainObject(options)) {\n options = {};\n }\n\n const lowerCaseNextRest = options.lowerCaseNextRest !== false;\n const trim = options.trim === true;\n\n if (trim) string = string.trim();\n\n return (\n (string[0] ? string[0].toUpperCase() : \"\") +\n (lowerCaseNextRest ? string.slice(1).toLowerCase() : string.slice(1))\n );\n};\n","import { isPlainObject } from \"@/predicates/is/isPlainObject\";\nimport { isNonEmptyString } from \"@/predicates/is/isNonEmptyString\";\n\ntype CapitalizeWordsOptions = {\n /** If `true`, removes leading and trailing spaces, default `false`.\n *\n * @default false\n */\n trim?: boolean;\n /** If `true`, collapses multiple spaces **between words** into a single space (while preserving leading/trailing spaces), default `false`.\n *\n * @default false\n */\n collapseSpaces?: boolean;\n};\n\n/** ----------------------------------------------------------\n * * ***Utility: `capitalizeWords`.***\n * ----------------------------------------------------------\n * **Capitalizes the first letter of each word in a string while converting the rest to lowercase.**\n * @param {string | null | undefined} value\n * ***The input string to be processed.***\n * - If `null` or `undefined`, returns an empty-string (`\"\"`).\n * @param {CapitalizeWordsOptions} [options]\n * ***Optional settings to control the output:***\n * - `trim`: If `true`, removes leading and trailing spaces, defaultValue: `false`.\n * - `collapseSpaces`: If `true`, collapses multiple spaces **between words** into a single space (while preserving leading/trailing spaces), defaultValue: `false`.\n * @returns {string} A new string where each word starts with an uppercase letter\n * and the remaining letters are lowercase.\n * - If `value` is `empty`, `null`, or `undefined`, returns an `empty-string`.\n * @example\n * ```ts\n * capitalizeWords(\" hello world \");\n * // ➔ \" Hello World \"\n * capitalizeWords(\" hello world \", { trim: true });\n * // ➔ \"Hello World\"\n * capitalizeWords(\" hello world \", { collapseSpaces: true });\n * // ➔ \" Hello World \"\n * capitalizeWords(\" hello world \", { trim: true, collapseSpaces: true });\n * // ➔ \"Hello World\"\n * ```\n * #### ℹ️ If null, undefined, or not a valid string input, return \"\".\n * ```ts\n * capitalizeWords(123);\n * capitalizeWords(null);\n * capitalizeWords(undefined);\n * // ➔ \"\"\n * ```\n */\nexport const capitalizeWords = (\n value: string | null | undefined,\n options: CapitalizeWordsOptions = {\n collapseSpaces: false,\n trim: false\n }\n): string => {\n if (!isNonEmptyString(value)) return \"\";\n\n let result = value;\n\n if (!isPlainObject(options)) {\n options = {};\n }\n\n const collapseSpaces = options.collapseSpaces === true;\n const trim = options.trim === true;\n\n if (trim) {\n result = result.trim();\n }\n\n if (collapseSpaces) {\n const leadingSpaces = result.match(/^\\s*/)?.[0] ?? \"\";\n const trailingSpaces = result.match(/\\s*$/)?.[0] ?? \"\";\n result = result.trim().replace(/\\s+/g, \" \");\n result = `${leadingSpaces}${result}${trailingSpaces}`;\n }\n\n return result\n .toLowerCase()\n .split(\" \")\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n .join(\" \");\n};\n","import type { Extends } from \"@rzl-zone/ts-types-plus\";\nimport { isString } from \"@/predicates/is/isString\";\nimport { isEmptyString } from \"@/predicates/is/isEmptyString\";\n\n/** ----------------------------------------------------------\n * * ***Utility: `stripHtmlTags`.***\n * ----------------------------------------------------------\n * **This function removes valid HTML tags (including nested and self-closing ones)\n * by replacing them with spaces, then collapses multiple whitespaces into a single space.**\n * - **It handles the following cases:**\n * - If the input is not a string (`null`, `undefined`, or any non-string), it is returned as undefined.\n * - If the input is an empty or whitespace-only string, it returns an empty string (`\"\"`).\n * - Otherwise, it returns the cleaned string with tags removed and normalized whitespace.\n * @template T - Input string type (string | null | undefined).\n * @param {string | null | undefined} input - A string potentially containing HTML tags.\n * @returns {string | undefined} Cleaned string if input is string, or original input otherwise.\n * @example\n * stripHtmlTags(\"<p>Hello</p>\");\n * // ➔ \"Hello\"\n * stripHtmlTags(\"<div><b>Bold</b> text</div>\");\n * // ➔ \"Bold text\"\n * stripHtmlTags(\"Line<br/>Break\");\n * // ➔ \"Line Break\"\n * stripHtmlTags(\"2 < 5 and 5 > 2\");\n * // ➔ \"2 < 5 and 5 > 2\"\n * stripHtmlTags(\"\");\n * // ➔ \"\"\n * stripHtmlTags(\" \");\n * // ➔ \"\"\n * stripHtmlTags(null);\n * // ➔ undefined\n * stripHtmlTags(undefined);\n * // ➔ undefined\n */\nexport function stripHtmlTags(input: string): string;\nexport function stripHtmlTags<T>(\n input: T\n): Extends<string, T> extends true ? string | undefined : undefined;\nexport function stripHtmlTags(input: unknown) {\n if (!isString(input)) {\n return undefined;\n }\n\n if (isEmptyString(input)) {\n return \"\";\n }\n\n // return input.replace(/<[^>]*>/g, \"\");\n const stripped = input.replace(/<\\/?[a-zA-Z][^<>]*\\/?>/g, \" \").trim();\n\n const cleaned = stripped.replace(/\\s+/g, \" \").trim();\n\n return cleaned;\n}\n","import { isNonEmptyString } from \"@/predicates/is/isNonEmptyString\";\n\n/** ----------------------------------------------------------\n * * ***Utility: `getInitialsName`.***\n * ----------------------------------------------------------\n * **Extracts initials from the given name string.**\n * - **Behavior:**\n * - For names with two or more words, returns the first letter of the first and second words.\n * - For a single word with 2+ characters, returns the first two letters.\n * - For a single character, returns that character.\n * - For `empty`, `null`, `undefined` or `whitespace-only input`, returns an empty string (`\"\"`).\n * @param {string | null | undefined} name - The name to extract initials from.\n * @returns {string} The extracted initials (e.g., \"JD\" for \"John Doe\").\n * @example\n * getInitialsName(\"Alice\"); // ➔ \"AL\"\n * getInitialsName(\"John Doe\"); // ➔ \"JD\"\n * getInitialsName(\" Bob Marley \"); // ➔ \"BM\"\n * getInitialsName(\"John Ronald Donal\"); // ➔ \"JR\"\n * getInitialsName(\"Lord John Doe Moe\"); // ➔ \"LJ\"\n * getInitialsName(\"X\"); // ➔ \"X\"\n * getInitialsName(\"\"); // ➔ \"\" (empty string)\n * getInitialsName(\" \"); // ➔ \"\" (empty string)\n * getInitialsName(null); // ➔ \"\" (null input)\n * getInitialsName(undefined); // ➔ \"\" (undefined input)\n */\nexport const getInitialsName = (name: string | null | undefined): string => {\n if (!isNonEmptyString(name)) return \"\"; // Handle empty string case\n\n // Trim spaces and remove duplicate spaces\n name = name.replace(/\\s+/g, \" \").trim();\n\n const nameParts = name.split(\" \");\n\n if (nameParts.length > 1) {\n if (!(nameParts[0] && nameParts[1] && nameParts[1][0])) return \"\";\n\n // First letter of first and second words\n return (nameParts[0][0] + nameParts[1][0]).toUpperCase();\n }\n\n return name.length > 1\n ? name.substring(0, 2).toUpperCase()\n : // First two letters for single-word names\n (name[0]?.toUpperCase() ?? \"\");\n};\n","import { isNumber } from \"@/predicates/is/isNumber\";\nimport { isString } from \"@/predicates/is/isString\";\nimport { getPreciseType } from \"@/predicates/type/getPreciseType\";\n\n/** ----------------------------------------------------------\n * * ***Utility: `replaceAt`.***\n * ----------------------------------------------------------\n * **Replaces exactly one character at the specified index in the original string\n * with the provided `replaceTo` string.**\n * - **Behavior:**\n * - If `replaceTo` has more than one character,\n * the result will expand accordingly.\n * @param {number} index - The starting index where the replacement should occur.\n * @param {string} originalString - The original string to modify.\n * @param {string} replaceTo - The string to insert at the specified index.\n * @returns {string} The modified string with the replacement applied.\n * @example\n * replaceAt(3, \"hello\", \"X\");\n * // ➔ \"helXo\"\n * replaceAt(1, \"world\", \"AB\");\n * // ➔ \"wABrld\"\n * replaceAt(0, \"cat\", \"br\");\n * // ➔ \"brat\"\n * replaceAt(2, \"12345\", \"-\");\n * // ➔ \"12-45\"\n * replaceAt(4, \"ABCDE\", \"Z\");\n * // ➔ \"ABCDZ\"\n * // ❌ Examples that throw:\n * replaceAt(10, \"short\", \"X\");\n * // ➔ ❌ RangeError: First parameter (`index`) is out of range from second parameter `originalString`.\n * replaceAt(-1, \"test\", \"X\");\n * // ➔ ❌ RangeError: First parameter (`index`) is out of range from second parameter `originalString`.\n * replaceAt(\"1\", \"test\", \"X\");\n * // ➔ ❌ TypeError: First parameter `index` must be of type `number`, second parameter `originalString` and third parameter `replaceTo` must be of type `string`, but received: \"['index': `string`,...].\"\n * replaceAt(2, null, \"X\");\n * // ➔ ❌ TypeError: First parameter `index` must be of type `number`, second parameter `originalString` and third parameter `replaceTo` must be of type `string`, but received: \"['index': `string`,...].\"\n */\nexport const replaceAt = (\n index: number,\n originalString: string,\n replaceTo: string\n): string => {\n if (!isNumber(index) || !isString(replaceTo) || !isString(originalString)) {\n throw new TypeError(\n `First parameter (\\`index\\`) must be of type \\`number\\`, second parameter (\\`originalString\\`) and third parameter (\\`replaceTo\\`) must be of type \\`string\\`, but received: \"['index': \\`${getPreciseType(\n index\n )}\\`, 'originalString': \\`${getPreciseType(\n originalString\n )}\\`, 'replaceTo': \\`${getPreciseType(replaceTo)}\\`]\".`\n );\n }\n\n // Handle edge cases\n if (index < 0 || index >= originalString.length) {\n throw new RangeError(\n \"First parameter (`index`) is out of range from second parameter (`originalString`).\"\n );\n }\n\n return (\n originalString.slice(0, index) + // Extract before the index\n replaceTo + // Insert replacement\n originalString.slice(index + 1) // Extract after replacement\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4CA,MAAa,mBACX,QACA,UAAkC;CAChC,mBAAmB;CACnB,MAAM;CACP,KACU;CACX,IAAI,CAACA,yCAAiB,OAAO,EAAE,OAAO;CAEtC,IAAI,CAACC,sCAAc,QAAQ,EACzB,UAAU,EAAE;CAGd,MAAM,oBAAoB,QAAQ,sBAAsB;CAGxD,IAFa,QAAQ,SAAS,MAEpB,SAAS,OAAO,MAAM;CAEhC,QACG,OAAO,KAAK,OAAO,GAAG,aAAa,GAAG,OACtC,oBAAoB,OAAO,MAAM,EAAE,CAAC,aAAa,GAAG,OAAO,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACfxE,MAAa,mBACX,OACA,UAAkC;CAChC,gBAAgB;CAChB,MAAM;CACP,KACU;CACX,IAAI,CAACC,yCAAiB,MAAM,EAAE,OAAO;CAErC,IAAI,SAAS;CAEb,IAAI,CAACC,sCAAc,QAAQ,EACzB,UAAU,EAAE;CAGd,MAAM,iBAAiB,QAAQ,mBAAmB;CAGlD,IAFa,QAAQ,SAAS,MAG5B,SAAS,OAAO,MAAM;CAGxB,IAAI,gBAAgB;EAClB,MAAM,gBAAgB,OAAO,MAAM,OAAO,GAAG,MAAM;EACnD,MAAM,iBAAiB,OAAO,MAAM,OAAO,GAAG,MAAM;EACpD,SAAS,OAAO,MAAM,CAAC,QAAQ,QAAQ,IAAI;EAC3C,SAAS,GAAG,gBAAgB,SAAS;;CAGvC,OAAO,OACJ,aAAa,CACb,MAAM,IAAI,CACV,KAAK,SAAS,KAAK,OAAO,EAAE,CAAC,aAAa,GAAG,KAAK,MAAM,EAAE,CAAC,CAC3D,KAAK,IAAI;;;;;AC5Cd,SAAgB,cAAc,OAAgB;CAC5C,IAAI,CAACC,iCAAS,MAAM,EAClB;CAGF,IAAIC,oCAAc,MAAM,EACtB,OAAO;CAQT,OAJiB,MAAM,QAAQ,2BAA2B,IAAI,CAAC,MAEvC,CAAC,QAAQ,QAAQ,IAAI,CAAC,MAEhC;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC3BhB,MAAa,mBAAmB,SAA4C;CAC1E,IAAI,CAACC,yCAAiB,KAAK,EAAE,OAAO;CAGpC,OAAO,KAAK,QAAQ,QAAQ,IAAI,CAAC,MAAM;CAEvC,MAAM,YAAY,KAAK,MAAM,IAAI;CAEjC,IAAI,UAAU,SAAS,GAAG;EACxB,IAAI,EAAE,UAAU,MAAM,UAAU,MAAM,UAAU,GAAG,KAAK,OAAO;EAG/D,QAAQ,UAAU,GAAG,KAAK,UAAU,GAAG,IAAI,aAAa;;CAG1D,OAAO,KAAK,SAAS,IACjB,KAAK,UAAU,GAAG,EAAE,CAAC,aAAa,GAEjC,KAAK,IAAI,aAAa,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACNjC,MAAa,aACX,OACA,gBACA,cACW;CACX,IAAI,CAACC,iCAAS,MAAM,IAAI,CAACC,iCAAS,UAAU,IAAI,CAACA,iCAAS,eAAe,EACvE,MAAM,IAAI,UACR,4LAA4LC,uCAC1L,MACD,CAAC,0BAA0BA,uCAC1B,eACD,CAAC,qBAAqBA,uCAAe,UAAU,CAAC,OAClD;CAIH,IAAI,QAAQ,KAAK,SAAS,eAAe,QACvC,MAAM,IAAI,WACR,sFACD;CAGH,OACE,eAAe,MAAM,GAAG,MAAM,GAC9B,YACA,eAAe,MAAM,QAAQ,EAAE"}
|
package/dist/strings/index.d.cts
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/utils-js
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `3.
|
|
5
|
+
* Version: `3.13.0-beta.2`
|
|
6
6
|
* Author: `Rizalvin Dwiky <rizalvindwiky@gmail.com>`
|
|
7
7
|
* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/utils-js`
|
|
8
8
|
* ========================================================================
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import { a as normalizeString, c as toPascalCaseSpace, d as toKebabCase, f as toDotCase, g as capitalizeFirst, h as capitalizeWords, i as removeSpaces, l as toPascalCase, m as slugify, n as getInitialsName, o as normalizeSpaces, p as toCamelCase, r as stripHtmlTags, s as toSnakeCase, t as replaceAt, u as toLowerCase } from "../index-
|
|
11
|
+
import { a as normalizeString, c as toPascalCaseSpace, d as toKebabCase, f as toDotCase, g as capitalizeFirst, h as capitalizeWords, i as removeSpaces, l as toPascalCase, m as slugify, n as getInitialsName, o as normalizeSpaces, p as toCamelCase, r as stripHtmlTags, s as toSnakeCase, t as replaceAt, u as toLowerCase } from "../index-DyVWeYP3.cjs";
|
|
12
12
|
export { capitalizeFirst, capitalizeWords, getInitialsName, normalizeSpaces, normalizeString, removeSpaces, replaceAt, slugify, stripHtmlTags, toCamelCase, toDotCase, toKebabCase, toLowerCase, toPascalCase, toPascalCaseSpace, toSnakeCase };
|
package/dist/strings/index.d.ts
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/utils-js
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `3.
|
|
5
|
+
* Version: `3.13.0-beta.2`
|
|
6
6
|
* Author: `Rizalvin Dwiky <rizalvindwiky@gmail.com>`
|
|
7
7
|
* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/utils-js`
|
|
8
8
|
* ========================================================================
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import { a as normalizeString, c as toPascalCaseSpace, d as toKebabCase, f as toDotCase, g as capitalizeFirst, h as capitalizeWords, i as removeSpaces, l as toPascalCase, m as slugify, n as getInitialsName, o as normalizeSpaces, p as toCamelCase, r as stripHtmlTags, s as toSnakeCase, t as replaceAt, u as toLowerCase } from "../index-
|
|
11
|
+
import { a as normalizeString, c as toPascalCaseSpace, d as toKebabCase, f as toDotCase, g as capitalizeFirst, h as capitalizeWords, i as removeSpaces, l as toPascalCase, m as slugify, n as getInitialsName, o as normalizeSpaces, p as toCamelCase, r as stripHtmlTags, s as toSnakeCase, t as replaceAt, u as toLowerCase } from "../index-_dJhBl1h.js";
|
|
12
12
|
export { capitalizeFirst, capitalizeWords, getInitialsName, normalizeSpaces, normalizeString, removeSpaces, replaceAt, slugify, stripHtmlTags, toCamelCase, toDotCase, toKebabCase, toLowerCase, toPascalCase, toPascalCaseSpace, toSnakeCase };
|
package/dist/strings/index.js
CHANGED
|
@@ -2,16 +2,15 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/utils-js
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `3.
|
|
5
|
+
* Version: `3.13.0-beta.2`
|
|
6
6
|
* Author: `Rizalvin Dwiky <rizalvindwiky@gmail.com>`
|
|
7
7
|
* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/utils-js`
|
|
8
8
|
* ========================================================================
|
|
9
9
|
*/
|
|
10
|
-
import { A as isPlainObject, a as toPascalCase, c as toKebabCase, d as slugify, i as toPascalCaseSpace, k as isString, l as toCamelCase, o as toLowerCase, r as getPreciseType, s as toSnakeCase, u as toDotCase, w as isNumber, y as isNonEmptyString } from "../assertIsBoolean-
|
|
11
|
-
import { t as isEmptyString } from "../isEmptyString-
|
|
12
|
-
import { t as normalizeSpaces } from "../normalizeSpaces-
|
|
13
|
-
import {
|
|
14
|
-
import { t as removeSpaces } from "../removeSpaces-BE8lfh-4.js";
|
|
10
|
+
import { A as isPlainObject, a as toPascalCase, c as toKebabCase, d as slugify, i as toPascalCaseSpace, k as isString, l as toCamelCase, o as toLowerCase, r as getPreciseType, s as toSnakeCase, u as toDotCase, w as isNumber, y as isNonEmptyString } from "../assertIsBoolean-Bv6gL-xe.js";
|
|
11
|
+
import { t as isEmptyString } from "../isEmptyString-DFDtBbNr.js";
|
|
12
|
+
import { t as normalizeSpaces } from "../normalizeSpaces-C1eLwykD.js";
|
|
13
|
+
import { n as normalizeString, t as removeSpaces } from "../removeSpaces-B96axxP6.js";
|
|
15
14
|
const capitalizeFirst = (string, options = {
|
|
16
15
|
lowerCaseNextRest: true,
|
|
17
16
|
trim: false
|
|
@@ -20,7 +19,7 @@ const capitalizeFirst = (string, options = {
|
|
|
20
19
|
if (!isPlainObject(options)) options = {};
|
|
21
20
|
const lowerCaseNextRest = options.lowerCaseNextRest !== false;
|
|
22
21
|
if (options.trim === true) string = string.trim();
|
|
23
|
-
return string[0].toUpperCase() + (lowerCaseNextRest ? string.slice(1).toLowerCase() : string.slice(1));
|
|
22
|
+
return (string[0] ? string[0].toUpperCase() : "") + (lowerCaseNextRest ? string.slice(1).toLowerCase() : string.slice(1));
|
|
24
23
|
};
|
|
25
24
|
const capitalizeWords = (value, options = {
|
|
26
25
|
collapseSpaces: false,
|
|
@@ -48,8 +47,11 @@ const getInitialsName = (name) => {
|
|
|
48
47
|
if (!isNonEmptyString(name)) return "";
|
|
49
48
|
name = name.replace(/\s+/g, " ").trim();
|
|
50
49
|
const nameParts = name.split(" ");
|
|
51
|
-
if (nameParts.length > 1)
|
|
52
|
-
|
|
50
|
+
if (nameParts.length > 1) {
|
|
51
|
+
if (!(nameParts[0] && nameParts[1] && nameParts[1][0])) return "";
|
|
52
|
+
return (nameParts[0][0] + nameParts[1][0]).toUpperCase();
|
|
53
|
+
}
|
|
54
|
+
return name.length > 1 ? name.substring(0, 2).toUpperCase() : name[0]?.toUpperCase() ?? "";
|
|
53
55
|
};
|
|
54
56
|
const replaceAt = (index, originalString, replaceTo) => {
|
|
55
57
|
if (!isNumber(index) || !isString(replaceTo) || !isString(originalString)) throw new TypeError(`First parameter (\`index\`) must be of type \`number\`, second parameter (\`originalString\`) and third parameter (\`replaceTo\`) must be of type \`string\`, but received: "['index': \`${getPreciseType(index)}\`, 'originalString': \`${getPreciseType(originalString)}\`, 'replaceTo': \`${getPreciseType(replaceTo)}\`]".`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/strings/capitalizations/capitalizeFirst.ts","../../src/strings/capitalizations/capitalizeWords.ts","../../src/strings/sanitizations/stripHtmlTags.ts","../../src/strings/utils/getInitialsName.ts","../../src/strings/utils/replaceAt.ts"],"sourcesContent":["import { isPlainObject } from \"@/predicates/is/isPlainObject\";\nimport { isNonEmptyString } from \"@/predicates/is/isNonEmptyString\";\n\ntype CapitalizeFirstOptions = {\n /** If true **(default)**, the rest of the string will be converted to lowercase after capitalizing the first letter.\n *\n * @default true\n */\n lowerCaseNextRest?: boolean;\n /** If true, the string will trimmed, default: `false`.\n *\n * @default false\n */\n trim?: boolean;\n};\n\n/** ----------------------------------------------------------\n * * ***Utility: `capitalizeFirst`.***\n * ----------------------------------------------------------\n * **Capitalizes the first letter of a string, with optionally lowercases the rest and trims whitespace.**\n * @param {string | null | undefined} string - The string to be processed.\n * @param {CapitalizeFirstOptions} [options] - Options to control behavior.\n * @param {CapitalizeFirstOptions[\"lowerCaseNextRest\"]} [options.lowerCaseNextRest=true] - If true, lowercases the rest (next first letter), default: `true`.\n * @param {CapitalizeFirstOptions[\"trim\"]} [options.trim=false] - If true, trims the string before processing, default: `false`.\n * @returns {string} The processed string, returns `\"\"` if input is `null`, `undefined`, or `not a valid string`.\n * @example\n * ```ts\n * capitalizeFirst(\" hello WORLD \");\n * // ➔ \" Hello world\"\n * capitalizeFirst(\" hello WORLD \", { trim: true });\n * // ➔ \"Hello world\"\n * capitalizeFirst(\"FOO\", { lowerCaseNextRest: false });\n * // ➔ \"FOO\"\n * capitalizeFirst(\" foo BAR \", { trim: true, lowerCaseNextRest: false });\n * // ➔ \"Foo BAR\"\n * ```\n * #### ℹ️ If null, undefined, or not a valid string input, return `\"\"`.\n * ```ts\n * capitalizeFirst(123);\n * capitalizeFirst(null);\n * capitalizeFirst(undefined);\n * // ➔ \"\"\n * ```\n */\nexport const capitalizeFirst = (\n string: string | null | undefined,\n options: CapitalizeFirstOptions = {\n lowerCaseNextRest: true,\n trim: false\n }\n): string => {\n if (!isNonEmptyString(string)) return \"\";\n\n if (!isPlainObject(options)) {\n options = {};\n }\n\n const lowerCaseNextRest = options.lowerCaseNextRest !== false;\n const trim = options.trim === true;\n\n if (trim) string = string.trim();\n\n return (\n string[0].toUpperCase() +\n (lowerCaseNextRest ? string.slice(1).toLowerCase() : string.slice(1))\n );\n};\n","import { isPlainObject } from \"@/predicates/is/isPlainObject\";\nimport { isNonEmptyString } from \"@/predicates/is/isNonEmptyString\";\n\ntype CapitalizeWordsOptions = {\n /** If `true`, removes leading and trailing spaces, default `false`.\n *\n * @default false\n */\n trim?: boolean;\n /** If `true`, collapses multiple spaces **between words** into a single space (while preserving leading/trailing spaces), default `false`.\n *\n * @default false\n */\n collapseSpaces?: boolean;\n};\n\n/** ----------------------------------------------------------\n * * ***Utility: `capitalizeWords`.***\n * ----------------------------------------------------------\n * **Capitalizes the first letter of each word in a string while converting the rest to lowercase.**\n * @param {string | null | undefined} value\n * ***The input string to be processed.***\n * - If `null` or `undefined`, returns an empty-string (`\"\"`).\n * @param {CapitalizeWordsOptions} [options]\n * ***Optional settings to control the output:***\n * - `trim`: If `true`, removes leading and trailing spaces, defaultValue: `false`.\n * - `collapseSpaces`: If `true`, collapses multiple spaces **between words** into a single space (while preserving leading/trailing spaces), defaultValue: `false`.\n * @returns {string} A new string where each word starts with an uppercase letter\n * and the remaining letters are lowercase.\n * - If `value` is `empty`, `null`, or `undefined`, returns an `empty-string`.\n * @example\n * ```ts\n * capitalizeWords(\" hello world \");\n * // ➔ \" Hello World \"\n * capitalizeWords(\" hello world \", { trim: true });\n * // ➔ \"Hello World\"\n * capitalizeWords(\" hello world \", { collapseSpaces: true });\n * // ➔ \" Hello World \"\n * capitalizeWords(\" hello world \", { trim: true, collapseSpaces: true });\n * // ➔ \"Hello World\"\n * ```\n * #### ℹ️ If null, undefined, or not a valid string input, return \"\".\n * ```ts\n * capitalizeWords(123);\n * capitalizeWords(null);\n * capitalizeWords(undefined);\n * // ➔ \"\"\n * ```\n */\nexport const capitalizeWords = (\n value: string | null | undefined,\n options: CapitalizeWordsOptions = {\n collapseSpaces: false,\n trim: false\n }\n): string => {\n if (!isNonEmptyString(value)) return \"\";\n\n let result = value;\n\n if (!isPlainObject(options)) {\n options = {};\n }\n\n const collapseSpaces = options.collapseSpaces === true;\n const trim = options.trim === true;\n\n if (trim) {\n result = result.trim();\n }\n\n if (collapseSpaces) {\n const leadingSpaces = result.match(/^\\s*/)?.[0] ?? \"\";\n const trailingSpaces = result.match(/\\s*$/)?.[0] ?? \"\";\n result = result.trim().replace(/\\s+/g, \" \");\n result = `${leadingSpaces}${result}${trailingSpaces}`;\n }\n\n return result\n .toLowerCase()\n .split(\" \")\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n .join(\" \");\n};\n","import type { Extends } from \"@rzl-zone/ts-types-plus\";\nimport { isString } from \"@/predicates/is/isString\";\nimport { isEmptyString } from \"@/predicates/is/isEmptyString\";\n\n/** ----------------------------------------------------------\n * * ***Utility: `stripHtmlTags`.***\n * ----------------------------------------------------------\n * **This function removes valid HTML tags (including nested and self-closing ones)\n * by replacing them with spaces, then collapses multiple whitespaces into a single space.**\n * - **It handles the following cases:**\n * - If the input is not a string (`null`, `undefined`, or any non-string), it is returned as undefined.\n * - If the input is an empty or whitespace-only string, it returns an empty string (`\"\"`).\n * - Otherwise, it returns the cleaned string with tags removed and normalized whitespace.\n * @template T - Input string type (string | null | undefined).\n * @param {string | null | undefined} input - A string potentially containing HTML tags.\n * @returns {string | undefined} Cleaned string if input is string, or original input otherwise.\n * @example\n * stripHtmlTags(\"<p>Hello</p>\");\n * // ➔ \"Hello\"\n * stripHtmlTags(\"<div><b>Bold</b> text</div>\");\n * // ➔ \"Bold text\"\n * stripHtmlTags(\"Line<br/>Break\");\n * // ➔ \"Line Break\"\n * stripHtmlTags(\"2 < 5 and 5 > 2\");\n * // ➔ \"2 < 5 and 5 > 2\"\n * stripHtmlTags(\"\");\n * // ➔ \"\"\n * stripHtmlTags(\" \");\n * // ➔ \"\"\n * stripHtmlTags(null);\n * // ➔ undefined\n * stripHtmlTags(undefined);\n * // ➔ undefined\n */\nexport function stripHtmlTags(input: string): string;\nexport function stripHtmlTags<T>(\n input: T\n): Extends<string, T> extends true ? string | undefined : undefined;\nexport function stripHtmlTags(input: unknown) {\n if (!isString(input)) {\n return undefined;\n }\n\n if (isEmptyString(input)) {\n return \"\";\n }\n\n // return input.replace(/<[^>]*>/g, \"\");\n const stripped = input.replace(/<\\/?[a-zA-Z][^<>]*\\/?>/g, \" \").trim();\n\n const cleaned = stripped.replace(/\\s+/g, \" \").trim();\n\n return cleaned;\n}\n","import { isNonEmptyString } from \"@/predicates/is/isNonEmptyString\";\n\n/** ----------------------------------------------------------\n * * ***Utility: `getInitialsName`.***\n * ----------------------------------------------------------\n * **Extracts initials from the given name string.**\n * - **Behavior:**\n * - For names with two or more words, returns the first letter of the first and second words.\n * - For a single word with 2+ characters, returns the first two letters.\n * - For a single character, returns that character.\n * - For `empty`, `null`, `undefined` or `whitespace-only input`, returns an empty string (`\"\"`).\n * @param {string | null | undefined} name - The name to extract initials from.\n * @returns {string} The extracted initials (e.g., \"JD\" for \"John Doe\").\n * @example\n * getInitialsName(\"Alice\"); // ➔ \"AL\"\n * getInitialsName(\"John Doe\"); // ➔ \"JD\"\n * getInitialsName(\" Bob Marley \"); // ➔ \"BM\"\n * getInitialsName(\"John Ronald Donal\"); // ➔ \"JR\"\n * getInitialsName(\"Lord John Doe Moe\"); // ➔ \"LJ\"\n * getInitialsName(\"X\"); // ➔ \"X\"\n * getInitialsName(\"\"); // ➔ \"\" (empty string)\n * getInitialsName(\" \"); // ➔ \"\" (empty string)\n * getInitialsName(null); // ➔ \"\" (null input)\n * getInitialsName(undefined); // ➔ \"\" (undefined input)\n */\nexport const getInitialsName = (name: string | null | undefined): string => {\n if (!isNonEmptyString(name)) return \"\"; // Handle empty string case\n\n // Trim spaces and remove duplicate spaces\n name = name.replace(/\\s+/g, \" \").trim();\n\n const nameParts = name.split(\" \");\n\n if (nameParts.length > 1) {\n // First letter of first and second words\n return nameParts[0][0] + nameParts[1][0].toUpperCase();\n }\n\n return name.length > 1\n ? name.substring(0, 2).toUpperCase()\n : // First two letters for single-word names\n name[0].toUpperCase();\n};\n","import { isNumber } from \"@/predicates/is/isNumber\";\nimport { isString } from \"@/predicates/is/isString\";\nimport { getPreciseType } from \"@/predicates/type/getPreciseType\";\n\n/** ----------------------------------------------------------\n * * ***Utility: `replaceAt`.***\n * ----------------------------------------------------------\n * **Replaces exactly one character at the specified index in the original string\n * with the provided `replaceTo` string.**\n * - **Behavior:**\n * - If `replaceTo` has more than one character,\n * the result will expand accordingly.\n * @param {number} index - The starting index where the replacement should occur.\n * @param {string} originalString - The original string to modify.\n * @param {string} replaceTo - The string to insert at the specified index.\n * @returns {string} The modified string with the replacement applied.\n * @example\n * replaceAt(3, \"hello\", \"X\");\n * // ➔ \"helXo\"\n * replaceAt(1, \"world\", \"AB\");\n * // ➔ \"wABrld\"\n * replaceAt(0, \"cat\", \"br\");\n * // ➔ \"brat\"\n * replaceAt(2, \"12345\", \"-\");\n * // ➔ \"12-45\"\n * replaceAt(4, \"ABCDE\", \"Z\");\n * // ➔ \"ABCDZ\"\n * // ❌ Examples that throw:\n * replaceAt(10, \"short\", \"X\");\n * // ➔ ❌ RangeError: First parameter (`index`) is out of range from second parameter `originalString`.\n * replaceAt(-1, \"test\", \"X\");\n * // ➔ ❌ RangeError: First parameter (`index`) is out of range from second parameter `originalString`.\n * replaceAt(\"1\", \"test\", \"X\");\n * // ➔ ❌ TypeError: First parameter `index` must be of type `number`, second parameter `originalString` and third parameter `replaceTo` must be of type `string`, but received: \"['index': `string`,...].\"\n * replaceAt(2, null, \"X\");\n * // ➔ ❌ TypeError: First parameter `index` must be of type `number`, second parameter `originalString` and third parameter `replaceTo` must be of type `string`, but received: \"['index': `string`,...].\"\n */\nexport const replaceAt = (\n index: number,\n originalString: string,\n replaceTo: string\n): string => {\n if (!isNumber(index) || !isString(replaceTo) || !isString(originalString)) {\n throw new TypeError(\n `First parameter (\\`index\\`) must be of type \\`number\\`, second parameter (\\`originalString\\`) and third parameter (\\`replaceTo\\`) must be of type \\`string\\`, but received: \"['index': \\`${getPreciseType(\n index\n )}\\`, 'originalString': \\`${getPreciseType(\n originalString\n )}\\`, 'replaceTo': \\`${getPreciseType(replaceTo)}\\`]\".`\n );\n }\n\n // Handle edge cases\n if (index < 0 || index >= originalString.length) {\n throw new RangeError(\n \"First parameter (`index`) is out of range from second parameter (`originalString`).\"\n );\n }\n\n return (\n originalString.slice(0, index) + // Extract before the index\n replaceTo + // Insert replacement\n originalString.slice(index + 1) // Extract after replacement\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4CA,MAAa,mBACX,QACA,UAAkC;CAChC,mBAAmB;CACnB,MAAM;CACP,KACU;CACX,IAAI,CAAC,iBAAiB,OAAO,EAAE,OAAO;CAEtC,IAAI,CAAC,cAAc,QAAQ,EACzB,UAAU,EAAE;CAGd,MAAM,oBAAoB,QAAQ,sBAAsB;CAGxD,IAFa,QAAQ,SAAS,MAEpB,SAAS,OAAO,MAAM;CAEhC,OACE,OAAO,GAAG,aAAa,IACtB,oBAAoB,OAAO,MAAM,EAAE,CAAC,aAAa,GAAG,OAAO,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACfxE,MAAa,mBACX,OACA,UAAkC;CAChC,gBAAgB;CAChB,MAAM;CACP,KACU;CACX,IAAI,CAAC,iBAAiB,MAAM,EAAE,OAAO;CAErC,IAAI,SAAS;CAEb,IAAI,CAAC,cAAc,QAAQ,EACzB,UAAU,EAAE;CAGd,MAAM,iBAAiB,QAAQ,mBAAmB;CAGlD,IAFa,QAAQ,SAAS,MAG5B,SAAS,OAAO,MAAM;CAGxB,IAAI,gBAAgB;EAClB,MAAM,gBAAgB,OAAO,MAAM,OAAO,GAAG,MAAM;EACnD,MAAM,iBAAiB,OAAO,MAAM,OAAO,GAAG,MAAM;EACpD,SAAS,OAAO,MAAM,CAAC,QAAQ,QAAQ,IAAI;EAC3C,SAAS,GAAG,gBAAgB,SAAS;;CAGvC,OAAO,OACJ,aAAa,CACb,MAAM,IAAI,CACV,KAAK,SAAS,KAAK,OAAO,EAAE,CAAC,aAAa,GAAG,KAAK,MAAM,EAAE,CAAC,CAC3D,KAAK,IAAI;;;;;AC5Cd,SAAgB,cAAc,OAAgB;CAC5C,IAAI,CAAC,SAAS,MAAM,EAClB;CAGF,IAAI,cAAc,MAAM,EACtB,OAAO;CAQT,OAJiB,MAAM,QAAQ,2BAA2B,IAAI,CAAC,MAEvC,CAAC,QAAQ,QAAQ,IAAI,CAAC,MAEhC;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC3BhB,MAAa,mBAAmB,SAA4C;CAC1E,IAAI,CAAC,iBAAiB,KAAK,EAAE,OAAO;CAGpC,OAAO,KAAK,QAAQ,QAAQ,IAAI,CAAC,MAAM;CAEvC,MAAM,YAAY,KAAK,MAAM,IAAI;CAEjC,IAAI,UAAU,SAAS,GAErB,OAAO,UAAU,GAAG,KAAK,UAAU,GAAG,GAAG,aAAa;CAGxD,OAAO,KAAK,SAAS,IACjB,KAAK,UAAU,GAAG,EAAE,CAAC,aAAa,GAElC,KAAK,GAAG,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACJ3B,MAAa,aACX,OACA,gBACA,cACW;CACX,IAAI,CAAC,SAAS,MAAM,IAAI,CAAC,SAAS,UAAU,IAAI,CAAC,SAAS,eAAe,EACvE,MAAM,IAAI,UACR,4LAA4L,eAC1L,MACD,CAAC,0BAA0B,eAC1B,eACD,CAAC,qBAAqB,eAAe,UAAU,CAAC,OAClD;CAIH,IAAI,QAAQ,KAAK,SAAS,eAAe,QACvC,MAAM,IAAI,WACR,sFACD;CAGH,OACE,eAAe,MAAM,GAAG,MAAM,GAC9B,YACA,eAAe,MAAM,QAAQ,EAAE"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/strings/capitalizations/capitalizeFirst.ts","../../src/strings/capitalizations/capitalizeWords.ts","../../src/strings/sanitizations/stripHtmlTags.ts","../../src/strings/utils/getInitialsName.ts","../../src/strings/utils/replaceAt.ts"],"sourcesContent":["import { isPlainObject } from \"@/predicates/is/isPlainObject\";\nimport { isNonEmptyString } from \"@/predicates/is/isNonEmptyString\";\n\ntype CapitalizeFirstOptions = {\n /** If true **(default)**, the rest of the string will be converted to lowercase after capitalizing the first letter.\n *\n * @default true\n */\n lowerCaseNextRest?: boolean;\n /** If true, the string will trimmed, default: `false`.\n *\n * @default false\n */\n trim?: boolean;\n};\n\n/** ----------------------------------------------------------\n * * ***Utility: `capitalizeFirst`.***\n * ----------------------------------------------------------\n * **Capitalizes the first letter of a string, with optionally lowercases the rest and trims whitespace.**\n * @param {string | null | undefined} string - The string to be processed.\n * @param {CapitalizeFirstOptions} [options] - Options to control behavior.\n * @param {CapitalizeFirstOptions[\"lowerCaseNextRest\"]} [options.lowerCaseNextRest=true] - If true, lowercases the rest (next first letter), default: `true`.\n * @param {CapitalizeFirstOptions[\"trim\"]} [options.trim=false] - If true, trims the string before processing, default: `false`.\n * @returns {string} The processed string, returns `\"\"` if input is `null`, `undefined`, or `not a valid string`.\n * @example\n * ```ts\n * capitalizeFirst(\" hello WORLD \");\n * // ➔ \" Hello world\"\n * capitalizeFirst(\" hello WORLD \", { trim: true });\n * // ➔ \"Hello world\"\n * capitalizeFirst(\"FOO\", { lowerCaseNextRest: false });\n * // ➔ \"FOO\"\n * capitalizeFirst(\" foo BAR \", { trim: true, lowerCaseNextRest: false });\n * // ➔ \"Foo BAR\"\n * ```\n * #### ℹ️ If null, undefined, or not a valid string input, return `\"\"`.\n * ```ts\n * capitalizeFirst(123);\n * capitalizeFirst(null);\n * capitalizeFirst(undefined);\n * // ➔ \"\"\n * ```\n */\nexport const capitalizeFirst = (\n string: string | null | undefined,\n options: CapitalizeFirstOptions = {\n lowerCaseNextRest: true,\n trim: false\n }\n): string => {\n if (!isNonEmptyString(string)) return \"\";\n\n if (!isPlainObject(options)) {\n options = {};\n }\n\n const lowerCaseNextRest = options.lowerCaseNextRest !== false;\n const trim = options.trim === true;\n\n if (trim) string = string.trim();\n\n return (\n (string[0] ? string[0].toUpperCase() : \"\") +\n (lowerCaseNextRest ? string.slice(1).toLowerCase() : string.slice(1))\n );\n};\n","import { isPlainObject } from \"@/predicates/is/isPlainObject\";\nimport { isNonEmptyString } from \"@/predicates/is/isNonEmptyString\";\n\ntype CapitalizeWordsOptions = {\n /** If `true`, removes leading and trailing spaces, default `false`.\n *\n * @default false\n */\n trim?: boolean;\n /** If `true`, collapses multiple spaces **between words** into a single space (while preserving leading/trailing spaces), default `false`.\n *\n * @default false\n */\n collapseSpaces?: boolean;\n};\n\n/** ----------------------------------------------------------\n * * ***Utility: `capitalizeWords`.***\n * ----------------------------------------------------------\n * **Capitalizes the first letter of each word in a string while converting the rest to lowercase.**\n * @param {string | null | undefined} value\n * ***The input string to be processed.***\n * - If `null` or `undefined`, returns an empty-string (`\"\"`).\n * @param {CapitalizeWordsOptions} [options]\n * ***Optional settings to control the output:***\n * - `trim`: If `true`, removes leading and trailing spaces, defaultValue: `false`.\n * - `collapseSpaces`: If `true`, collapses multiple spaces **between words** into a single space (while preserving leading/trailing spaces), defaultValue: `false`.\n * @returns {string} A new string where each word starts with an uppercase letter\n * and the remaining letters are lowercase.\n * - If `value` is `empty`, `null`, or `undefined`, returns an `empty-string`.\n * @example\n * ```ts\n * capitalizeWords(\" hello world \");\n * // ➔ \" Hello World \"\n * capitalizeWords(\" hello world \", { trim: true });\n * // ➔ \"Hello World\"\n * capitalizeWords(\" hello world \", { collapseSpaces: true });\n * // ➔ \" Hello World \"\n * capitalizeWords(\" hello world \", { trim: true, collapseSpaces: true });\n * // ➔ \"Hello World\"\n * ```\n * #### ℹ️ If null, undefined, or not a valid string input, return \"\".\n * ```ts\n * capitalizeWords(123);\n * capitalizeWords(null);\n * capitalizeWords(undefined);\n * // ➔ \"\"\n * ```\n */\nexport const capitalizeWords = (\n value: string | null | undefined,\n options: CapitalizeWordsOptions = {\n collapseSpaces: false,\n trim: false\n }\n): string => {\n if (!isNonEmptyString(value)) return \"\";\n\n let result = value;\n\n if (!isPlainObject(options)) {\n options = {};\n }\n\n const collapseSpaces = options.collapseSpaces === true;\n const trim = options.trim === true;\n\n if (trim) {\n result = result.trim();\n }\n\n if (collapseSpaces) {\n const leadingSpaces = result.match(/^\\s*/)?.[0] ?? \"\";\n const trailingSpaces = result.match(/\\s*$/)?.[0] ?? \"\";\n result = result.trim().replace(/\\s+/g, \" \");\n result = `${leadingSpaces}${result}${trailingSpaces}`;\n }\n\n return result\n .toLowerCase()\n .split(\" \")\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n .join(\" \");\n};\n","import type { Extends } from \"@rzl-zone/ts-types-plus\";\nimport { isString } from \"@/predicates/is/isString\";\nimport { isEmptyString } from \"@/predicates/is/isEmptyString\";\n\n/** ----------------------------------------------------------\n * * ***Utility: `stripHtmlTags`.***\n * ----------------------------------------------------------\n * **This function removes valid HTML tags (including nested and self-closing ones)\n * by replacing them with spaces, then collapses multiple whitespaces into a single space.**\n * - **It handles the following cases:**\n * - If the input is not a string (`null`, `undefined`, or any non-string), it is returned as undefined.\n * - If the input is an empty or whitespace-only string, it returns an empty string (`\"\"`).\n * - Otherwise, it returns the cleaned string with tags removed and normalized whitespace.\n * @template T - Input string type (string | null | undefined).\n * @param {string | null | undefined} input - A string potentially containing HTML tags.\n * @returns {string | undefined} Cleaned string if input is string, or original input otherwise.\n * @example\n * stripHtmlTags(\"<p>Hello</p>\");\n * // ➔ \"Hello\"\n * stripHtmlTags(\"<div><b>Bold</b> text</div>\");\n * // ➔ \"Bold text\"\n * stripHtmlTags(\"Line<br/>Break\");\n * // ➔ \"Line Break\"\n * stripHtmlTags(\"2 < 5 and 5 > 2\");\n * // ➔ \"2 < 5 and 5 > 2\"\n * stripHtmlTags(\"\");\n * // ➔ \"\"\n * stripHtmlTags(\" \");\n * // ➔ \"\"\n * stripHtmlTags(null);\n * // ➔ undefined\n * stripHtmlTags(undefined);\n * // ➔ undefined\n */\nexport function stripHtmlTags(input: string): string;\nexport function stripHtmlTags<T>(\n input: T\n): Extends<string, T> extends true ? string | undefined : undefined;\nexport function stripHtmlTags(input: unknown) {\n if (!isString(input)) {\n return undefined;\n }\n\n if (isEmptyString(input)) {\n return \"\";\n }\n\n // return input.replace(/<[^>]*>/g, \"\");\n const stripped = input.replace(/<\\/?[a-zA-Z][^<>]*\\/?>/g, \" \").trim();\n\n const cleaned = stripped.replace(/\\s+/g, \" \").trim();\n\n return cleaned;\n}\n","import { isNonEmptyString } from \"@/predicates/is/isNonEmptyString\";\n\n/** ----------------------------------------------------------\n * * ***Utility: `getInitialsName`.***\n * ----------------------------------------------------------\n * **Extracts initials from the given name string.**\n * - **Behavior:**\n * - For names with two or more words, returns the first letter of the first and second words.\n * - For a single word with 2+ characters, returns the first two letters.\n * - For a single character, returns that character.\n * - For `empty`, `null`, `undefined` or `whitespace-only input`, returns an empty string (`\"\"`).\n * @param {string | null | undefined} name - The name to extract initials from.\n * @returns {string} The extracted initials (e.g., \"JD\" for \"John Doe\").\n * @example\n * getInitialsName(\"Alice\"); // ➔ \"AL\"\n * getInitialsName(\"John Doe\"); // ➔ \"JD\"\n * getInitialsName(\" Bob Marley \"); // ➔ \"BM\"\n * getInitialsName(\"John Ronald Donal\"); // ➔ \"JR\"\n * getInitialsName(\"Lord John Doe Moe\"); // ➔ \"LJ\"\n * getInitialsName(\"X\"); // ➔ \"X\"\n * getInitialsName(\"\"); // ➔ \"\" (empty string)\n * getInitialsName(\" \"); // ➔ \"\" (empty string)\n * getInitialsName(null); // ➔ \"\" (null input)\n * getInitialsName(undefined); // ➔ \"\" (undefined input)\n */\nexport const getInitialsName = (name: string | null | undefined): string => {\n if (!isNonEmptyString(name)) return \"\"; // Handle empty string case\n\n // Trim spaces and remove duplicate spaces\n name = name.replace(/\\s+/g, \" \").trim();\n\n const nameParts = name.split(\" \");\n\n if (nameParts.length > 1) {\n if (!(nameParts[0] && nameParts[1] && nameParts[1][0])) return \"\";\n\n // First letter of first and second words\n return (nameParts[0][0] + nameParts[1][0]).toUpperCase();\n }\n\n return name.length > 1\n ? name.substring(0, 2).toUpperCase()\n : // First two letters for single-word names\n (name[0]?.toUpperCase() ?? \"\");\n};\n","import { isNumber } from \"@/predicates/is/isNumber\";\nimport { isString } from \"@/predicates/is/isString\";\nimport { getPreciseType } from \"@/predicates/type/getPreciseType\";\n\n/** ----------------------------------------------------------\n * * ***Utility: `replaceAt`.***\n * ----------------------------------------------------------\n * **Replaces exactly one character at the specified index in the original string\n * with the provided `replaceTo` string.**\n * - **Behavior:**\n * - If `replaceTo` has more than one character,\n * the result will expand accordingly.\n * @param {number} index - The starting index where the replacement should occur.\n * @param {string} originalString - The original string to modify.\n * @param {string} replaceTo - The string to insert at the specified index.\n * @returns {string} The modified string with the replacement applied.\n * @example\n * replaceAt(3, \"hello\", \"X\");\n * // ➔ \"helXo\"\n * replaceAt(1, \"world\", \"AB\");\n * // ➔ \"wABrld\"\n * replaceAt(0, \"cat\", \"br\");\n * // ➔ \"brat\"\n * replaceAt(2, \"12345\", \"-\");\n * // ➔ \"12-45\"\n * replaceAt(4, \"ABCDE\", \"Z\");\n * // ➔ \"ABCDZ\"\n * // ❌ Examples that throw:\n * replaceAt(10, \"short\", \"X\");\n * // ➔ ❌ RangeError: First parameter (`index`) is out of range from second parameter `originalString`.\n * replaceAt(-1, \"test\", \"X\");\n * // ➔ ❌ RangeError: First parameter (`index`) is out of range from second parameter `originalString`.\n * replaceAt(\"1\", \"test\", \"X\");\n * // ➔ ❌ TypeError: First parameter `index` must be of type `number`, second parameter `originalString` and third parameter `replaceTo` must be of type `string`, but received: \"['index': `string`,...].\"\n * replaceAt(2, null, \"X\");\n * // ➔ ❌ TypeError: First parameter `index` must be of type `number`, second parameter `originalString` and third parameter `replaceTo` must be of type `string`, but received: \"['index': `string`,...].\"\n */\nexport const replaceAt = (\n index: number,\n originalString: string,\n replaceTo: string\n): string => {\n if (!isNumber(index) || !isString(replaceTo) || !isString(originalString)) {\n throw new TypeError(\n `First parameter (\\`index\\`) must be of type \\`number\\`, second parameter (\\`originalString\\`) and third parameter (\\`replaceTo\\`) must be of type \\`string\\`, but received: \"['index': \\`${getPreciseType(\n index\n )}\\`, 'originalString': \\`${getPreciseType(\n originalString\n )}\\`, 'replaceTo': \\`${getPreciseType(replaceTo)}\\`]\".`\n );\n }\n\n // Handle edge cases\n if (index < 0 || index >= originalString.length) {\n throw new RangeError(\n \"First parameter (`index`) is out of range from second parameter (`originalString`).\"\n );\n }\n\n return (\n originalString.slice(0, index) + // Extract before the index\n replaceTo + // Insert replacement\n originalString.slice(index + 1) // Extract after replacement\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4CA,MAAa,mBACX,QACA,UAAkC;CAChC,mBAAmB;CACnB,MAAM;CACP,KACU;CACX,IAAI,CAAC,iBAAiB,OAAO,EAAE,OAAO;CAEtC,IAAI,CAAC,cAAc,QAAQ,EACzB,UAAU,EAAE;CAGd,MAAM,oBAAoB,QAAQ,sBAAsB;CAGxD,IAFa,QAAQ,SAAS,MAEpB,SAAS,OAAO,MAAM;CAEhC,QACG,OAAO,KAAK,OAAO,GAAG,aAAa,GAAG,OACtC,oBAAoB,OAAO,MAAM,EAAE,CAAC,aAAa,GAAG,OAAO,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACfxE,MAAa,mBACX,OACA,UAAkC;CAChC,gBAAgB;CAChB,MAAM;CACP,KACU;CACX,IAAI,CAAC,iBAAiB,MAAM,EAAE,OAAO;CAErC,IAAI,SAAS;CAEb,IAAI,CAAC,cAAc,QAAQ,EACzB,UAAU,EAAE;CAGd,MAAM,iBAAiB,QAAQ,mBAAmB;CAGlD,IAFa,QAAQ,SAAS,MAG5B,SAAS,OAAO,MAAM;CAGxB,IAAI,gBAAgB;EAClB,MAAM,gBAAgB,OAAO,MAAM,OAAO,GAAG,MAAM;EACnD,MAAM,iBAAiB,OAAO,MAAM,OAAO,GAAG,MAAM;EACpD,SAAS,OAAO,MAAM,CAAC,QAAQ,QAAQ,IAAI;EAC3C,SAAS,GAAG,gBAAgB,SAAS;;CAGvC,OAAO,OACJ,aAAa,CACb,MAAM,IAAI,CACV,KAAK,SAAS,KAAK,OAAO,EAAE,CAAC,aAAa,GAAG,KAAK,MAAM,EAAE,CAAC,CAC3D,KAAK,IAAI;;;;;AC5Cd,SAAgB,cAAc,OAAgB;CAC5C,IAAI,CAAC,SAAS,MAAM,EAClB;CAGF,IAAI,cAAc,MAAM,EACtB,OAAO;CAQT,OAJiB,MAAM,QAAQ,2BAA2B,IAAI,CAAC,MAEvC,CAAC,QAAQ,QAAQ,IAAI,CAAC,MAEhC;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC3BhB,MAAa,mBAAmB,SAA4C;CAC1E,IAAI,CAAC,iBAAiB,KAAK,EAAE,OAAO;CAGpC,OAAO,KAAK,QAAQ,QAAQ,IAAI,CAAC,MAAM;CAEvC,MAAM,YAAY,KAAK,MAAM,IAAI;CAEjC,IAAI,UAAU,SAAS,GAAG;EACxB,IAAI,EAAE,UAAU,MAAM,UAAU,MAAM,UAAU,GAAG,KAAK,OAAO;EAG/D,QAAQ,UAAU,GAAG,KAAK,UAAU,GAAG,IAAI,aAAa;;CAG1D,OAAO,KAAK,SAAS,IACjB,KAAK,UAAU,GAAG,EAAE,CAAC,aAAa,GAEjC,KAAK,IAAI,aAAa,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACNjC,MAAa,aACX,OACA,gBACA,cACW;CACX,IAAI,CAAC,SAAS,MAAM,IAAI,CAAC,SAAS,UAAU,IAAI,CAAC,SAAS,eAAe,EACvE,MAAM,IAAI,UACR,4LAA4L,eAC1L,MACD,CAAC,0BAA0B,eAC1B,eACD,CAAC,qBAAqB,eAAe,UAAU,CAAC,OAClD;CAIH,IAAI,QAAQ,KAAK,SAAS,eAAe,QACvC,MAAM,IAAI,WACR,sFACD;CAGH,OACE,eAAe,MAAM,GAAG,MAAM,GAC9B,YACA,eAAe,MAAM,QAAQ,EAAE"}
|
package/dist/tailwind/index.cjs
CHANGED
|
@@ -2,18 +2,22 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/utils-js
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `3.
|
|
5
|
+
* Version: `3.13.0-beta.2`
|
|
6
6
|
* Author: `Rizalvin Dwiky <rizalvindwiky@gmail.com>`
|
|
7
7
|
* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/utils-js`
|
|
8
8
|
* ========================================================================
|
|
9
9
|
*/
|
|
10
10
|
"use strict";
|
|
11
11
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
12
|
-
const require_tailwind = require('../tailwind-
|
|
12
|
+
const require_tailwind = require('../tailwind-C1YtxJ-K.cjs');
|
|
13
13
|
exports.cnV3 = require_tailwind.cnV3;
|
|
14
14
|
exports.cnV4 = require_tailwind.cnV4;
|
|
15
|
+
exports.cnVer3 = require_tailwind.cnVer3;
|
|
16
|
+
exports.cnVer4 = require_tailwind.cnVer4;
|
|
15
17
|
exports.customCnV3 = require_tailwind.customCnV3;
|
|
16
18
|
exports.customCnV4 = require_tailwind.customCnV4;
|
|
19
|
+
exports.customCnVer3 = require_tailwind.customCnVer3;
|
|
20
|
+
exports.customCnVer4 = require_tailwind.customCnVer4;
|
|
17
21
|
exports.cx = require_tailwind.cx;
|
|
18
22
|
exports.shouldForwardProp = require_tailwind.shouldForwardProp;
|
|
19
23
|
exports.twMergeDefaultV3 = require_tailwind.twMergeDefaultV3;
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/utils-js
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `3.
|
|
5
|
+
* Version: `3.13.0-beta.2`
|
|
6
6
|
* Author: `Rizalvin Dwiky <rizalvindwiky@gmail.com>`
|
|
7
7
|
* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/utils-js`
|
|
8
8
|
* ========================================================================
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import { a as customCnV4, c as
|
|
12
|
-
export { ClassObject, ClassValue, ClassValues, cnV3, cnV4, customCnV3, customCnV4, cx, shouldForwardProp, twMergeDefaultV3, twMergeDefaultV4 };
|
|
11
|
+
import { a as customCnV4, c as cnV3, d as cnVer4, f as ClassObject, h as cx, i as customCnV3, l as cnV4, m as ClassValues, n as twMergeDefaultV3, o as customCnVer3, p as ClassValue, r as shouldForwardProp, s as customCnVer4, t as twMergeDefaultV4, u as cnVer3 } from "../index-z_uCh5KW.cjs";
|
|
12
|
+
export { ClassObject, ClassValue, ClassValues, cnV3, cnV4, cnVer3, cnVer4, customCnV3, customCnV4, customCnVer3, customCnVer4, cx, shouldForwardProp, twMergeDefaultV3, twMergeDefaultV4 };
|
package/dist/tailwind/index.d.ts
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/utils-js
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `3.
|
|
5
|
+
* Version: `3.13.0-beta.2`
|
|
6
6
|
* Author: `Rizalvin Dwiky <rizalvindwiky@gmail.com>`
|
|
7
7
|
* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/utils-js`
|
|
8
8
|
* ========================================================================
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import { a as customCnV4, c as
|
|
12
|
-
export { ClassObject, ClassValue, ClassValues, cnV3, cnV4, customCnV3, customCnV4, cx, shouldForwardProp, twMergeDefaultV3, twMergeDefaultV4 };
|
|
11
|
+
import { a as customCnV4, c as cnV3, d as cnVer4, f as ClassObject, h as cx, i as customCnV3, l as cnV4, m as ClassValues, n as twMergeDefaultV3, o as customCnVer3, p as ClassValue, r as shouldForwardProp, s as customCnVer4, t as twMergeDefaultV4, u as cnVer3 } from "../index-DHHrLc0B.js";
|
|
12
|
+
export { ClassObject, ClassValue, ClassValues, cnV3, cnV4, cnVer3, cnVer4, customCnV3, customCnV4, customCnVer3, customCnVer4, cx, shouldForwardProp, twMergeDefaultV3, twMergeDefaultV4 };
|
package/dist/tailwind/index.js
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/utils-js
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `3.
|
|
5
|
+
* Version: `3.13.0-beta.2`
|
|
6
6
|
* Author: `Rizalvin Dwiky <rizalvindwiky@gmail.com>`
|
|
7
7
|
* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/utils-js`
|
|
8
8
|
* ========================================================================
|
|
9
9
|
*/
|
|
10
|
-
import { a as
|
|
11
|
-
export { cnV3, cnV4, customCnV3, customCnV4, cx, shouldForwardProp, twMergeDefaultV3, twMergeDefaultV4 };
|
|
10
|
+
import { a as cnVer4, c as customCnVer3, d as twMergeDefaultV3, f as cx, i as cnVer3, l as customCnVer4, n as cnV3, o as customCnV3, r as cnV4, s as customCnV4, t as shouldForwardProp, u as twMergeDefaultV4 } from "../tailwind-BZ2_MeNX.js";
|
|
11
|
+
export { cnV3, cnV4, cnVer3, cnVer4, customCnV3, customCnV4, customCnVer3, customCnVer4, cx, shouldForwardProp, twMergeDefaultV3, twMergeDefaultV4 };
|
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/utils-js
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `3.
|
|
5
|
+
* Version: `3.13.0-beta.2`
|
|
6
6
|
* Author: `Rizalvin Dwiky <rizalvindwiky@gmail.com>`
|
|
7
7
|
* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/utils-js`
|
|
8
8
|
* ========================================================================
|
|
9
9
|
*/
|
|
10
|
-
import { A as isPlainObject, M as isArray, O as isNumberObject, P as isFunction, b as hasOwnProp, g as isStringObject, h as isBooleanObject, k as isString, p as isNonEmptyArray, r as getPreciseType, w as isNumber, x as isObjectOrArray, y as isNonEmptyString } from "./assertIsBoolean-
|
|
11
|
-
import { t as assertIsArray } from "./assertIsArray-
|
|
12
|
-
import { t as isEmptyString } from "./isEmptyString-
|
|
13
|
-
import { extendTailwindMerge, getDefaultConfig } from "tailwind-merge-v3";
|
|
14
|
-
import { extendTailwindMerge as extendTailwindMerge$1, getDefaultConfig as getDefaultConfig$1 } from "tailwind-merge-v4";
|
|
10
|
+
import { A as isPlainObject, M as isArray, O as isNumberObject, P as isFunction, b as hasOwnProp, g as isStringObject, h as isBooleanObject, k as isString, p as isNonEmptyArray, r as getPreciseType, w as isNumber, x as isObjectOrArray, y as isNonEmptyString } from "./assertIsBoolean-Bv6gL-xe.js";
|
|
11
|
+
import { t as assertIsArray } from "./assertIsArray-6BcSdNa-.js";
|
|
12
|
+
import { t as isEmptyString } from "./isEmptyString-DFDtBbNr.js";
|
|
13
|
+
import { extendTailwindMerge, getDefaultConfig, twMerge } from "tailwind-merge-v3";
|
|
14
|
+
import { extendTailwindMerge as extendTailwindMerge$1, getDefaultConfig as getDefaultConfig$1, twMerge as twMerge$1 } from "tailwind-merge-v4";
|
|
15
15
|
function toStringValue(value) {
|
|
16
16
|
let str = "";
|
|
17
17
|
if (isNonEmptyString(value) || isNumber(value)) str += value;
|
|
@@ -157,6 +157,14 @@ const twMergeDefaultV4 = (options = {}) => {
|
|
|
157
157
|
}
|
|
158
158
|
});
|
|
159
159
|
};
|
|
160
|
+
const customCnVer3 = (customTwMergeV3 = twMerge, ...classes) => {
|
|
161
|
+
if (!isFunction(customTwMergeV3)) throw new TypeError(`first Parameter (\`customTwMergeV3\`) must be of type \`function\`, but received: \`${getPreciseType(customTwMergeV3)}\`.`);
|
|
162
|
+
return customTwMergeV3(cx(...classes));
|
|
163
|
+
};
|
|
164
|
+
const customCnVer4 = (customTwMergeV4 = twMerge$1, ...classes) => {
|
|
165
|
+
if (!isFunction(customTwMergeV4)) throw new TypeError(`first Parameter (\`customTwMergeV4\`) must be of type \`function\`, but received: \`${getPreciseType(customTwMergeV4)}\`.`);
|
|
166
|
+
return customTwMergeV4(cx(...classes));
|
|
167
|
+
};
|
|
160
168
|
const customCnV3 = (customTwMergeV3, ...classes) => {
|
|
161
169
|
if (!isFunction(customTwMergeV3)) throw new TypeError(`first Parameter (\`customTwMergeV3\`) must be of type \`function\`, but received: \`${getPreciseType(customTwMergeV3)}\`.`);
|
|
162
170
|
return customTwMergeV3(cx(...classes));
|
|
@@ -165,6 +173,8 @@ const customCnV4 = (customTwMergeV4, ...classes) => {
|
|
|
165
173
|
if (!isFunction(customTwMergeV4)) throw new TypeError(`first Parameter (\`customTwMergeV4\`) must be of type \`function\`, but received: \`${getPreciseType(customTwMergeV4)}\`.`);
|
|
166
174
|
return customTwMergeV4(cx(...classes));
|
|
167
175
|
};
|
|
176
|
+
const cnVer3 = (...values) => twMerge(cx(...values));
|
|
177
|
+
const cnVer4 = (...values) => twMerge$1(cx(...values));
|
|
168
178
|
const defaultTwMergeV3 = twMergeDefaultV3();
|
|
169
179
|
const defaultTwMergeV4 = twMergeDefaultV4();
|
|
170
180
|
const cnV3 = (...classes) => {
|
|
@@ -195,5 +205,5 @@ const shouldForwardProp = (props) => {
|
|
|
195
205
|
return !props.map(String).includes(String(propName));
|
|
196
206
|
};
|
|
197
207
|
};
|
|
198
|
-
export {
|
|
199
|
-
//# sourceMappingURL=tailwind-
|
|
208
|
+
export { cnVer4 as a, customCnVer3 as c, twMergeDefaultV3 as d, cx as f, cnVer3 as i, customCnVer4 as l, cnV3 as n, customCnV3 as o, cnV4 as r, customCnV4 as s, shouldForwardProp as t, twMergeDefaultV4 as u };
|
|
209
|
+
//# sourceMappingURL=tailwind-BZ2_MeNX.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tailwind-BZ2_MeNX.js","names":["defaultConfig","getDefaultConfig","extendTailwindMerge","twMergeV3","twMergeV4","twMergeV3","twMergeV4"],"sources":["../src/tailwind/class-names/cx.ts","../src/tailwind/tw-merge/_private/validate-props.ts","../src/tailwind/tw-merge/v3/twMergeDefault.ts","../src/tailwind/tw-merge/v4/twMergeDefault.ts","../src/tailwind/class-names/customCn.ts","../src/tailwind/class-names/cn.ts","../src/tailwind/tw-macro/shouldForwardProp.ts"],"sourcesContent":["import { isArray } from \"@/predicates/is/isArray\";\nimport { isNumber } from \"@/predicates/is/isNumber\";\nimport { isStringObject } from \"@/predicates/is/isStringObject\";\nimport { isNumberObject } from \"@/predicates/is/isNumberObject\";\nimport { isBooleanObject } from \"@/predicates/is/isBooleanObject\";\nimport { isObjectOrArray } from \"@/predicates/is/isObjectOrArray\";\nimport { isNonEmptyString } from \"@/predicates/is/isNonEmptyString\";\n\n/** ----------------------------------------------------------\n * * ***Type-Utility: `ClassValue`.***\n * ----------------------------------------------------------\n * **Represents a single valid value that can be converted to a CSS class string.**\n * @description\n * - Supports the following types:\n * - `string` → literal class names (non-empty only)\n * - `number | bigint` → numeric class names\n * - `boolean` → only `true` is considered in objects/arrays\n * - `null | undefined` → ignored\n * - `ClassObject` → objects where **keys with truthy values** are included\n * - `ClassValues` → arrays recursively flattened\n * - Used internally by ***`cx` utility function*** to process mixed input values.\n * @example\n * ```ts\n * const val1: ClassValue = \"button\"; // ➔ string\n * const val2: ClassValue = 0; // ➔ number\n * const val3: ClassValue = [\"a\", { b: true }]; // ➔ array with object\n * const val4: ClassValue = { d: true, e: false }; // ➔ object\n * const val5: ClassValue = new String(\"foo\"); // ➔ boxed string\n * const val6: ClassValue = new Number(\"123\"); // ➔ boxed number\n * const val7: ClassValue = new Boolean(\"true\"); // ➔ boxed boolean\n * ```\n */\nexport type ClassValue =\n | ClassValues\n | ClassObject\n | string\n | number\n | bigint\n | null\n | boolean\n | undefined;\n\n/** ----------------------------------------------------------\n * * ***Type-Utility: `ClassObject`.***\n * ----------------------------------------------------------\n * **Represents an object whose keys with truthy values are included in the final class string.**\n * @example\n * ```ts\n * const obj: ClassObject = { \"text-red\": true, \"hidden\": false };\n * // ➔ \"text-red\" when processed by cx\n * ```\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type ClassObject = Record<string, any>;\n\n/** ----------------------------------------------------------\n * * ***Type-Utility: `ClassValues`.***\n * ----------------------------------------------------------\n * **Represents an array of {@link ClassValue | `ClassValue's`}, potentially nested.**\n * @example\n * ```ts\n * const arr: ClassValues = [\n * \"a\",\n * 1,\n * [\"b\", { c: true, d: false }],\n * { e: 2 }\n * ];\n * ```\n */\nexport type ClassValues = ClassValue[];\n\n/** ----------------------------------------------------------\n * * ***Utility: `toStringValue`.***\n * ----------------------------------------------------------\n * **Converts a `ClassValue` into a single space-separated string suitable for CSS class usage.**\n * @param {ClassValue} value The mixed value to process.\n * @returns {string} A string containing all valid class names.\n * @description\n * - Arrays are recursively flattened.\n * - Objects include only keys with truthy values.\n * - Skips `null`, `undefined`, and empty strings.\n * - Numbers, strings, and bigint are included as-is.\n * - Boolean `false` is ignored in objects/arrays.\n * - Boxed primitives (`new String()`, `new Number()`, `new Boolean()`) are supported.\n * - Preserves inherited object keys.\n * @example\n * ```ts\n * toStringValue(\"btn\"); // ➔ \"btn\"\n * toStringValue([\"a\", 0, \"b\"]); // ➔ \"a b\"\n * toStringValue({ a: true, b: false, c: 1 }); // ➔ \"a c\"\n * toStringValue([\"a\", [\"b\", { c: true, d: false }]]); // ➔ \"a b c\"\n * toStringValue(new String(\"foo\")); // ➔ \"foo\"\n * toStringValue(new Number(42)); // ➔ \"42\"\n * toStringValue(new Boolean(true)); // ➔ \"true\"\n * toStringValue(new Boolean(false));// ➔ \"\"\n * ```\n */\nfunction toStringValue(value: ClassValue): string {\n let str = \"\";\n\n if (isNonEmptyString(value) || isNumber(value)) {\n str += value;\n } else if (isObjectOrArray(value)) {\n if (\n isStringObject(value) ||\n isNumberObject(value) ||\n isBooleanObject(value)\n ) {\n const val = value.valueOf();\n if (val) str += val; // skip falsy\n } else if (isArray(value)) {\n for (const item of value) {\n if (!item) continue; // skip falsy\n const y = toStringValue(item);\n if (!y) continue;\n if (str) str += \" \";\n str += y;\n }\n } else {\n for (const key in value) {\n if (!value[key]) continue; // skip falsy\n if (str) str += \" \";\n str += key;\n }\n }\n }\n\n return str;\n}\n\n/** ----------------------------------------------------------\n * * ***Utility: `cx`.***\n * ----------------------------------------------------------\n * **Merge multiple class values into a single, space-separated string suitable for CSS usage.**\n * @description\n * - Supports **nested combinations** of arrays and objects, recursively.\n * - **Falsy values** are skipped:\n * - `false`, `null`, `undefined`, empty strings `\"\"` are ignored anywhere.\n * - Numbers `0` are ignored inside nested arrays/objects.\n * - **Boxed primitives** are correctly unwrapped to their primitive value.\n * - **Inherited object keys** are included in the final class string.\n * - Optimized for **CSS class merging** where conditional inclusion is common.\n * @param {ClassValues} values\n * A list of mixed class values, which can include:\n * - **Strings** → literal class names.\n * - **Numbers** → numeric class names.\n * - **BigInt** → numeric class names larger than JS safe integer limit.\n * - **Arrays** → recursively flattened, can contain nested arrays or objects.\n * - **Objects** → include keys whose values are truthy. Inherited keys are also included.\n * - **Boxed primitives** (`new String()`, `new Number()`, `new Boolean()`) → automatically unwrapped.\n * - **Falsy values** (`false`, `null`, `undefined`, `\"\"`, `0`) are ignored according to original behavior.\n * @returns {string}\n * A single space-separated string containing all valid class names.\n * @example\n * ```ts\n * // Basic string merge\n * cx(\"btn\", \"btn-primary\");\n * // ➔ \"btn btn-primary\"\n *\n * // Mixed arrays and objects\n * cx(\"a\", [\"b\", { c: true, d: false }], { e: 1, f: 0 }, null, 2);\n * // ➔ \"a b c e 2\"\n *\n * // Empty and falsy values are ignored\n * cx(\"\", null, undefined, false, 0);\n * // ➔ \"\"\n *\n * // Nested arrays with objects\n * cx([\"a\", [\"b\", { c: true, d: false }]]);\n * // ➔ \"a b c\"\n *\n * // Boxed primitives are unwrapped\n * cx(new String(\"foo\"), new Number(42), new Boolean(true), new Number(0), new Boolean(false));\n * // ➔ \"foo 42 true\"\n *\n * // Inherited keys from objects are included\n * const proto = { inherited: true };\n * const obj = Object.create(proto);\n * obj.own = true;\n * cx(obj);\n * // ➔ \"own inherited\"\n * ```\n */\nexport function cx(...values: ClassValues): string {\n let str = \"\";\n\n for (const value of values) {\n if (!value) continue; // skip falsy arguments\n const x = toStringValue(value);\n if (!x) continue;\n if (str) str += \" \";\n str += x;\n }\n\n return str;\n}\n","import type { Config as TwConfig } from \"tailwindcss\";\nimport type { ConfigExtension } from \"tailwind-merge-v4\";\n\nimport type { OptionsMergeTwClsV4 } from \"../v4/_private/types\";\n\nimport { hasOwnProp } from \"@/predicates/has/hasOwnProp\";\n\nimport { isNumber } from \"@/predicates/is/isNumber\";\nimport { isFunction } from \"@/predicates/is/isFunction\";\nimport { isPlainObject } from \"@/predicates/is/isPlainObject\";\nimport { isNonEmptyArray } from \"@/predicates/is/isNonEmptyArray\";\nimport { isNonEmptyString } from \"@/predicates/is/isNonEmptyString\";\n\nexport type TailwindConfig = TwConfig;\n\n/**\n * @internal\n */\ntype TwMergeConfigExt = ConfigExtension<string, string>;\n\n/**\n * @internal\n */\ntype ValidatorTwMergeReturn = {\n config: TwConfig;\n override: TwMergeConfigExt[\"override\"];\n cacheSize: TwMergeConfigExt[\"cacheSize\"];\n prefix: TwMergeConfigExt[\"prefix\"];\n experimentalParseClassName?: TwMergeConfigExt[\"experimentalParseClassName\"];\n theme: NonNullable<NonNullable<TwMergeConfigExt[\"extend\"]>[\"theme\"]>;\n classGroups: NonNullable<\n NonNullable<TwMergeConfigExt[\"extend\"]>[\"classGroups\"]\n >;\n conflictingClassGroupModifiers: NonNullable<\n NonNullable<TwMergeConfigExt[\"extend\"]>[\"conflictingClassGroupModifiers\"]\n >;\n conflictingClassGroups: NonNullable<\n NonNullable<TwMergeConfigExt[\"extend\"]>[\"conflictingClassGroups\"]\n >;\n orderSensitiveModifiers: NonNullable<\n NonNullable<TwMergeConfigExt[\"extend\"]>[\"orderSensitiveModifiers\"]\n >;\n};\n\n/**\n * @internal\n */\nexport const validatorPropsTwMerge = (\n options: OptionsMergeTwClsV4\n): ValidatorTwMergeReturn => {\n if (!isPlainObject(options)) options = {};\n let {\n config,\n prefix,\n extend,\n override,\n cacheSize,\n experimentalParseClassName\n } = options;\n\n if (!isPlainObject(config)) config = {};\n if (!isPlainObject(extend)) extend = {};\n if (!isPlainObject(override)) override = {};\n if (!isNumber(cacheSize)) cacheSize = undefined;\n if (!isNonEmptyString(prefix)) prefix = undefined;\n if (!isFunction(experimentalParseClassName))\n experimentalParseClassName = undefined;\n\n const theme = hasOwnProp(extend, \"theme\") ? extend.theme : {};\n const classGroups = hasOwnProp(extend, \"classGroups\")\n ? extend.classGroups\n : {};\n const conflictingClassGroupModifiers = hasOwnProp(\n extend,\n \"conflictingClassGroupModifiers\"\n )\n ? extend.conflictingClassGroupModifiers\n : {};\n\n const conflictingClassGroups = hasOwnProp(extend, \"conflictingClassGroups\")\n ? extend.conflictingClassGroups\n : {};\n const orderSensitiveModifiers =\n hasOwnProp(extend, \"orderSensitiveModifiers\") &&\n isNonEmptyArray(extend.orderSensitiveModifiers)\n ? extend.orderSensitiveModifiers\n : [];\n\n return {\n config,\n override,\n cacheSize,\n prefix,\n experimentalParseClassName,\n theme,\n classGroups,\n conflictingClassGroupModifiers,\n conflictingClassGroups,\n orderSensitiveModifiers\n };\n};\n","import type { OptionsMergeTwClsV3, TwMergeDefaultFnV3 } from \"./_private/types\";\n\nimport { extendTailwindMerge, getDefaultConfig } from \"tailwind-merge-v3\";\n\nimport { isPlainObject } from \"@/predicates/is/isPlainObject\";\nimport { validatorPropsTwMerge } from \"../_private/validate-props\";\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport { customCnVer3 } from \"../../class-names/customCn\";\n\n// Get default Tailwind merge configuration\nconst defaultConfig = getDefaultConfig();\n\n/** -------------------------------------------------------------\n * * ***Customized Tailwind class merger Version 3 with extended rules.***\n * -------------------------------------------------------------\n *\n * **Wraps ***`extendTailwindMerge` from tailwind-merge-v3*** with Tailwind’s default\n * config (_*`getDefaultConfig()` from tailwind-merge-v3*_) to create a **project-ready `twMerge`**.**\n * - 🔑 **When to use it?**\n * - Your project uses **Tailwind v3**.\n * - Extend **class groups** (e.g. add `text-shadow`).\n * - Respect your own **`tailwind.config.ts`** (colors, spacing, fontSize, etc).\n * - Override or fine-tune **merge behavior**.\n * - Create a **project-wide `cn` helper** that replaces raw `twMerge`.\n *\n * @deprecated ***Still supported for advanced Tailwind merge customization, but significantly slower than native `twMerge` during SSR and hydration because merge rules are extended at runtime, prefer `twMerge` + {@link customCnVer3 | `customCnVer3`} for better performance, this utility may be removed in a future release.***\n *\n * @param {OptionsMergeTwClsV3} [options={}]\n * ***Merge options:***\n * - `config` – Your Tailwind config (from `tailwind.config.ts`).\n * - `prefix` - Utility prefix (e.g. `tw-` or `tw`).\n * - `extend` – Extra merge rules (classGroups, theme, etc).\n * - `override` – Fully replace rules.\n * - `cacheSize` – Parsed class cache size.\n * - `experimentalParseClassName` – Custom classname parser.\n *\n * @returns {TwMergeDefaultFnV3}\n * Customized Tailwind class merge function version 3 (same signature as `twMerge`).\n *\n * @example\n * #### Example 1: ***Default behavior (same as tailwind-merge).***\n * ```ts\n * import { twMergeDefaultV3 } from \"@rzl-zone/utils-js/tailwind\";\n *\n * const twMerge = twMergeDefaultV3();\n * twMerge(\"p-2 p-4\");\n * // ➔ \"p-4\"\n * ```\n * #### Example 2: ***Extend class groups.***\n * ```ts\n * import { twMergeDefaultV3 } from \"@rzl-zone/utils-js/tailwind\";\n *\n * const twMerge2 = twMergeDefaultV3({\n * extend: {\n * classGroups: {\n * shadow: [\"shadow-soft\", \"shadow-hard\"],\n * },\n * },\n * });\n * twMerge2(\"shadow-soft shadow-hard\");\n * // ➔ \"shadow-hard\"\n * ```\n * #### Example 3: ***Respect your Tailwind config.***\n * ```ts\n * import config from \"../tailwind.config\";\n * import { twMergeDefaultV3 } from \"@rzl-zone/utils-js/tailwind\";\n *\n * const twMerge3 = twMergeDefaultV3({ config });\n * twMerge3(\"text-base text-xxs\");\n * // ➔ \"text-xxs\" (resolved from config)\n * ```\n * #### Example 4: ***Project-wide helper (recommended).***\n * ```ts\n * import configTwCss from \"../tailwind.config\";\n * import { customCnV3, twMergeDefaultV3, type ClassValues } from \"@rzl-zone/utils-js/tailwind\";\n *\n * const customTwMerge = twMergeDefaultV3({\n * config: configTwCss,\n * extend: {\n * classGroups: { shadow: [\"shadow-soft\", \"shadow-hard\"] },\n * },\n * });\n *\n * export const cnApp = (...classes: ClassValues) => {\n * return customCnV3(customTwMerge, ...classes);\n * };\n *\n * // ✅ Usage\n * cnApp(\"p-2 p-4\"); // ➔ \"p-4\"\n * cnApp(\"shadow-soft shadow-hard\"); // ➔ \"shadow-hard\"\n * cnApp(\"text-base text-xxs\"); // ➔ \"text-xxs\" (uses config)\n *\n * // ⚡ Difference with package-level `cn`\n * import { cnV3, cnV4 } from \"@rzl-zone/utils-js/tailwind\";\n *\n * cnV3(\"text-base text-xxs\");\n * // or\n * cnV4(\"text-base text-xxs\");\n * // ➔ \"text-base\" (❌ doesn't know about your config)\n *\n * cnApp(\"text-base text-xxs\");\n * // ➔ \"text-xxs\" (✅ respects config)\n * ```\n */\nexport const twMergeDefaultV3 = (\n options: OptionsMergeTwClsV3 = {}\n): TwMergeDefaultFnV3 => {\n if (!isPlainObject(options)) options = {};\n const {\n cacheSize,\n classGroups,\n config,\n conflictingClassGroupModifiers,\n conflictingClassGroups,\n override,\n prefix,\n theme,\n experimentalParseClassName\n } = validatorPropsTwMerge(options);\n\n return extendTailwindMerge<string, string>({\n prefix: prefix ?? config.prefix,\n cacheSize: cacheSize || defaultConfig.cacheSize,\n experimentalParseClassName,\n override,\n extend: {\n conflictingClassGroupModifiers: {\n ...defaultConfig.conflictingClassGroupModifiers,\n ...conflictingClassGroupModifiers\n },\n theme: { ...defaultConfig.theme, ...theme },\n conflictingClassGroups: {\n ...defaultConfig.conflictingClassGroups,\n ...conflictingClassGroups\n },\n classGroups: {\n ...defaultConfig.classGroups,\n ...classGroups,\n\n \"text-shadow\": [\n \"\",\n \"-sm\",\n \"-md\",\n \"-lg\",\n \"-xl\",\n \"-xxl\",\n \"-none\",\n \"-default\"\n ].map((size) => `text-shadow${size}`),\n \"font-size\": Object.keys({\n ...(config.theme?.fontSize || {}),\n ...(config.theme?.extend?.fontSize || {})\n }).map((size) => `text-${size}`)\n }\n }\n });\n};\n","import type { OptionsMergeTwClsV4, TwMergeDefaultFnV4 } from \"./_private/types\";\n\nimport { extendTailwindMerge, getDefaultConfig } from \"tailwind-merge-v4\";\n\nimport { isPlainObject } from \"@/predicates/is/isPlainObject\";\nimport { validatorPropsTwMerge } from \"../_private/validate-props\";\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport { customCnVer4 } from \"../../class-names/customCn\";\n\n// Get default Tailwind merge configuration\nconst defaultConfig = getDefaultConfig();\n\n/** -------------------------------------------------------------\n * * ***Customized Tailwind class merger Version 4 with extended rules.***\n * -------------------------------------------------------------\n *\n * **Wraps ***`extendTailwindMerge` from tailwind-merge-v4*** with Tailwind’s default\n * config (_*`getDefaultConfig()` from tailwind-merge-v4*_) to create a **project-ready `twMerge`**.**\n * - 🔑 **When to use it?**\n * - Your project uses **Tailwind v4**.\n * - Extend **class groups** (e.g. add `text-shadow`).\n * - Respect your own **`tailwind.config.ts`** (colors, spacing, fontSize, etc).\n * - Override or fine-tune **merge behavior**.\n * - Create a **project-wide `cn` helper** that replaces raw `twMerge`.\n *\n * @deprecated ***Still supported for advanced Tailwind merge customization, but significantly slower than native `twMerge` during SSR and hydration because merge rules are extended at runtime, prefer `twMerge` + {@link customCnVer4 | `customCnVer4`} for better performance, this utility may be removed in a future release.***\n *\n * @deprecated ***Slower than the default `twMerge`, but still safe to use when custom merge behavior is needed.***\n *\n * @param {OptionsMergeTwClsV4} [options={}]\n * ***Merge options:***\n * - `config` – Your Tailwind config (from `tailwind.config.ts`).\n * - `prefix` - Utility prefix (e.g. `tw-` or `tw`).\n * - `extend` – Extra merge rules (classGroups, theme, etc).\n * - `override` – Fully replace rules.\n * - `cacheSize` – Parsed class cache size.\n * - `experimentalParseClassName` – Custom classname parser.\n *\n * @returns {TwMergeDefaultFnV4}\n * Customized Tailwind class merge function version 4 (same signature as `twMerge`).\n *\n * @example\n * #### Example 1: ***Default behavior (same as tailwind-merge).***\n * ```ts\n * import { twMergeDefaultV4 } from \"@rzl-zone/utils-js/tailwind\";\n *\n * const twMerge = twMergeDefaultV4();\n * twMerge(\"p-2 p-4\");\n * // ➔ \"p-4\"\n * ```\n * #### Example 2: ***Extend class groups.***\n * ```ts\n * import { twMergeDefaultV4 } from \"@rzl-zone/utils-js/tailwind\";\n *\n * const twMerge2 = twMergeDefaultV4({\n * extend: {\n * classGroups: {\n * shadow: [\"shadow-soft\", \"shadow-hard\"],\n * },\n * },\n * });\n * twMerge2(\"shadow-soft shadow-hard\");\n * // ➔ \"shadow-hard\"\n * ```\n * #### Example 3: ***Respect your Tailwind config.***\n * ```ts\n * import config from \"../tailwind.config\";\n * import { twMergeDefaultV4 } from \"@rzl-zone/utils-js/tailwind\";\n *\n * const twMerge3 = twMergeDefaultV4({ config });\n * twMerge3(\"text-base text-xxs\");\n * // ➔ \"text-xxs\" (resolved from config)\n * ```\n * #### Example 4: ***Project-wide helper (recommended).***\n * ```ts\n * import configTwCss from \"../tailwind.config\";\n * import { customCnV4, twMergeDefaultV4, type ClassValues } from \"@rzl-zone/utils-js/tailwind\";\n *\n * const customTwMerge = twMergeDefaultV4({\n * config: configTwCss,\n * extend: {\n * classGroups: { shadow: [\"shadow-soft\", \"shadow-hard\"] },\n * },\n * });\n *\n * export const cnApp = (...classes: ClassValues) => {\n * return customCnV4(customTwMerge, ...classes);\n * };\n *\n * // ✅ Usage\n * cnApp(\"p-2 p-4\"); // ➔ \"p-4\"\n * cnApp(\"shadow-soft shadow-hard\"); // ➔ \"shadow-hard\"\n * cnApp(\"text-base text-xxs\"); // ➔ \"text-xxs\" (uses config)\n *\n * // ⚡ Difference with package-level `cn`\n * import { cnV3, cnV4 } from \"@rzl-zone/utils-js/tailwind\";\n *\n * cnV3(\"text-base text-xxs\");\n * // or\n * cnV4(\"text-base text-xxs\");\n * // ➔ \"text-base\" (❌ doesn't know about your config)\n *\n * cnApp(\"text-base text-xxs\");\n * // ➔ \"text-xxs\" (✅ respects config)\n * ```\n */\nexport const twMergeDefaultV4 = (\n options: OptionsMergeTwClsV4 = {}\n): TwMergeDefaultFnV4 => {\n if (!isPlainObject(options)) options = {};\n const {\n cacheSize,\n classGroups,\n config,\n conflictingClassGroupModifiers,\n conflictingClassGroups,\n orderSensitiveModifiers,\n override,\n prefix,\n theme,\n experimentalParseClassName\n } = validatorPropsTwMerge(options);\n\n return extendTailwindMerge<string, string>({\n prefix: prefix || config.prefix,\n cacheSize: cacheSize || defaultConfig.cacheSize,\n experimentalParseClassName,\n override,\n extend: {\n conflictingClassGroupModifiers: {\n ...defaultConfig.conflictingClassGroupModifiers,\n ...conflictingClassGroupModifiers\n },\n theme: { ...defaultConfig.theme, ...theme },\n conflictingClassGroups: {\n ...defaultConfig.conflictingClassGroups,\n ...conflictingClassGroups\n },\n orderSensitiveModifiers: [\n ...defaultConfig.orderSensitiveModifiers,\n ...orderSensitiveModifiers\n ],\n classGroups: {\n ...defaultConfig.classGroups,\n ...classGroups,\n\n \"text-shadow\": [\n \"\",\n \"-sm\",\n \"-md\",\n \"-lg\",\n \"-xl\",\n \"-xxl\",\n \"-none\",\n \"-default\"\n ].map((size) => `text-shadow${size}`),\n \"font-size\": Object.keys({\n ...(config.theme?.fontSize || {}),\n ...(config.theme?.extend?.fontSize || {})\n }).map((size) => `text-${size}`)\n }\n }\n });\n};\n","import type { TwMergeDefaultFnV3 } from \"../tw-merge/v3/_private/types\";\nimport type { TwMergeDefaultFnV4 } from \"../tw-merge/v4/_private/types\";\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport { twMergeDefaultV3 } from \"../tw-merge/v3/twMergeDefault\";\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport { twMergeDefaultV4 } from \"../tw-merge/v4/twMergeDefault\";\n\nimport { isFunction } from \"@/predicates/is/isFunction\";\nimport { getPreciseType } from \"@/predicates/type/getPreciseType\";\nimport { cx, type ClassValues } from \"./cx\";\n\nexport type { ClassValues };\n\nimport { twMerge as twMergeV3 } from \"tailwind-merge-v3\";\nimport { twMerge as twMergeV4 } from \"tailwind-merge-v4\";\n\n/** -------------------------------------------------------------\n * * ***High-performance `cn` factory utility (Tailwind `v3`).***\n * -------------------------------------------------------------\n * **Combines class-name values and applies the provided Tailwind merge\n * function using the native {@link twMergeV3 | `twMergeV3`} implementation\n * from `tailwind-merge` version 2 for `tailwind version 3`.**\n *\n * This utility is the recommended replacement for deprecated extended\n * runtime merge helpers because it provides significantly better hydration\n * and runtime performance.\n *\n * - ✅ **Recommended when:**\n * - Your project uses **Tailwind v3**.\n * - You want the fastest possible `cn` utility.\n * - You need reusable project-wide `cn*` helpers.\n * - You want predictable Tailwind conflict resolution with minimal overhead.\n *\n * - ⚡ **Performance note**\n * - Uses the native `twMergeV3` implementation directly.\n * - Faster than deprecated extended merge utilities.\n * - Better suited for SSR and hydration-heavy applications.\n *\n * @param {TwMergeDefaultFnV3} customTwMergeV3 - Merge function created via {@link twMergeV3 | `twMergeV3`}.\n * @param {ClassValues} classes - Class values (`string`, `array`, `object`, `etc`).\n * @returns {string} Merged Tailwind class string.\n *\n * @example\n * ```ts\n * import { twMerge as twMergeV3 } from \"tailwind-merge\"; // tw-merge (v2) for tailwind version 3\n * import { customCnVer3, type ClassValues } from \"@rzl-zone/utils-js/tailwind\";\n *\n * // 1. Create app-level helper\n * export const cnApp = (...classes: ClassValues) => {\n * return customCnVer3(twMergeV3, ...classes);\n * };\n *\n * // ✅ Usage\n * cnApp(\"p-2\", \"p-4\"); // ➔ \"p-4\"\n * cnApp(\"text-sm text-lg\"); // ➔ \"text-lg\"\n * cnApp(\"shadow-sm shadow-md\"); // ➔ \"shadow-md\"\n * ```\n */\nexport const customCnVer3 = (\n customTwMergeV3: TwMergeDefaultFnV3 = twMergeV3,\n ...classes: ClassValues\n): string => {\n if (!isFunction(customTwMergeV3)) {\n throw new TypeError(\n `first Parameter (\\`customTwMergeV3\\`) must be of type \\`function\\`, but received: \\`${getPreciseType(\n customTwMergeV3\n )}\\`.`\n );\n }\n\n return customTwMergeV3(cx(...classes));\n};\n\n/** -------------------------------------------------------------\n * * ***High-performance `cn` factory utility (Tailwind `v4`).***\n * -------------------------------------------------------------\n * **Combines class-name values and applies the provided Tailwind merge\n * function using the native {@link twMergeV4 | `twMergeV4`} implementation\n * from `tailwind-merge` version 3 for `tailwind version 4`.**\n *\n * This utility is the recommended replacement for deprecated extended\n * runtime merge helpers because it provides significantly better hydration\n * and runtime performance.\n *\n * - ✅ **Recommended when:**\n * - Your project uses **Tailwind v4**.\n * - You want the fastest possible `cn` utility.\n * - You need reusable project-wide `cn*` helpers.\n * - You want predictable Tailwind conflict resolution with minimal overhead.\n *\n * - ⚡ **Performance note**\n * - Uses the native `twMergeV4` implementation directly.\n * - Faster than deprecated extended merge utilities.\n * - Better suited for SSR and hydration-heavy applications.\n *\n * @param {TwMergeDefaultFnV4} customTwMergeV4 - Merge function created via {@link twMergeV4 | `twMergeV4`}.\n * @param {ClassValues} classes - Class values (`string`, `array`, `object`, `etc`).\n * @returns {string} Merged Tailwind class string.\n *\n * @example\n * ```ts\n * import { twMerge as twMergeV4 } from \"tailwind-merge\"; // tw-merge (v3) for tailwind version 4\n * import { customCnVer4, type ClassValues } from \"@rzl-zone/utils-js/tailwind\";\n *\n * // 1. Create app-level helper\n * export const cnApp = (...classes: ClassValues) => {\n * return customCnVer4(twMergeV4, ...classes);\n * };\n *\n * // ✅ Usage\n * cnApp(\"p-2\", \"p-4\"); // ➔ \"p-4\"\n * cnApp(\"text-sm text-lg\"); // ➔ \"text-lg\"\n * cnApp(\"shadow-sm shadow-md\"); // ➔ \"shadow-md\"\n * ```\n */\nexport const customCnVer4 = (\n customTwMergeV4: TwMergeDefaultFnV4 = twMergeV4,\n ...classes: ClassValues\n): string => {\n if (!isFunction(customTwMergeV4)) {\n throw new TypeError(\n `first Parameter (\\`customTwMergeV4\\`) must be of type \\`function\\`, but received: \\`${getPreciseType(\n customTwMergeV4\n )}\\`.`\n );\n }\n\n return customTwMergeV4(cx(...classes));\n};\n\n/** -------------------------------------------------------------\n * * ***Factory utility for building a custom `cn` helper (Tailwind `v3`).***\n * -------------------------------------------------------------\n *\n * **Wraps internally function to combines class-name values and applies the provided\n * Tailwind merge function (from {@link twMergeDefaultV3 | `twMergeDefaultV3`}).**\n *\n * - 🔑 **When to use it?**\n * - Your project uses **Tailwind v3**.\n * - You extend Tailwind merge rules (`classGroups`, `tailwind.config`).\n * - You need multiple `cn*` variants across apps/packages.\n *\n * @deprecated ***Still supported, but slower during SSR and hydration because it relies on extended runtime merge logic,\n * prefer {@link customCnVer3 | `customCnVer3`}for better performance, this utility may be removed in a future release.***\n *\n * @param {TwMergeDefaultFnV3} customTwMergeV3 - Merge function created via {@link twMergeDefaultV3 | `twMergeDefaultV3`}.\n * @param {ClassValues} classes - Class values (`string`, `array`, `object`, `etc`).\n *\n * @returns {string} Merged Tailwind class string.\n *\n * @example\n * ```ts\n * import tailwindConfig from \"../tailwind.config\";\n * import { twMergeDefaultV3, customCnV3, type ClassValues } from \"@rzl-zone/utils-js/tailwind\";\n *\n * // 1. Create a custom merge function\n * const myCustomTwMerge = twMergeDefaultV3({\n * config: tailwindConfig,\n * extend: {\n * classGroups: {\n * \"text-shadow\": [\"text-shadow\", \"text-shadow-sm\", \"text-shadow-md\"],\n * },\n * },\n * });\n *\n * // 2. Build your helper using `customCnV3`\n * export const cnApp = (...classes: ClassValues) => {\n * return customCnV3(myCustomTwMerge, ...classes);\n * };\n * // ✅ Usage\n * cnApp(\"p-2\", \"p-4\"); // ➔ \"p-4\"\n * cnApp(\"shadow-sm shadow-md\"); // ➔ \"shadow-md\"\n * cnApp(\"text-base text-xxs\"); // ➔ \"text-xxs\" (resolved from config)\n * ```\n */\nexport const customCnV3 = (\n customTwMergeV3: TwMergeDefaultFnV3,\n ...classes: ClassValues\n): string => {\n if (!isFunction(customTwMergeV3)) {\n throw new TypeError(\n `first Parameter (\\`customTwMergeV3\\`) must be of type \\`function\\`, but received: \\`${getPreciseType(\n customTwMergeV3\n )}\\`.`\n );\n }\n\n return customTwMergeV3(cx(...classes));\n};\n\n/** -------------------------------------------------------------\n * * ***Factory utility for building a custom `cn` helper (Tailwind `v4`).***\n * -------------------------------------------------------------\n *\n * **Wraps internally function to combines class-name values and applies the provided\n * Tailwind merge function (from {@link twMergeDefaultV4 | `twMergeDefaultV4`}).**\n *\n * - 🔑 **When to use it?**\n * - Your project uses **Tailwind v4**.\n * - You extend Tailwind merge rules (`classGroups`, `tailwind.config`).\n * - You need multiple `cn*` variants across apps/packages.\n *\n * @deprecated ***Still supported, but slower during SSR and hydration because it relies on extended runtime merge logic,\n * prefer {@link customCnVer4 | `customCnVer4`}for better performance, this utility may be removed in a future release.***\n *\n * @param {TwMergeDefaultFnV4} customTwMergeV4 - Merge function created via {@link twMergeDefaultV4 | `twMergeDefaultV4`}.\n * @param {ClassValues} classes - Class values (`string`, `array`, `object`, `etc`).\n *\n * @returns {string} Merged Tailwind class string.\n *\n * @example\n * ```ts\n * import tailwindConfig from \"../tailwind.config\";\n * import { twMergeDefaultV4, customCnV4, type ClassValues } from \"@rzl-zone/utils-js/tailwind\";\n *\n * // 1. Create a custom merge function\n * const myCustomTwMerge = twMergeDefaultV4({\n * config: tailwindConfig,\n * extend: {\n * classGroups: {\n * \"text-shadow\": [\"text-shadow\", \"text-shadow-sm\", \"text-shadow-md\"],\n * },\n * },\n * });\n *\n * // 2. Build your helper using `customCnV4`\n * export const cnApp = (...classes: ClassValues) => {\n * return customCnV4(myCustomTwMerge, ...classes);\n * };\n *\n * // ✅ Usage\n * cnApp(\"p-2\", \"p-4\"); // ➔ \"p-4\"\n * cnApp(\"shadow-sm shadow-md\"); // ➔ \"shadow-md\"\n * cnApp(\"text-base text-xxs\"); // ➔ \"text-xxs\" (resolved from config)\n * ```\n */\nexport const customCnV4 = (\n customTwMergeV4: TwMergeDefaultFnV4,\n ...classes: ClassValues\n): string => {\n if (!isFunction(customTwMergeV4)) {\n throw new TypeError(\n `first Parameter (\\`customTwMergeV4\\`) must be of type \\`function\\`, but received: \\`${getPreciseType(\n customTwMergeV4\n )}\\`.`\n );\n }\n\n return customTwMergeV4(cx(...classes));\n};\n","import { twMerge as twMergeV3 } from \"tailwind-merge-v3\";\nimport { twMerge as twMergeV4 } from \"tailwind-merge-v4\";\n\nimport { cx, type ClassValues } from \"./cx\";\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport { customCnV3, customCnV4 } from \"./customCn\";\nimport { twMergeDefaultV3 } from \"../tw-merge/v3/twMergeDefault\";\nimport { twMergeDefaultV4 } from \"../tw-merge/v4/twMergeDefault\";\n\n/** -------------------------------------------------------------------\n * * ***Combines and merges class utility values into a single normalized\n * string with `Tailwind CSS v3` conflict resolution.***\n * --------------------------------------------------------------------\n *\n * This utility composes {@link cx | `cx`} and {@link twMergeV3 | `twMerge`} version **2** for ***`tailwind version 3`***:\n *\n * - `cx` handles flexible class inputs (like `clsx`)\n * - `twMerge` resolves Tailwind CSS utility conflicts\n *\n * This provides a complete solution for conditional class composition\n * with deterministic Tailwind merging.\n *\n * - **Behavior:**\n * - Accepts strings, numbers, arrays, and objects\n * - Supports deeply nested class structures\n * - Ignores falsy values (`false`, `null`, `undefined`, `\"\"`, `0`)\n * - Includes object keys with truthy values (including inherited keys)\n * - Unwraps boxed primitives (`new String()`, etc.)\n * - Resolves Tailwind utility conflicts deterministically\n * - Keeps the last conflicting class based on input order\n * - Produces a clean, space-normalized class string\n *\n * This utility is a drop-in replacement for `clsx` or `classnames`\n * with built-in Tailwind conflict resolution.\n *\n * @param values - A list of mixed class values including strings,\n * numbers, arrays, objects, and conditional expressions.\n *\n * @returns A merged and normalized CSS class string.\n *\n * @example\n * ```ts\n * cn(\n * \"p-2\",\n * isActive && \"bg-blue-500\",\n * [\"text-sm\", { \"font-bold\": isBold }],\n * null,\n * 0\n * );\n * // => \"p-2 bg-blue-500 text-sm font-bold\"\n * ```\n *\n * @example\n * ```ts\n * cn(\"p-2 p-4\", { \"text-sm\": true, \"text-lg\": true });\n * // => \"p-4 text-lg\"\n * ```\n */\nexport const cnVer3 = (...values: ClassValues): string =>\n twMergeV3(cx(...values));\n\n/** -------------------------------------------------------------------\n * * ***Combines and merges class utility values into a single normalized\n * string with `Tailwind CSS v4` conflict resolution.***\n * --------------------------------------------------------------------\n *\n * This utility composes {@link cx | `cx`} and {@link twMergeV4 | `twMerge`} version **3** for ***`tailwind version 4`***:\n *\n * - `cx` handles flexible class inputs (like `clsx`)\n * - `twMerge` resolves Tailwind CSS utility conflicts\n *\n * This provides a complete solution for conditional class composition\n * with deterministic Tailwind merging.\n *\n * - **Behavior:**\n * - Accepts strings, numbers, arrays, and objects\n * - Supports deeply nested class structures\n * - Ignores falsy values (`false`, `null`, `undefined`, `\"\"`, `0`)\n * - Includes object keys with truthy values (including inherited keys)\n * - Unwraps boxed primitives (`new String()`, etc.)\n * - Resolves Tailwind utility conflicts deterministically\n * - Keeps the last conflicting class based on input order\n * - Produces a clean, space-normalized class string\n *\n * This utility is a drop-in replacement for `clsx` or `classnames`\n * with built-in Tailwind conflict resolution.\n *\n * @param values - A list of mixed class values including strings,\n * numbers, arrays, objects, and conditional expressions.\n *\n * @returns A merged and normalized CSS class string.\n *\n * @example\n * ```ts\n * cn(\n * \"p-2\",\n * isActive && \"bg-blue-500\",\n * [\"text-sm\", { \"font-bold\": isBold }],\n * null,\n * 0\n * );\n * // => \"p-2 bg-blue-500 text-sm font-bold\"\n * ```\n *\n * @example\n * ```ts\n * cn(\"p-2 p-4\", { \"text-sm\": true, \"text-lg\": true });\n * // => \"p-4 text-lg\"\n * ```\n */\nexport const cnVer4 = (...values: ClassValues): string =>\n twMergeV4(cx(...values));\n\nconst defaultTwMergeV3 = twMergeDefaultV3();\nconst defaultTwMergeV4 = twMergeDefaultV4();\n\n/** -------------------------------------------------------------\n * * ***Default `cnV3` utility (Tailwind v3).***\n * -------------------------------------------------------------\n *\n * **Combines class-name values and then deduplicates/resolves\n * conflicts using {@link twMergeDefaultV3 | `twMergeDefaultV3`}\n * with **Tailwind v3 default config only**.**\n * - ✅ **Use this when:**\n * - Your project uses **Tailwind v3**.\n * - You need a simple `cn` that works out of the box without a custom config.\n * - ⚡ **Need custom rules?**\n * - Create a project-wide helper using\n * {@link twMergeDefaultV3 | `twMergeDefaultV3`} +\n * {@link customCnV3 | `customCnV3`} (see Example 2).\n *\n * @deprecated ***Still supported, but significantly slower during hydration because it uses extended runtime merge logic, prefer {@link cnVer3 | `cnVer3`} for\n * better performance, this utility may be removed in a future release.***\n *\n * @param {ClassValues} classes - Class values (`string`, `array`, `object`, `etc`).\n * @returns {string} Merged Tailwind class string.\n *\n * @example\n * #### Example 1: ✅ Default usage (Tailwind v3).\n * ```ts\n * cnV3(\"p-2\", \"p-4\");\n * // ➔ \"p-4\"\n *\n * cnV3(\"text-red-500\", { \"text-blue-500\": true });\n * // ➔ \"text-blue-500\"\n *\n * cnV3([\"m-2\", [\"m-4\"]], \"m-8\");\n * // ➔ \"m-8\"\n * ```\n * #### Example 2: ⚡ Custom project-wide usage with Tailwind config.\n * ```ts\n * import tailwindConfig from \"../tailwind.config\";\n * import { twMergeDefaultV3, customCnV3, type ClassValues } from \"@rzl-zone/utils-js/tailwind\";\n *\n * const cnApp = (...classes: ClassValues) => {\n * return customCnV3(\n * twMergeDefaultV3({\n * config: tailwindConfig,\n * extend: {\n * classGroups: {\n * \"text-shadow\": [\n * \"text-shadow\",\n * \"text-shadow-sm\",\n * \"text-shadow-md\",\n * ],\n * },\n * },\n * }),\n * // ...other options classes,\n * );\n * };\n *\n * cnApp(\"p-2 p-4\"); // ➔ \"p-4\"\n * cnApp(\"shadow-sm shadow-md\"); // ➔ \"shadow-md\"\n * cnApp(\"text-base text-xxs\"); // ➔ \"text-xxs\" (resolved from config)\n * ```\n */\nexport const cnV3 = (...classes: ClassValues): string => {\n return defaultTwMergeV3(cx(...classes));\n};\n\n/** -------------------------------------------------------------\n * * ***Default `cnV4` utility (Tailwind v4).***\n * -------------------------------------------------------------\n *\n * **Combines class-name values and then deduplicates/resolves\n * conflicts using {@link twMergeDefaultV4 | `twMergeDefaultV4`}\n * with **Tailwind v4 default config only**.**\n * - ✅ **Use this when:**\n * - Your project uses **Tailwind v4**.\n * - You need a simple `cn` that works out of the box without a custom config.\n * - ⚡ **Need custom rules?**\n * - Create a project-wide helper using\n * {@link twMergeDefaultV4 | `twMergeDefaultV4`} +\n * {@link customCnV4 | `customCnV4`} (see Example 2).\n *\n * @deprecated ***Still supported, but significantly slower during hydration because it uses extended runtime merge logic, prefer {@link cnVer4 | `cnVer4`} for\n * better performance, this utility may be removed in a future release.***\n *\n * @param {ClassValues} classes - Class values (`string`, `array`, `object`, `etc`).\n * @returns {string} Merged Tailwind class string.\n * @example\n * #### Example 1: ✅ Default usage (Tailwind v4).\n * ```ts\n * cnV4(\"p-2\", \"p-4\");\n * // ➔ \"p-4\"\n *\n * cnV4(\"text-red-500\", { \"text-blue-500\": true });\n * // ➔ \"text-blue-500\"\n *\n * cnV4([\"m-2\", [\"m-4\"]], \"m-8\");\n * // ➔ \"m-8\"\n * ```\n * #### Example 2: ⚡ Custom project-wide usage with Tailwind config.\n * ```ts\n * import tailwindConfig from \"../tailwind.config\";\n * import { twMergeDefaultV4, customCnV4, type ClassValues } from \"@rzl-zone/utils-js/tailwind\";\n *\n * const cnApp = (...classes: ClassValues) => {\n * return customCnV4(\n * twMergeDefaultV4({\n * config: tailwindConfig,\n * extend: {\n * classGroups: {\n * \"text-shadow\": [\n * \"text-shadow\",\n * \"text-shadow-sm\",\n * \"text-shadow-md\",\n * ],\n * },\n * },\n * }),\n * // ...other options classes,\n * );\n * };\n *\n * cnApp(\"p-2 p-4\"); // ➔ \"p-4\"\n * cnApp(\"shadow-sm shadow-md\"); // ➔ \"shadow-md\"\n * cnApp(\"text-base text-xxs\"); // ➔ \"text-xxs\" (resolved from config)\n * ```\n */\nexport const cnV4 = (...classes: ClassValues): string => {\n return defaultTwMergeV4(cx(...classes));\n};\n","import type { Stringify } from \"@rzl-zone/ts-types-plus\";\n\nimport { isString } from \"@/predicates/is/isString\";\nimport { isEmptyString } from \"@/predicates/is/isEmptyString\";\nimport { getPreciseType } from \"@/predicates/type/getPreciseType\";\nimport { isNonEmptyArray } from \"@/predicates/is/isNonEmptyArray\";\nimport { assertIsArray } from \"@/assertions/objects/assertIsArray\";\n\n/** ----------------------------------------------------------\n * * ***Utility: `shouldForwardProp`.***\n * ----------------------------------------------------------\n * **Creates a helper for styled-components `shouldForwardProp`.**\n *\n * @description\n * 1. Returns a **predicate function** that determines whether a given prop\n * should be forwarded to the DOM.\n * 2. Useful for filtering out internal props (e.g., `$size`, `$active`)\n * so they don't become invalid HTML attributes.\n *\n * - **Behavior:**\n * - Accepts a strict tuple of **string keys** to exclude from forwarding.\n * - Every key is validated as a **non-empty string** at runtime.\n * - Throws a `TypeError` if:\n * - `props` is not an array, or\n * - any item is not a non-empty string.\n * - Automatically coerces the tested prop name to string for matching.\n *\n * @template CustomProps\n * The component props type to validate against.\n *\n * @param {readonly Stringify<keyof CustomProps>[]}\n * props\n * The list of prop names (keys of `CustomProps`) to exclude from forwarding.\n *\n * @returns {(propName: keyof CustomProps | ({} & string)) => boolean}\n * A function that receives a prop name and returns:\n * - `true` ➔ the prop **will** be forwarded to the DOM.\n * - `false` ➔ the prop **will not** be forwarded.\n *\n * @throws **{@link TypeError | `TypeError`}**\n * when:\n * - `props` is not an array, or\n * - any item is not a non-empty string.\n *\n * @example\n * // Basic usage\n * type Props = { $size: string; color: string; visible: boolean };\n * const filter = shouldForwardProp<Props>([\"$size\"]);\n *\n * filter(\"$size\"); // ➔ false (blocked).\n * filter(\"color\"); // ➔ true (forwarded).\n * filter(\"visible\"); // ➔ true (forwarded).\n *\n * @example\n * // With styled-components\n * type CustomProps = { $internal: boolean; public: string; another: boolean };\n *\n * styled.div.withConfig({\n * shouldForwardProp: shouldForwardProp<CustomProps>([\"$internal\"])\n * });\n */\nexport const shouldForwardProp = <CustomProps extends Record<string, unknown>>(\n props: readonly Stringify<keyof CustomProps>[]\n // props: Partial<UnionToTupleStrict<keyof CustomProps>>\n): ((propName: keyof CustomProps | ({} & string)) => boolean) => {\n assertIsArray(props, {\n message: ({ currentType, validType }) =>\n `First parameter (\\`props\\`) must be of type \\`${validType}\\`, but received: \\`${currentType}\\`.`\n });\n\n const invalidItems: { index: number; reason: string }[] = [];\n\n props.forEach((p, idx) => {\n if (!isString(p)) {\n invalidItems.push({\n index: idx,\n reason: `Expected a non-empty string, but received ${getPreciseType(p, {\n formatCase: \"toPascalCaseSpace\"\n })}.`\n });\n } else if (isEmptyString(p)) {\n invalidItems.push({\n index: idx,\n reason: \"Expected a non-empty string, but received EmptyString.\"\n });\n }\n });\n\n if (isNonEmptyArray(invalidItems)) {\n const maxWidth = Math.max(\n ...invalidItems.map((item) => String(item.index).length)\n );\n\n const details = invalidItems\n .map(\n (item) =>\n `• [Index ${String(item.index).padStart(maxWidth, \"0\")}] ${item.reason}`\n )\n .join(\"\\n\");\n\n throw new TypeError(\n `First parameter (\\`props\\`) contains invalid entries:\\n${details}`\n );\n }\n\n return (propName): boolean => {\n return !props.map(String).includes(String(propName));\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiGA,SAAS,cAAc,OAA2B;CAChD,IAAI,MAAM;CAEV,IAAI,iBAAiB,MAAM,IAAI,SAAS,MAAM,EAC5C,OAAO;MACF,IAAI,gBAAgB,MAAM,EAC/B,IACE,eAAe,MAAM,IACrB,eAAe,MAAM,IACrB,gBAAgB,MAAM,EACtB;EACA,MAAM,MAAM,MAAM,SAAS;EAC3B,IAAI,KAAK,OAAO;QACX,IAAI,QAAQ,MAAM,EACvB,KAAK,MAAM,QAAQ,OAAO;EACxB,IAAI,CAAC,MAAM;EACX,MAAM,IAAI,cAAc,KAAK;EAC7B,IAAI,CAAC,GAAG;EACR,IAAI,KAAK,OAAO;EAChB,OAAO;;MAGT,KAAK,MAAM,OAAO,OAAO;EACvB,IAAI,CAAC,MAAM,MAAM;EACjB,IAAI,KAAK,OAAO;EAChB,OAAO;;CAKb,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwDT,SAAgB,GAAG,GAAG,QAA6B;CACjD,IAAI,MAAM;CAEV,KAAK,MAAM,SAAS,QAAQ;EAC1B,IAAI,CAAC,OAAO;EACZ,MAAM,IAAI,cAAc,MAAM;EAC9B,IAAI,CAAC,GAAG;EACR,IAAI,KAAK,OAAO;EAChB,OAAO;;CAGT,OAAO;;;;;;;;ACnJT,MAAa,yBACX,YAC2B;CAC3B,IAAI,CAAC,cAAc,QAAQ,EAAE,UAAU,EAAE;CACzC,IAAI,EACF,QACA,QACA,QACA,UACA,WACA,+BACE;CAEJ,IAAI,CAAC,cAAc,OAAO,EAAE,SAAS,EAAE;CACvC,IAAI,CAAC,cAAc,OAAO,EAAE,SAAS,EAAE;CACvC,IAAI,CAAC,cAAc,SAAS,EAAE,WAAW,EAAE;CAC3C,IAAI,CAAC,SAAS,UAAU,EAAE,YAAY;CACtC,IAAI,CAAC,iBAAiB,OAAO,EAAE,SAAS;CACxC,IAAI,CAAC,WAAW,2BAA2B,EACzC,6BAA6B;CAE/B,MAAM,QAAQ,WAAW,QAAQ,QAAQ,GAAG,OAAO,QAAQ,EAAE;CAC7D,MAAM,cAAc,WAAW,QAAQ,cAAc,GACjD,OAAO,cACP,EAAE;CACN,MAAM,iCAAiC,WACrC,QACA,iCACD,GACG,OAAO,iCACP,EAAE;CAEN,MAAM,yBAAyB,WAAW,QAAQ,yBAAyB,GACvE,OAAO,yBACP,EAAE;CACN,MAAM,0BACJ,WAAW,QAAQ,0BAA0B,IAC7C,gBAAgB,OAAO,wBAAwB,GAC3C,OAAO,0BACP,EAAE;CAER,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD;;;;;ACxFH,MAAMA,kBAAgB,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8FxC,MAAa,oBACX,UAA+B,EAAE,KACV;CACvB,IAAI,CAAC,cAAc,QAAQ,EAAE,UAAU,EAAE;CACzC,MAAM,EACJ,WACA,aACA,QACA,gCACA,wBACA,UACA,QACA,OACA,+BACE,sBAAsB,QAAQ;CAElC,OAAO,oBAAoC;EACzC,QAAQ,UAAU,OAAO;EACzB,WAAW,aAAaA,gBAAc;EACtC;EACA;EACA,QAAQ;GACN,gCAAgC;IAC9B,GAAGA,gBAAc;IACjB,GAAG;IACJ;GACD,OAAO;IAAE,GAAGA,gBAAc;IAAO,GAAG;IAAO;GAC3C,wBAAwB;IACtB,GAAGA,gBAAc;IACjB,GAAG;IACJ;GACD,aAAa;IACX,GAAGA,gBAAc;IACjB,GAAG;IAEH,eAAe;KACb;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACD,CAAC,KAAK,SAAS,cAAc,OAAO;IACrC,aAAa,OAAO,KAAK;KACvB,GAAI,OAAO,OAAO,YAAY,EAAE;KAChC,GAAI,OAAO,OAAO,QAAQ,YAAY,EAAE;KACzC,CAAC,CAAC,KAAK,SAAS,QAAQ,OAAO;IACjC;GACF;EACF,CAAC;;;;;ACjJJ,MAAM,gBAAgBC,oBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgGxC,MAAa,oBACX,UAA+B,EAAE,KACV;CACvB,IAAI,CAAC,cAAc,QAAQ,EAAE,UAAU,EAAE;CACzC,MAAM,EACJ,WACA,aACA,QACA,gCACA,wBACA,yBACA,UACA,QACA,OACA,+BACE,sBAAsB,QAAQ;CAElC,OAAOC,sBAAoC;EACzC,QAAQ,UAAU,OAAO;EACzB,WAAW,aAAa,cAAc;EACtC;EACA;EACA,QAAQ;GACN,gCAAgC;IAC9B,GAAG,cAAc;IACjB,GAAG;IACJ;GACD,OAAO;IAAE,GAAG,cAAc;IAAO,GAAG;IAAO;GAC3C,wBAAwB;IACtB,GAAG,cAAc;IACjB,GAAG;IACJ;GACD,yBAAyB,CACvB,GAAG,cAAc,yBACjB,GAAG,wBACJ;GACD,aAAa;IACX,GAAG,cAAc;IACjB,GAAG;IAEH,eAAe;KACb;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACD,CAAC,KAAK,SAAS,cAAc,OAAO;IACrC,aAAa,OAAO,KAAK;KACvB,GAAI,OAAO,OAAO,YAAY,EAAE;KAChC,GAAI,OAAO,OAAO,QAAQ,YAAY,EAAE;KACzC,CAAC,CAAC,KAAK,SAAS,QAAQ,OAAO;IACjC;GACF;EACF,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACxGJ,MAAa,gBACX,kBAAsCC,SACtC,GAAG,YACQ;CACX,IAAI,CAAC,WAAW,gBAAgB,EAC9B,MAAM,IAAI,UACR,uFAAuF,eACrF,gBACD,CAAC,KACH;CAGH,OAAO,gBAAgB,GAAG,GAAG,QAAQ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CxC,MAAa,gBACX,kBAAsCC,WACtC,GAAG,YACQ;CACX,IAAI,CAAC,WAAW,gBAAgB,EAC9B,MAAM,IAAI,UACR,uFAAuF,eACrF,gBACD,CAAC,KACH;CAGH,OAAO,gBAAgB,GAAG,GAAG,QAAQ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDxC,MAAa,cACX,iBACA,GAAG,YACQ;CACX,IAAI,CAAC,WAAW,gBAAgB,EAC9B,MAAM,IAAI,UACR,uFAAuF,eACrF,gBACD,CAAC,KACH;CAGH,OAAO,gBAAgB,GAAG,GAAG,QAAQ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiDxC,MAAa,cACX,iBACA,GAAG,YACQ;CACX,IAAI,CAAC,WAAW,gBAAgB,EAC9B,MAAM,IAAI,UACR,uFAAuF,eACrF,gBACD,CAAC,KACH;CAGH,OAAO,gBAAgB,GAAG,GAAG,QAAQ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC/LxC,MAAa,UAAU,GAAG,WACxBC,QAAU,GAAG,GAAG,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmD1B,MAAa,UAAU,GAAG,WACxBC,UAAU,GAAG,GAAG,OAAO,CAAC;AAE1B,MAAM,mBAAmB,kBAAkB;AAC3C,MAAM,mBAAmB,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+D3C,MAAa,QAAQ,GAAG,YAAiC;CACvD,OAAO,iBAAiB,GAAG,GAAG,QAAQ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+DzC,MAAa,QAAQ,GAAG,YAAiC;CACvD,OAAO,iBAAiB,GAAG,GAAG,QAAQ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACrLzC,MAAa,qBACX,UAE+D;CAC/D,cAAc,OAAO,EACnB,UAAU,EAAE,aAAa,gBACvB,iDAAiD,UAAU,sBAAsB,YAAY,MAChG,CAAC;CAEF,MAAM,eAAoD,EAAE;CAE5D,MAAM,SAAS,GAAG,QAAQ;EACxB,IAAI,CAAC,SAAS,EAAE,EACd,aAAa,KAAK;GAChB,OAAO;GACP,QAAQ,6CAA6C,eAAe,GAAG,EACrE,YAAY,qBACb,CAAC,CAAC;GACJ,CAAC;OACG,IAAI,cAAc,EAAE,EACzB,aAAa,KAAK;GAChB,OAAO;GACP,QAAQ;GACT,CAAC;GAEJ;CAEF,IAAI,gBAAgB,aAAa,EAAE;EACjC,MAAM,WAAW,KAAK,IACpB,GAAG,aAAa,KAAK,SAAS,OAAO,KAAK,MAAM,CAAC,OAAO,CACzD;EAED,MAAM,UAAU,aACb,KACE,SACC,YAAY,OAAO,KAAK,MAAM,CAAC,SAAS,UAAU,IAAI,CAAC,IAAI,KAAK,SACnE,CACA,KAAK,KAAK;EAEb,MAAM,IAAI,UACR,0DAA0D,UAC3D;;CAGH,QAAQ,aAAsB;EAC5B,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,SAAS,OAAO,SAAS,CAAC"}
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/utils-js
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `3.
|
|
5
|
+
* Version: `3.13.0-beta.2`
|
|
6
6
|
* Author: `Rizalvin Dwiky <rizalvindwiky@gmail.com>`
|
|
7
7
|
* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/utils-js`
|
|
8
8
|
* ========================================================================
|
|
9
9
|
*/
|
|
10
10
|
"use strict";
|
|
11
|
-
const require_assertIsBoolean = require('./assertIsBoolean-
|
|
12
|
-
const require_assertIsArray = require('./assertIsArray-
|
|
13
|
-
const require_isEmptyString = require('./isEmptyString-
|
|
11
|
+
const require_assertIsBoolean = require('./assertIsBoolean-amRiJHnh.cjs');
|
|
12
|
+
const require_assertIsArray = require('./assertIsArray-BqjMoan3.cjs');
|
|
13
|
+
const require_isEmptyString = require('./isEmptyString-DI64RQCy.cjs');
|
|
14
14
|
let tailwind_merge_v3 = require("tailwind-merge-v3");
|
|
15
15
|
let tailwind_merge_v4 = require("tailwind-merge-v4");
|
|
16
16
|
function toStringValue(value) {
|
|
@@ -158,6 +158,14 @@ const twMergeDefaultV4 = (options = {}) => {
|
|
|
158
158
|
}
|
|
159
159
|
});
|
|
160
160
|
};
|
|
161
|
+
const customCnVer3 = (customTwMergeV3 = tailwind_merge_v3.twMerge, ...classes) => {
|
|
162
|
+
if (!require_assertIsBoolean.isFunction(customTwMergeV3)) throw new TypeError(`first Parameter (\`customTwMergeV3\`) must be of type \`function\`, but received: \`${require_assertIsBoolean.getPreciseType(customTwMergeV3)}\`.`);
|
|
163
|
+
return customTwMergeV3(cx(...classes));
|
|
164
|
+
};
|
|
165
|
+
const customCnVer4 = (customTwMergeV4 = tailwind_merge_v4.twMerge, ...classes) => {
|
|
166
|
+
if (!require_assertIsBoolean.isFunction(customTwMergeV4)) throw new TypeError(`first Parameter (\`customTwMergeV4\`) must be of type \`function\`, but received: \`${require_assertIsBoolean.getPreciseType(customTwMergeV4)}\`.`);
|
|
167
|
+
return customTwMergeV4(cx(...classes));
|
|
168
|
+
};
|
|
161
169
|
const customCnV3 = (customTwMergeV3, ...classes) => {
|
|
162
170
|
if (!require_assertIsBoolean.isFunction(customTwMergeV3)) throw new TypeError(`first Parameter (\`customTwMergeV3\`) must be of type \`function\`, but received: \`${require_assertIsBoolean.getPreciseType(customTwMergeV3)}\`.`);
|
|
163
171
|
return customTwMergeV3(cx(...classes));
|
|
@@ -166,6 +174,8 @@ const customCnV4 = (customTwMergeV4, ...classes) => {
|
|
|
166
174
|
if (!require_assertIsBoolean.isFunction(customTwMergeV4)) throw new TypeError(`first Parameter (\`customTwMergeV4\`) must be of type \`function\`, but received: \`${require_assertIsBoolean.getPreciseType(customTwMergeV4)}\`.`);
|
|
167
175
|
return customTwMergeV4(cx(...classes));
|
|
168
176
|
};
|
|
177
|
+
const cnVer3 = (...values) => (0, tailwind_merge_v3.twMerge)(cx(...values));
|
|
178
|
+
const cnVer4 = (...values) => (0, tailwind_merge_v4.twMerge)(cx(...values));
|
|
169
179
|
const defaultTwMergeV3 = twMergeDefaultV3();
|
|
170
180
|
const defaultTwMergeV4 = twMergeDefaultV4();
|
|
171
181
|
const cnV3 = (...classes) => {
|
|
@@ -208,6 +218,18 @@ Object.defineProperty(exports, 'cnV4', {
|
|
|
208
218
|
return cnV4;
|
|
209
219
|
}
|
|
210
220
|
});
|
|
221
|
+
Object.defineProperty(exports, 'cnVer3', {
|
|
222
|
+
enumerable: true,
|
|
223
|
+
get: function () {
|
|
224
|
+
return cnVer3;
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
Object.defineProperty(exports, 'cnVer4', {
|
|
228
|
+
enumerable: true,
|
|
229
|
+
get: function () {
|
|
230
|
+
return cnVer4;
|
|
231
|
+
}
|
|
232
|
+
});
|
|
211
233
|
Object.defineProperty(exports, 'customCnV3', {
|
|
212
234
|
enumerable: true,
|
|
213
235
|
get: function () {
|
|
@@ -220,6 +242,18 @@ Object.defineProperty(exports, 'customCnV4', {
|
|
|
220
242
|
return customCnV4;
|
|
221
243
|
}
|
|
222
244
|
});
|
|
245
|
+
Object.defineProperty(exports, 'customCnVer3', {
|
|
246
|
+
enumerable: true,
|
|
247
|
+
get: function () {
|
|
248
|
+
return customCnVer3;
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
Object.defineProperty(exports, 'customCnVer4', {
|
|
252
|
+
enumerable: true,
|
|
253
|
+
get: function () {
|
|
254
|
+
return customCnVer4;
|
|
255
|
+
}
|
|
256
|
+
});
|
|
223
257
|
Object.defineProperty(exports, 'cx', {
|
|
224
258
|
enumerable: true,
|
|
225
259
|
get: function () {
|
|
@@ -244,4 +278,4 @@ Object.defineProperty(exports, 'twMergeDefaultV4', {
|
|
|
244
278
|
return twMergeDefaultV4;
|
|
245
279
|
}
|
|
246
280
|
});
|
|
247
|
-
//# sourceMappingURL=tailwind-
|
|
281
|
+
//# sourceMappingURL=tailwind-C1YtxJ-K.cjs.map
|