@rzl-zone/utils-js 3.11.1 → 3.12.1-beta.0

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.
Files changed (286) hide show
  1. package/{LICENSE.md → LICENSE} +3 -3
  2. package/README.md +62 -89
  3. package/dist/.references/index.d.cts +25 -0
  4. package/dist/.references/index.d.ts +25 -0
  5. package/dist/assertIsArray-BChqwPiP.cjs +26 -0
  6. package/dist/assertIsArray-BChqwPiP.cjs.map +1 -0
  7. package/dist/assertIsArray-BfAbIUfa.js +20 -0
  8. package/dist/assertIsArray-BfAbIUfa.js.map +1 -0
  9. package/dist/assertIsBoolean-BlBct0Fc.js +1073 -0
  10. package/dist/assertIsBoolean-BlBct0Fc.js.map +1 -0
  11. package/dist/assertIsBoolean-DozdtbNi.cjs +1283 -0
  12. package/dist/assertIsBoolean-DozdtbNi.cjs.map +1 -0
  13. package/dist/assertIsString-Bvk7bUL7.cjs +26 -0
  14. package/dist/assertIsString-Bvk7bUL7.cjs.map +1 -0
  15. package/dist/assertIsString-DqV9NwbI.js +20 -0
  16. package/dist/assertIsString-DqV9NwbI.js.map +1 -0
  17. package/dist/assertions/index.cjs +37 -40
  18. package/dist/assertions/index.cjs.map +1 -0
  19. package/dist/assertions/index.d.cts +12 -0
  20. package/dist/assertions/index.d.ts +10 -824
  21. package/dist/assertions/index.js +30 -13
  22. package/dist/assertions/index.js.map +1 -0
  23. package/dist/conversions/index.cjs +34 -103
  24. package/dist/conversions/index.d.cts +12 -0
  25. package/dist/conversions/index.d.ts +10 -1791
  26. package/dist/conversions/index.js +14 -24
  27. package/dist/conversions-CBs8-REq.cjs +448 -0
  28. package/dist/conversions-CBs8-REq.cjs.map +1 -0
  29. package/dist/conversions-EMJa3g-D.js +382 -0
  30. package/dist/conversions-EMJa3g-D.js.map +1 -0
  31. package/dist/events/index.cjs +55 -31
  32. package/dist/events/index.cjs.map +1 -0
  33. package/dist/events/index.d.cts +174 -0
  34. package/dist/events/index.d.ts +31 -35
  35. package/dist/events/index.js +50 -12
  36. package/dist/events/index.js.map +1 -0
  37. package/dist/formatEnvPort-DpIXzPAZ.js +159 -0
  38. package/dist/formatEnvPort-DpIXzPAZ.js.map +1 -0
  39. package/dist/formatEnvPort-hHNvOim-.cjs +171 -0
  40. package/dist/formatEnvPort-hHNvOim-.cjs.map +1 -0
  41. package/dist/formatters/index.cjs +21 -61
  42. package/dist/formatters/index.d.cts +12 -0
  43. package/dist/formatters/index.d.ts +10 -2152
  44. package/dist/formatters/index.js +10 -18
  45. package/dist/formatters-QcZO_Cpx.js +367 -0
  46. package/dist/formatters-QcZO_Cpx.js.map +1 -0
  47. package/dist/formatters-lAYgA11L.cjs +427 -0
  48. package/dist/formatters-lAYgA11L.cjs.map +1 -0
  49. package/dist/generators/index.cjs +161 -41
  50. package/dist/generators/index.cjs.map +1 -0
  51. package/dist/generators/index.d.cts +12 -0
  52. package/dist/generators/index.d.ts +10 -338
  53. package/dist/generators/index.js +154 -14
  54. package/dist/generators/index.js.map +1 -0
  55. package/dist/index-26W7ItWx.d.ts +760 -0
  56. package/dist/index-BPPQjAfs.d.cts +2359 -0
  57. package/dist/index-BXjlgBLz.d.cts +2139 -0
  58. package/dist/index-B_Wwo91H.d.ts +2359 -0
  59. package/dist/index-CpufydcI.d.cts +704 -0
  60. package/dist/index-Czc4O526.d.ts +333 -0
  61. package/dist/index-DPs1_p5G.d.cts +760 -0
  62. package/dist/index-DRpOyBSC.d.ts +1703 -0
  63. package/dist/index-DWWvtHUn.d.cts +822 -0
  64. package/dist/index-DnM0LD0n.d.cts +333 -0
  65. package/dist/index-GUZ9fK6T.d.ts +2139 -0
  66. package/dist/index-I4fAzwXV.d.ts +704 -0
  67. package/dist/index-JDrOl_19.d.ts +822 -0
  68. package/dist/index-b66P49Qe.d.cts +1703 -0
  69. package/dist/isBigInt-B1cijjqm.cjs +20 -0
  70. package/dist/isBigInt-B1cijjqm.cjs.map +1 -0
  71. package/dist/isBigInt-C0bN0Rhu.js +14 -0
  72. package/dist/isBigInt-C0bN0Rhu.js.map +1 -0
  73. package/dist/isEmptyObject-DI42NEo0.cjs +37 -0
  74. package/dist/isEmptyObject-DI42NEo0.cjs.map +1 -0
  75. package/dist/isEmptyObject-DeLVIJpl.js +25 -0
  76. package/dist/isEmptyObject-DeLVIJpl.js.map +1 -0
  77. package/dist/isEmptyString-BTUWYTbw.js +15 -0
  78. package/dist/isEmptyString-BTUWYTbw.js.map +1 -0
  79. package/dist/isEmptyString-CCK3bP74.cjs +21 -0
  80. package/dist/isEmptyString-CCK3bP74.cjs.map +1 -0
  81. package/dist/isEmptyValue-DMSMFTU8.cjs +30 -0
  82. package/dist/isEmptyValue-DMSMFTU8.cjs.map +1 -0
  83. package/dist/isEmptyValue-fjnfQnt5.js +24 -0
  84. package/dist/isEmptyValue-fjnfQnt5.js.map +1 -0
  85. package/dist/isEqual-B1fRgEuU.cjs +111 -0
  86. package/dist/isEqual-B1fRgEuU.cjs.map +1 -0
  87. package/dist/isEqual-DhyP8fB_.js +87 -0
  88. package/dist/isEqual-DhyP8fB_.js.map +1 -0
  89. package/dist/isFinite-BYMOo0os.js +15 -0
  90. package/dist/isFinite-BYMOo0os.js.map +1 -0
  91. package/dist/isFinite-sFkps2TY.cjs +21 -0
  92. package/dist/isFinite-sFkps2TY.cjs.map +1 -0
  93. package/dist/isInteger-DS9V7l_f.js +14 -0
  94. package/dist/isInteger-DS9V7l_f.js.map +1 -0
  95. package/dist/isInteger-FTCthMre.cjs +20 -0
  96. package/dist/isInteger-FTCthMre.cjs.map +1 -0
  97. package/dist/isPlainObject-DcFGh3_5.d.ts +530 -0
  98. package/dist/isPlainObject-doTI11Ib.d.cts +530 -0
  99. package/dist/isServer-D1TXfOs3.js +14 -0
  100. package/dist/isServer-D1TXfOs3.js.map +1 -0
  101. package/dist/isServer-q-QLFCqE.cjs +20 -0
  102. package/dist/isServer-q-QLFCqE.cjs.map +1 -0
  103. package/dist/isTypedArray-47R0wdrc.js +31 -0
  104. package/dist/isTypedArray-47R0wdrc.js.map +1 -0
  105. package/dist/isTypedArray-DiCoqffZ.cjs +43 -0
  106. package/dist/isTypedArray-DiCoqffZ.cjs.map +1 -0
  107. package/dist/isURL-CQiowFq2.js +14 -0
  108. package/dist/isURL-CQiowFq2.js.map +1 -0
  109. package/dist/isURL-WZypXsax.cjs +20 -0
  110. package/dist/isURL-WZypXsax.cjs.map +1 -0
  111. package/dist/isValidDomain-BSXshgkC.cjs +1788 -0
  112. package/dist/isValidDomain-BSXshgkC.cjs.map +1 -0
  113. package/dist/isValidDomain-DwA2EN79.js +1782 -0
  114. package/dist/isValidDomain-DwA2EN79.js.map +1 -0
  115. package/dist/next/index.cjs +119 -212
  116. package/dist/next/index.cjs.map +1 -0
  117. package/dist/next/index.d.cts +226 -0
  118. package/dist/next/index.d.ts +26 -31
  119. package/dist/next/index.js +117 -210
  120. package/dist/next/index.js.map +1 -0
  121. package/dist/next/server/index.cjs +25 -40
  122. package/dist/next/server/index.cjs.map +1 -0
  123. package/dist/next/server/index.d.cts +39 -0
  124. package/dist/next/server/index.d.ts +9 -10
  125. package/dist/next/server/index.js +23 -38
  126. package/dist/next/server/index.js.map +1 -0
  127. package/dist/noop-B2mTBhW-.cjs +18 -0
  128. package/dist/noop-B2mTBhW-.cjs.map +1 -0
  129. package/dist/noop-BzktGBVz.js +12 -0
  130. package/dist/noop-BzktGBVz.js.map +1 -0
  131. package/dist/normalizeSpaces-DQHR3Tlr.cjs +29 -0
  132. package/dist/normalizeSpaces-DQHR3Tlr.cjs.map +1 -0
  133. package/dist/normalizeSpaces-WS_iERJk.js +23 -0
  134. package/dist/normalizeSpaces-WS_iERJk.js.map +1 -0
  135. package/dist/normalizeString-2WLth_Gj.js +15 -0
  136. package/dist/normalizeString-2WLth_Gj.js.map +1 -0
  137. package/dist/normalizeString-D8euBcRD.cjs +21 -0
  138. package/dist/normalizeString-D8euBcRD.cjs.map +1 -0
  139. package/dist/operations/index.cjs +65 -32
  140. package/dist/operations/index.cjs.map +1 -0
  141. package/dist/operations/index.d.cts +139 -0
  142. package/dist/operations/index.d.ts +10 -15
  143. package/dist/operations/index.js +61 -17
  144. package/dist/operations/index.js.map +1 -0
  145. package/dist/parsers/index.cjs +12 -19
  146. package/dist/parsers/index.d.cts +239 -0
  147. package/dist/parsers/index.d.ts +71 -72
  148. package/dist/parsers/index.js +10 -12
  149. package/dist/parsers-DXtpsDyj.cjs +649 -0
  150. package/dist/parsers-DXtpsDyj.cjs.map +1 -0
  151. package/dist/parsers-Dpuq-V4u.js +643 -0
  152. package/dist/parsers-Dpuq-V4u.js.map +1 -0
  153. package/dist/parsing-B43x1sxn.js +50 -0
  154. package/dist/parsing-B43x1sxn.js.map +1 -0
  155. package/dist/parsing-lRoxn1Nz.cjs +56 -0
  156. package/dist/parsing-lRoxn1Nz.cjs.map +1 -0
  157. package/dist/predicates/index.cjs +91 -296
  158. package/dist/predicates/index.d.cts +13 -0
  159. package/dist/predicates/index.d.ts +12 -2482
  160. package/dist/predicates/index.js +23 -25
  161. package/dist/predicates-DiaYA7Ps.cjs +413 -0
  162. package/dist/predicates-DiaYA7Ps.cjs.map +1 -0
  163. package/dist/predicates-gNepszvo.js +257 -0
  164. package/dist/predicates-gNepszvo.js.map +1 -0
  165. package/dist/promises/index.cjs +76 -24
  166. package/dist/promises/index.cjs.map +1 -0
  167. package/dist/promises/index.d.cts +123 -0
  168. package/dist/promises/index.d.ts +28 -31
  169. package/dist/promises/index.js +73 -13
  170. package/dist/promises/index.js.map +1 -0
  171. package/dist/punyCode-CTWXVVFo.cjs +185 -0
  172. package/dist/punyCode-CTWXVVFo.cjs.map +1 -0
  173. package/dist/punyCode-hmiFzLWT.js +179 -0
  174. package/dist/punyCode-hmiFzLWT.js.map +1 -0
  175. package/dist/removeSpaces-BE8lfh-4.js +19 -0
  176. package/dist/removeSpaces-BE8lfh-4.js.map +1 -0
  177. package/dist/removeSpaces-DRRxNWlb.cjs +25 -0
  178. package/dist/removeSpaces-DRRxNWlb.cjs.map +1 -0
  179. package/dist/safeJsonParse-BBnQElk8.cjs +208 -0
  180. package/dist/safeJsonParse-BBnQElk8.cjs.map +1 -0
  181. package/dist/safeJsonParse-CXruaP0p.js +184 -0
  182. package/dist/safeJsonParse-CXruaP0p.js.map +1 -0
  183. package/dist/safeStableStringify-BNh3D0K0.js +88 -0
  184. package/dist/safeStableStringify-BNh3D0K0.js.map +1 -0
  185. package/dist/safeStableStringify-Cc62pfRp.cjs +106 -0
  186. package/dist/safeStableStringify-Cc62pfRp.cjs.map +1 -0
  187. package/dist/strings/index.cjs +76 -81
  188. package/dist/strings/index.cjs.map +1 -0
  189. package/dist/strings/index.d.cts +12 -0
  190. package/dist/strings/index.d.ts +10 -775
  191. package/dist/strings/index.js +59 -14
  192. package/dist/strings/index.js.map +1 -0
  193. package/dist/tailwind/index.cjs +19 -47
  194. package/dist/tailwind/index.d.cts +12 -0
  195. package/dist/tailwind/index.d.ts +11 -712
  196. package/dist/tailwind/index.js +10 -12
  197. package/dist/tailwind-DJ4cmLUw.cjs +247 -0
  198. package/dist/tailwind-DJ4cmLUw.cjs.map +1 -0
  199. package/dist/tailwind-IJvOdkZp.js +199 -0
  200. package/dist/tailwind-IJvOdkZp.js.map +1 -0
  201. package/dist/toStringArrayUnRecursive-CFs0jTEg.js +39 -0
  202. package/dist/toStringArrayUnRecursive-CFs0jTEg.js.map +1 -0
  203. package/dist/toStringArrayUnRecursive-xUaU8Ot9.cjs +51 -0
  204. package/dist/toStringArrayUnRecursive-xUaU8Ot9.cjs.map +1 -0
  205. package/dist/urls/index.cjs +129 -57
  206. package/dist/urls/index.cjs.map +1 -0
  207. package/dist/urls/index.d.cts +740 -0
  208. package/dist/urls/index.d.ts +218 -224
  209. package/dist/urls/index.js +121 -26
  210. package/dist/urls/index.js.map +1 -0
  211. package/package.json +203 -194
  212. package/dist/chunk-22V4WP3H.js +0 -53
  213. package/dist/chunk-2XSZ2ANI.js +0 -63
  214. package/dist/chunk-3T6VSWYX.js +0 -21
  215. package/dist/chunk-5WIEDF2J.js +0 -1823
  216. package/dist/chunk-6EDFZJZ5.cjs +0 -598
  217. package/dist/chunk-6LXWT2I5.js +0 -32
  218. package/dist/chunk-6YGBRENU.js +0 -209
  219. package/dist/chunk-7FGNVDEV.cjs +0 -38
  220. package/dist/chunk-AXDYWO67.js +0 -119
  221. package/dist/chunk-B6PMNZ4M.cjs +0 -35
  222. package/dist/chunk-BAV5T2E3.cjs +0 -15
  223. package/dist/chunk-BLF7SD66.js +0 -95
  224. package/dist/chunk-BMZZXZJ2.cjs +0 -30
  225. package/dist/chunk-BOYP3ARU.js +0 -264
  226. package/dist/chunk-BPYW5YL7.js +0 -16
  227. package/dist/chunk-C2PV3VWC.cjs +0 -118
  228. package/dist/chunk-CCJ2MSN7.js +0 -16
  229. package/dist/chunk-DAPAK2W3.cjs +0 -123
  230. package/dist/chunk-DLS3G6WQ.cjs +0 -23
  231. package/dist/chunk-DNMCR5JH.js +0 -370
  232. package/dist/chunk-DVMHRLKP.cjs +0 -16
  233. package/dist/chunk-EBYFYZW4.cjs +0 -26
  234. package/dist/chunk-ENMRZ4BE.js +0 -302
  235. package/dist/chunk-FJ4BQFVO.js +0 -587
  236. package/dist/chunk-GIKL4PUF.cjs +0 -106
  237. package/dist/chunk-GOFINGT6.js +0 -35
  238. package/dist/chunk-GXKQ3LHF.js +0 -101
  239. package/dist/chunk-HNBRGN4R.js +0 -24
  240. package/dist/chunk-HYN6FC5A.cjs +0 -249
  241. package/dist/chunk-IZGVBYFN.js +0 -242
  242. package/dist/chunk-JIE447J5.js +0 -676
  243. package/dist/chunk-JXEIJM5M.cjs +0 -237
  244. package/dist/chunk-K47GZDBH.js +0 -115
  245. package/dist/chunk-K5536YHG.cjs +0 -269
  246. package/dist/chunk-KHO2SBNA.cjs +0 -16
  247. package/dist/chunk-KXJ7X325.cjs +0 -308
  248. package/dist/chunk-L5RDAVVH.js +0 -14
  249. package/dist/chunk-LJHPTLWB.js +0 -109
  250. package/dist/chunk-M7ELWZXM.cjs +0 -1825
  251. package/dist/chunk-MSUW5VHZ.js +0 -1590
  252. package/dist/chunk-MUHRPRR7.cjs +0 -65
  253. package/dist/chunk-MV3TSQSH.cjs +0 -397
  254. package/dist/chunk-NLZLXWAU.cjs +0 -678
  255. package/dist/chunk-NVRZPF5M.cjs +0 -18
  256. package/dist/chunk-ONZFBJVW.js +0 -14
  257. package/dist/chunk-PGNL7JXO.cjs +0 -251
  258. package/dist/chunk-Q4GEQS7X.cjs +0 -564
  259. package/dist/chunk-QNKGP5DY.js +0 -14
  260. package/dist/chunk-QYI2VJLS.cjs +0 -211
  261. package/dist/chunk-RBWZII5I.js +0 -59
  262. package/dist/chunk-RMP7VMPB.cjs +0 -33
  263. package/dist/chunk-RZOGBYIS.js +0 -21
  264. package/dist/chunk-SU3UELUB.cjs +0 -36
  265. package/dist/chunk-SYHPSOUU.cjs +0 -1626
  266. package/dist/chunk-SZUNAEMR.js +0 -246
  267. package/dist/chunk-TER22LO4.cjs +0 -64
  268. package/dist/chunk-TJHGRQ4P.js +0 -33
  269. package/dist/chunk-U23I7JPB.cjs +0 -56
  270. package/dist/chunk-U7HHN47R.js +0 -552
  271. package/dist/chunk-UDA26MCU.cjs +0 -16
  272. package/dist/chunk-UIAWUZ4H.js +0 -31
  273. package/dist/chunk-ULQPCIA2.js +0 -16
  274. package/dist/chunk-VJDDGRIK.cjs +0 -16
  275. package/dist/chunk-WETQI6HM.js +0 -232
  276. package/dist/chunk-WLOQQFDS.cjs +0 -18
  277. package/dist/chunk-WVSPXFTY.js +0 -14
  278. package/dist/chunk-WXFTVXBF.cjs +0 -23
  279. package/dist/chunk-XPVTIGU2.cjs +0 -113
  280. package/dist/chunk-XX6RUGTM.cjs +0 -18
  281. package/dist/chunk-YWHHVDT4.js +0 -13
  282. package/dist/chunk-ZPDMWDGZ.cjs +0 -101
  283. package/dist/chunk-ZVWZEGQP.js +0 -28
  284. package/dist/index.d.ts +0 -24
  285. package/dist/isPlainObject-0p3VveWr.d.ts +0 -534
  286. package/dist/rzl-utils.global.js +0 -10
@@ -1,777 +1,12 @@
1
1
  /*!
2
- * ====================================================
3
- * Rzl Utils-JS.
4
- * ----------------------------------------------------
5
- * Version: 3.11.1.
6
- * Author: Rizalvin Dwiky.
7
- * Repository: https://github.com/rzl-zone/utils-js.
8
- * ====================================================
9
- */
10
- import { Nilable, Extends } from '@rzl-zone/ts-types-plus';
11
-
12
- type CapitalizeFirstOptions = {
13
- /** If true **(default)**, the rest of the string will be converted to lowercase after capitalizing the first letter.
14
- *
15
- * @default true
16
- */
17
- lowerCaseNextRest?: boolean;
18
- /** If true, the string will trimmed, default: `false`.
19
- *
20
- * @default false
21
- */
22
- trim?: boolean;
23
- };
24
- /** ----------------------------------------------------------
25
- * * ***Utility: `capitalizeFirst`.***
26
- * ----------------------------------------------------------
27
- * **Capitalizes the first letter of a string, with optionally lowercases the rest and trims whitespace.**
28
- * @param {string | null | undefined} string - The string to be processed.
29
- * @param {CapitalizeFirstOptions} [options] - Options to control behavior.
30
- * @param {CapitalizeFirstOptions["lowerCaseNextRest"]} [options.lowerCaseNextRest=true] - If true, lowercases the rest (next first letter), default: `true`.
31
- * @param {CapitalizeFirstOptions["trim"]} [options.trim=false] - If true, trims the string before processing, default: `false`.
32
- * @returns {string} The processed string, returns `""` if input is `null`, `undefined`, or `not a valid string`.
33
- * @example
34
- * ```ts
35
- * capitalizeFirst(" hello WORLD ");
36
- * // ➔ " Hello world"
37
- * capitalizeFirst(" hello WORLD ", { trim: true });
38
- * // ➔ "Hello world"
39
- * capitalizeFirst("FOO", { lowerCaseNextRest: false });
40
- * // ➔ "FOO"
41
- * capitalizeFirst(" foo BAR ", { trim: true, lowerCaseNextRest: false });
42
- * // ➔ "Foo BAR"
43
- * ```
44
- * #### ℹ️ If null, undefined, or not a valid string input, return `""`.
45
- * ```ts
46
- * capitalizeFirst(123);
47
- * capitalizeFirst(null);
48
- * capitalizeFirst(undefined);
49
- * // ➔ ""
50
- * ```
51
- */
52
- declare const capitalizeFirst: (string: string | null | undefined, options?: CapitalizeFirstOptions) => string;
53
-
54
- type CapitalizeWordsOptions = {
55
- /** If `true`, removes leading and trailing spaces, default `false`.
56
- *
57
- * @default false
58
- */
59
- trim?: boolean;
60
- /** If `true`, collapses multiple spaces **between words** into a single space (while preserving leading/trailing spaces), default `false`.
61
- *
62
- * @default false
63
- */
64
- collapseSpaces?: boolean;
65
- };
66
- /** ----------------------------------------------------------
67
- * * ***Utility: `capitalizeWords`.***
68
- * ----------------------------------------------------------
69
- * **Capitalizes the first letter of each word in a string while converting the rest to lowercase.**
70
- * @param {string | null | undefined} value
71
- * ***The input string to be processed.***
72
- * - If `null` or `undefined`, returns an empty-string (`""`).
73
- * @param {CapitalizeWordsOptions} [options]
74
- * ***Optional settings to control the output:***
75
- * - `trim`: If `true`, removes leading and trailing spaces, defaultValue: `false`.
76
- * - `collapseSpaces`: If `true`, collapses multiple spaces **between words** into a single space (while preserving leading/trailing spaces), defaultValue: `false`.
77
- * @returns {string} A new string where each word starts with an uppercase letter
78
- * and the remaining letters are lowercase.
79
- * - If `value` is `empty`, `null`, or `undefined`, returns an `empty-string`.
80
- * @example
81
- * ```ts
82
- * capitalizeWords(" hello world ");
83
- * // ➔ " Hello World "
84
- * capitalizeWords(" hello world ", { trim: true });
85
- * // ➔ "Hello World"
86
- * capitalizeWords(" hello world ", { collapseSpaces: true });
87
- * // ➔ " Hello World "
88
- * capitalizeWords(" hello world ", { trim: true, collapseSpaces: true });
89
- * // ➔ "Hello World"
90
- * ```
91
- * #### ℹ️ If null, undefined, or not a valid string input, return "".
92
- * ```ts
93
- * capitalizeWords(123);
94
- * capitalizeWords(null);
95
- * capitalizeWords(undefined);
96
- * // ➔ ""
97
- * ```
98
- */
99
- declare const capitalizeWords: (value: string | null | undefined, options?: CapitalizeWordsOptions) => string;
100
-
101
- /** --------------------------------------------------
102
- * * ***Represents a string input.***
103
- * --------------------------------------------------
104
- * - **Can be one of:**
105
- * - A single `string`
106
- * - An array of strings (`string[]`)
107
- * - A readonly array of strings (`readonly string[]`)
108
- * - `null` or `undefined`
109
- * @template T - A string or array of strings.
110
- * @private ***types input for {@link toCamelCase}, {@link toPascalCaseSpace}, {@link toPascalCase}, {@link toLowerCase}, {@link toKebabCase}, {@link toSnakeCase}, {@link toDotCase} and {@link slugify}.***
111
- */
112
- type StringLike = Nilable<string | string[] | ReadonlyArray<string>>;
113
- /** --------------------------------------------------
114
- * * ***Represents a collection of strings.***
115
- * --------------------------------------------------
116
- * - **Can be one of:**
117
- * - A single `string`
118
- * - An array of strings (`string[]`)
119
- * - A readonly array of strings (`readonly string[]`)
120
- * - A `Set<string>`
121
- * - A `ReadonlySet<string>`
122
- * @private ***types options for {@link toCamelCase}, {@link toPascalCaseSpace}, {@link toPascalCase}, {@link toLowerCase}, {@link toKebabCase}, {@link toSnakeCase}, {@link toDotCase} and {@link slugify}.***
123
- */
124
- type StringCollection = string | string[] | ReadonlyArray<string> | Set<string> | ReadonlySet<string>;
125
-
126
- /** ----------------------------------------------------------
127
- * * ***Utility: `slugify`.***
128
- * ----------------------------------------------------------
129
- * **Slugifies a string (or array of strings) for safe use in URLs, with optionally leaving specific words unchanged.**
130
- * - **Behavior:**
131
- * - Accepts a `string` or an `array of strings`:
132
- * - If an array is provided, elements are trimmed, empty ones removed,
133
- * then joined with `"-"` before conversion.
134
- * - Splits the input by non-alphanumeric characters
135
- * (spaces, punctuation, symbols, hyphens, underscores, emojis, etc.).
136
- * - The first word is fully lowercase; subsequent words are capitalized.
137
- * - Words listed in `ignoreWord` remain unchanged in the output.
138
- * - `ignoreWord` is normalized (trimmed, delimiters removed), empty values ignored.
139
- * - `ignoreWord` accepts:
140
- * - a single string,
141
- * - an array of strings, or
142
- * - a `Set` of strings.
143
- * - Multiple delimiters collapse into one; empty segments ignored.
144
- * - Returns `""` if the input is `null`, `undefined`, or empty.
145
- * @param {StringLike} input - The string or array to convert. Returns `""` if empty, `null`, or `undefined`.
146
- * @param {StringCollection} [ignoreWord] - Optional word(s) to leave unchanged in the output.
147
- * @returns {string} The slugified string.
148
- * @example
149
- * // Basic usage
150
- * slugify("Hello World!");
151
- * // ➔ "hello-world"
152
- *
153
- * // Array input is joined before conversion
154
- * slugify(["Join", "Words", "Here"]);
155
- * // ➔ "join-words-here"
156
- *
157
- * // Trims and cleans input
158
- * slugify(" --- Convert to Slug? --- ");
159
- * // ➔ "convert-to-slug"
160
- *
161
- * // Ignore single word
162
- * slugify("This URL path", "URL");
163
- * // ➔ "this-URL-path"
164
- *
165
- * // Ignore multiple words
166
- * slugify("ignore API and URL", ["API", "URL"]);
167
- * // ➔ "ignore-API-and-URL"
168
- *
169
- * // Ignore using Set
170
- * slugify("ignore API and URL", new Set(["API", "URL"]));
171
- * // ➔ "ignore-API-and-URL"
172
- *
173
- * // Supports emojis and symbols
174
- * slugify("🔥 Fire_and_ice ❄️");
175
- * // ➔ "fire-and-ice"
176
- *
177
- * // Null, Undefined or empty (string or array) input returns empty string
178
- * slugify(undefined);
179
- * // ➔ ""
180
- */
181
- declare const slugify: (input: StringLike, ignoreWord?: StringCollection) => string;
182
-
183
- /** ----------------------------------------------------------
184
- * * ***Utility: `toCamelCase`.***
185
- * ----------------------------------------------------------
186
- * **Converts a string (or array of strings) into `camelCase`, with optionally leaving specific words unchanged.**
187
- * - **Behavior:**
188
- * - Accepts a `string` or an `array of strings`:
189
- * - If an array is provided, elements are trimmed, empty ones removed,
190
- * then joined with `"-"` before conversion.
191
- * - Splits the input by non-alphanumeric characters
192
- * (spaces, punctuation, symbols, hyphens, underscores, emojis, etc.).
193
- * - The first word is fully lowercase; subsequent words are capitalized.
194
- * - Words listed in `ignoreWord` remain unchanged in the output.
195
- * - `ignoreWord` is normalized (trimmed, delimiters removed), empty values ignored.
196
- * - `ignoreWord` accepts:
197
- * - a single string,
198
- * - an array of strings, or
199
- * - a `Set` of strings.
200
- * - Multiple delimiters collapse into one; empty segments ignored.
201
- * - Returns `""` if the input is `null`, `undefined`, or empty.
202
- * @param {StringLike} input - The string or array to convert. Returns `""` if empty, `null`, or `undefined`.
203
- * @param {StringCollection} [ignoreWord] - Optional word(s) to leave unchanged in the output.
204
- * @returns {string} The camelCase formatted string.
205
- * @example
206
- * // Basic usage
207
- * toCamelCase("hello world");
208
- * // ➔ "helloWorld"
209
- *
210
- * // Array input is joined before conversion
211
- * toCamelCase(["Join", "Words", "Here"]);
212
- * // ➔ "joinWordsHere"
213
- *
214
- * // Supports mixed delimiters
215
- * toCamelCase("convert_to-camel case");
216
- * // ➔ "convertToCamelCase"
217
- *
218
- * // Words in ignoreWord stay unchanged
219
- * toCamelCase("this URL path will ignore", "URL");
220
- * // ➔ "thisURLPathWillIgnore"
221
- *
222
- * // Multiple ignored words
223
- * toCamelCase("ignore API and URL", ["API", "URL"]);
224
- * // ➔ "ignoreAPIAndURL"
225
- *
226
- * // Set can also be used
227
- * toCamelCase("ignore API and URL", new Set(["API", "URL"]));
228
- * // ➔ "ignoreAPIAndURL"
229
- *
230
- * // Null, Undefined or empty (string or array) input returns empty string
231
- * toCamelCase(null);
232
- * // ➔ ""
233
- */
234
- declare const toCamelCase: (input: StringLike, ignoreWord?: StringCollection) => string;
235
-
236
- /** ----------------------------------------------------------
237
- * * ***Utility: `toDotCase`.***
238
- * ----------------------------------------------------------
239
- * **Converts a string (or array of strings) into `dot.case`, with optionally leaving specific words unchanged.**
240
- * - **Behavior:**
241
- * - Accepts a `string` or an `array of strings`:
242
- * - If an array is provided, elements are trimmed, empty ones removed,
243
- * then joined with `"-"` before conversion.
244
- * - Splits the input by non-alphanumeric characters
245
- * (spaces, punctuation, symbols, hyphens, underscores, emojis, etc.).
246
- * - The first word is fully lowercase; subsequent words are capitalized.
247
- * - Words listed in `ignoreWord` remain unchanged in the output.
248
- * - `ignoreWord` is normalized (trimmed, delimiters removed), empty values ignored.
249
- * - `ignoreWord` accepts:
250
- * - a single string,
251
- * - an array of strings, or
252
- * - a `Set` of strings.
253
- * - Multiple delimiters collapse into one; empty segments ignored.
254
- * - Returns `""` if the input is `null`, `undefined`, or empty.
255
- * @param {StringLike} input - The string or array to convert. Returns `""` if empty, `null`, or `undefined`.
256
- * @param {StringCollection} [ignoreWord] - Optional word(s) to leave unchanged in the output.
257
- * @returns {string} The dot.case formatted string.
258
- * @example
259
- * // Basic usage
260
- * toDotCase("Hello World");
261
- * // ➔ "hello.world"
262
- *
263
- * // Array input is joined before conversion
264
- * toDotCase(["Join", "Words", "Here"]);
265
- * // ➔ "join.words.here"
266
- *
267
- * // Handles underscores and hyphens
268
- * toDotCase("convert-to_dot case");
269
- * // ➔ "convert.to.dot.case"
270
- *
271
- * // Multiple delimiters and trimming
272
- * toDotCase("___Hello--World__ again!!");
273
- * // ➔ "hello.world.again"
274
- *
275
- * // Supports emojis and symbols
276
- * toDotCase("🔥Fire_and-ice❄️");
277
- * // ➔ "fire.and.ice"
278
- *
279
- * // Ignore single word
280
- * toDotCase("this URL path", "URL");
281
- * // ➔ "this.URL.path"
282
- *
283
- * // Ignore multiple words
284
- * toDotCase("ignore API and URL", ["API", "URL"]);
285
- * // ➔ "ignore.API.and.URL"
286
- *
287
- * // Ignore using Set
288
- * toDotCase("ignore API and URL", new Set(["API", "URL"]));
289
- * // ➔ "ignore.API.and.URL"
290
- *
291
- * // Null, Undefined or empty (string or array) input returns empty string
292
- * toDotCase(undefined);
293
- * // ➔ ""
294
- */
295
- declare const toDotCase: (input: StringLike, ignoreWord?: StringCollection) => string;
296
-
297
- /** ----------------------------------------------------------
298
- * * ***Utility: `toKebabCase`.***
299
- * ----------------------------------------------------------
300
- * **Converts a string (or array of strings) into `kebab-case`, with optionally leaving specific words unchanged.**
301
- * - **Behavior:**
302
- * - Accepts a `string` or an `array of strings`:
303
- * - If an array is provided, elements are trimmed, empty ones removed,
304
- * then joined with `"-"` before conversion.
305
- * - Splits the input by non-alphanumeric characters
306
- * (spaces, punctuation, symbols, hyphens, underscores, emojis, etc.).
307
- * - The first word is fully lowercase; subsequent words are capitalized.
308
- * - Words listed in `ignoreWord` remain unchanged in the output.
309
- * - `ignoreWord` is normalized (trimmed, delimiters removed), empty values ignored.
310
- * - `ignoreWord` accepts:
311
- * - a single string,
312
- * - an array of strings, or
313
- * - a `Set` of strings.
314
- * - Multiple delimiters collapse into one; empty segments ignored.
315
- * - Returns `""` if the input is `null`, `undefined`, or empty.
316
- * @param {StringLike} input - The string or array to convert. Returns `""` if empty, `null`, or `undefined`.
317
- * @param {StringCollection} [ignoreWord] - Optional word(s) to leave unchanged in the output.
318
- * @returns {string} The kebab-case formatted string.
319
- * @example
320
- * // Basic usage
321
- * toKebabCase("Hello World");
322
- * // ➔ "hello-world"
323
- *
324
- * // Array input is joined before conversion
325
- * toKebabCase(["Join", "Words", "Here"]);
326
- * // ➔ "join-words-here"
327
- *
328
- * // Handles underscores and hyphens
329
- * toKebabCase("convert_to-kebab case");
330
- * // ➔ "convert-to-kebab-case"
331
- *
332
- * // Handles emojis and symbols
333
- * toKebabCase("🔥fire___and--ice❄️");
334
- * // ➔ "fire-and-ice"
335
- *
336
- * // Ignore specific word
337
- * toKebabCase("ignore URL case", "URL");
338
- * // ➔ "ignore-URL-case"
339
- *
340
- * // Ignore multiple words
341
- * toKebabCase("ignore API and URL", ["API", "URL"]);
342
- * // ➔ "ignore-API-and-URL"
343
- *
344
- * // Ignore with Set
345
- * toKebabCase("ignore API and URL", new Set(["API", "URL"]));
346
- * // ➔ "ignore-API-and-URL"
347
- *
348
- * // Null, Undefined or empty (string or array) input returns empty string
349
- * toKebabCase(null);
350
- * // ➔ ""
351
- */
352
- declare const toKebabCase: (input: StringLike, ignoreWord?: StringCollection) => string;
353
-
354
- /** ----------------------------------------------------------
355
- * * ***Utility: `toLowerCase`.***
356
- * ----------------------------------------------------------
357
- * **Converts a string (or array of strings) into `lower case`, with optionally leaving specific words unchanged.**
358
- * - **Behavior:**
359
- * - Accepts a `string` or an `array of strings`:
360
- * - If an array is provided, elements are trimmed, empty ones removed,
361
- * then joined with `"-"` before conversion.
362
- * - Splits the input by non-alphanumeric characters
363
- * (spaces, punctuation, symbols, hyphens, underscores, emojis, etc.).
364
- * - The first word is fully lowercase; subsequent words are capitalized.
365
- * - Words listed in `ignoreWord` remain unchanged in the output.
366
- * - `ignoreWord` is normalized (trimmed, delimiters removed), empty values ignored.
367
- * - `ignoreWord` accepts:
368
- * - a single string,
369
- * - an array of strings, or
370
- * - a `Set` of strings.
371
- * - Multiple delimiters collapse into one; empty segments ignored.
372
- * - Returns `""` if the input is `null`, `undefined`, or empty.
373
- * @param {StringLike} input - The string or array to convert. Returns `""` if empty, `null`, or `undefined`.
374
- * @param {StringCollection} [ignoreWord] - Optional word(s) to leave unchanged in the output.
375
- * @returns {string} The LowerCase formatted string.
376
- * @example
377
- * // Basic usage
378
- * toLowerCase("Hello World");
379
- * // ➔ "hello world"
380
- *
381
- * // Array input is joined before conversion
382
- * toLowerCase(["Join", "WORLD", "Here"]);
383
- * // ➔ "join words here"
384
- *
385
- * // Handles underscores and hyphens
386
- * toLowerCase("convert_to-pascal case");
387
- * // ➔ "convert to lower case"
388
- *
389
- * // Trims extra delimiters
390
- * toLowerCase("___hello--world__ again!!");
391
- * // ➔ "hello world again"
392
- *
393
- * // Supports emojis and symbols
394
- * toLowerCase("🔥fire_and-ice❄️");
395
- * // ➔ "fire and ice"
396
- *
397
- * // Ignore single word
398
- * toLowerCase("this URL path will ignore", "URL");
399
- * // ➔ "this URL path will ignore"
400
- *
401
- * // Ignore multiple words
402
- * toLowerCase("ignore API and URL", ["API", "URL"]);
403
- * // ➔ "ignore API and URL"
404
- *
405
- * // Ignore using Set
406
- * toLowerCase("ignore API and URL", new Set(["API", "URL"]));
407
- * // ➔ "ignore API and URL"
408
- *
409
- * // Null, Undefined or empty (string or array) input returns empty string
410
- * toLowerCase(undefined);
411
- * // ➔ ""
412
- */
413
- declare const toLowerCase: (input: StringLike, ignoreWord?: StringCollection) => string;
414
-
415
- /** ----------------------------------------------------------
416
- * * ***Utility: `toPascalCase`.***
417
- * ----------------------------------------------------------
418
- * **Converts a string (or array of strings) into `PascalCase`, with optionally leaving specific words unchanged.**
419
- * - **Behavior:**
420
- * - Accepts a `string` or an `array of strings`:
421
- * - If an array is provided, elements are trimmed, empty ones removed,
422
- * then joined with `"-"` before conversion.
423
- * - Splits the input by non-alphanumeric characters
424
- * (spaces, punctuation, symbols, hyphens, underscores, emojis, etc.).
425
- * - The first word is fully lowercase; subsequent words are capitalized.
426
- * - Words listed in `ignoreWord` remain unchanged in the output.
427
- * - `ignoreWord` is normalized (trimmed, delimiters removed), empty values ignored.
428
- * - `ignoreWord` accepts:
429
- * - a single string,
430
- * - an array of strings, or
431
- * - a `Set` of strings.
432
- * - Multiple delimiters collapse into one; empty segments ignored.
433
- * - Returns `""` if the input is `null`, `undefined`, or empty.
434
- * @param {StringLike} input - The string or array to convert. Returns `""` if empty, `null`, or `undefined`.
435
- * @param {StringCollection} [ignoreWord] - Optional word(s) to leave unchanged in the output.
436
- * @returns {string} The PascalCase formatted string.
437
- * @example
438
- * // Basic usage
439
- * toPascalCase("hello world");
440
- * // ➔ "HelloWorld"
441
- *
442
- * // Array input is joined before conversion
443
- * toPascalCase(["Join", "Words", "Here"]);
444
- * // ➔ "JoinWordsHere"
445
- *
446
- * // Handles underscores and hyphens
447
- * toPascalCase("convert_to-pascal case");
448
- * // ➔ "ConvertToPascalCase"
449
- *
450
- * // Trims extra delimiters
451
- * toPascalCase("___hello--world__ again!!");
452
- * // ➔ "HelloWorldAgain"
453
- *
454
- * // Supports emojis and symbols
455
- * toPascalCase("🔥fire_and-ice❄️");
456
- * // ➔ "FireAndIce"
457
- *
458
- * // Ignore single word
459
- * toPascalCase("this URL path will ignore", "URL");
460
- * // ➔ "ThisURLPathWillIgnore"
461
- *
462
- * // Ignore multiple words
463
- * toPascalCase("ignore API and URL", ["API", "URL"]);
464
- * // ➔ "IgnoreAPIAndURL"
465
- *
466
- * // Ignore using Set
467
- * toPascalCase("ignore API and URL", new Set(["API", "URL"]));
468
- * // ➔ "IgnoreAPIAndURL"
469
- *
470
- * // Null, Undefined or empty (string or array) input returns empty string
471
- * toPascalCase(undefined);
472
- * // ➔ ""
473
- */
474
- declare const toPascalCase: (input: StringLike, ignoreWord?: StringCollection) => string;
475
-
476
- /** ----------------------------------------------------------
477
- * * ***Utility: `toPascalCaseSpace`.***
478
- * ----------------------------------------------------------
479
- * **Converts a string (or array of strings) into `PascalCaseSpace`, with optionally leaving specific words unchanged.**
480
- * - **Behavior:**
481
- * - Accepts a `string` or an `array of strings`:
482
- * - If an array is provided, elements are trimmed, empty ones removed,
483
- * then joined with `"-"` before conversion.
484
- * - Splits the input by non-alphanumeric characters
485
- * (spaces, punctuation, symbols, hyphens, underscores, emojis, etc.).
486
- * - The first word is fully lowercase; subsequent words are capitalized.
487
- * - Words listed in `ignoreWord` remain unchanged in the output.
488
- * - `ignoreWord` is normalized (trimmed, delimiters removed), empty values ignored.
489
- * - `ignoreWord` accepts:
490
- * - a single string,
491
- * - an array of strings, or
492
- * - a `Set` of strings.
493
- * - Multiple delimiters collapse into one; empty segments ignored.
494
- * - Returns `""` if the input is `null`, `undefined`, or empty.
495
- * @param {StringLike} input - The string or array to convert. Returns `""` if empty, `null`, or `undefined`.
496
- * @param {StringCollection} [ignoreWord] - Optional word(s) to leave unchanged in the output.
497
- * @returns {string} The PascalCaseSpace formatted string.
498
- * @example
499
- * // Basic usage
500
- * toPascalCaseSpace("hello world");
501
- * // ➔ "Hello World"
502
- *
503
- * // Array input is joined before conversion
504
- * toPascalCaseSpace(["Join", "Words", "Here"]);
505
- * // ➔ "Join Words Here"
506
- *
507
- * // Handles underscores and hyphens
508
- * toPascalCaseSpace("convert_to-pascal case");
509
- * // ➔ "Convert To Pascal Case Space"
510
- *
511
- * // Trims extra delimiters
512
- * toPascalCaseSpace("___hello--world__ again!!");
513
- * // ➔ "Hello World Again"
514
- *
515
- * // Supports emojis and symbols
516
- * toPascalCaseSpace("🔥fire_and-ice❄️");
517
- * // ➔ "Fire And Ice"
518
- *
519
- * // Ignore single word
520
- * toPascalCaseSpace("this URL path will ignore", "URL");
521
- * // ➔ "This URL Path Will Ignore"
522
- *
523
- * // Ignore multiple words
524
- * toPascalCaseSpace("ignore API and URL", ["API", "URL"]);
525
- * // ➔ "Ignore API And URL"
526
- *
527
- * // Ignore using Set
528
- * toPascalCaseSpace("ignore API and URL", new Set(["API", "URL"]));
529
- * // ➔ "Ignore API And URL"
530
- *
531
- * // Null, Undefined or empty (string or array) input returns empty string
532
- * toPascalCaseSpace(undefined);
533
- * // ➔ ""
534
- */
535
- declare const toPascalCaseSpace: (input: StringLike, ignoreWord?: StringCollection) => string;
536
-
537
- /** ----------------------------------------------------------
538
- * * ***Utility: `toSnakeCase`.***
539
- * ----------------------------------------------------------
540
- * **Converts a string (or array of strings) into `snake_case`, with optionally leaving specific words unchanged.**
541
- * - **Behavior:**
542
- * - Accepts a `string` or an `array of strings`:
543
- * - If an array is provided, elements are trimmed, empty ones removed,
544
- * then joined with `"-"` before conversion.
545
- * - Splits the input by non-alphanumeric characters
546
- * (spaces, punctuation, symbols, hyphens, underscores, emojis, etc.).
547
- * - The first word is fully lowercase; subsequent words are capitalized.
548
- * - Words listed in `ignoreWord` remain unchanged in the output.
549
- * - `ignoreWord` is normalized (trimmed, delimiters removed), empty values ignored.
550
- * - `ignoreWord` accepts:
551
- * - a single string,
552
- * - an array of strings, or
553
- * - a `Set` of strings.
554
- * - Multiple delimiters collapse into one; empty segments ignored.
555
- * - Returns `""` if the input is `null`, `undefined`, or empty.
556
- * @param {StringLike} input - The string or array to convert. Returns `""` if empty, `null`, or `undefined`.
557
- * @param {StringCollection} [ignoreWord] - Optional word(s) to leave unchanged in the output.
558
- * @returns {string} The snake_case formatted string.
559
- * @example
560
- * // Basic usage
561
- * toSnakeCase("Hello World");
562
- * // ➔ "hello_world"
563
- *
564
- * // Array input is joined before conversion
565
- * toSnakeCase(["Join", "Words", "Here"]);
566
- * // ➔ "join_words_here"
567
- *
568
- * // Handles underscores, hyphens, spaces
569
- * toSnakeCase("convert-to_snake case");
570
- * // ➔ "convert_to_snake_case"
571
- *
572
- * // Handles emojis and symbols
573
- * toSnakeCase("🔥fire___and--ice❄️");
574
- * // ➔ "fire_and_ice"
575
- *
576
- * // Ignore specific word
577
- * toSnakeCase("ignore URL case", "URL");
578
- * // ➔ "ignore_URL_case"
579
- *
580
- * // Ignore multiple words
581
- * toSnakeCase("ignore API and URL", ["API", "URL"]);
582
- * // ➔ "ignore_API_and_URL"
583
- *
584
- * // Ignore with Set
585
- * toSnakeCase("ignore API and URL", new Set(["API", "URL"]));
586
- * // ➔ "ignore_API_and_URL"
587
- *
588
- * // Null, Undefined or empty (string or array) input returns empty string
589
- * toSnakeCase(null);
590
- * // ➔ ""
591
- */
592
- declare const toSnakeCase: (input: StringLike, ignoreWord?: StringCollection) => string;
593
-
594
- type NormalizeSpacesOptions = {
595
- /** If `true`, skips normalization and only trims whitespace from start & end, defaultValue: `false`.
596
- *
597
- * @default false
598
- */
599
- trimOnly?: boolean;
600
- /** If `false`, skips trimming value, defaultValue: `true`.
601
- *
602
- * @default true
603
- */
604
- withTrim?: boolean;
605
- };
606
- /** ----------------------------------------------------------
607
- * * ***Utility: `normalizeSpaces`.***
608
- * ----------------------------------------------------------
609
- * **Normalizes whitespace in a string by reducing multiple spaces
610
- * to a single space, optionally trims, or only trims based on options.**
611
- * - **Behavior:**
612
- * - Collapses all consecutive whitespace (spaces, tabs, newlines) into a single space.
613
- * - Can trim leading/trailing spaces (default behavior), or preserve them with `withTrim: false`.
614
- * - Can skip normalization entirely and only trim using `trimOnly: true`.
615
- * - Returns an empty string if input is `null` or `undefined`.
616
- * @param {string | null | undefined} value - The input string to be processed. If `null` or `undefined`, returns an empty string.
617
- * @param {NormalizeSpacesOptions} [options] - Configuration options.
618
- * @param {NormalizeSpacesOptions["trimOnly"]} [options.trimOnly=false] - If `true`, skips normalization and only trims the string.
619
- * @param {NormalizeSpacesOptions["withTrim"]} [options.withTrim=true] - If `false`, preserves leading/trailing whitespace.
620
- * @returns {string} The processed string.
621
- * @example
622
- * normalizeSpaces(" Hello World\tthis is\n\nok ");
623
- * // ➔ "Hello World this is ok"
624
- * normalizeSpaces(" Hello World\tthis is\n\nok ", { trimOnly: true });
625
- * // ➔ "Hello World this is\n\nok"
626
- * normalizeSpaces(" Hello World ", { withTrim: false });
627
- * // ➔ " Hello World "
628
- * normalizeSpaces(null);
629
- * // ➔ ""
630
- */
631
- declare const normalizeSpaces: (value: string | null | undefined, options?: NormalizeSpacesOptions) => string;
632
-
633
- /** ----------------------------------------------------------
634
- * * ***Utility: `normalizeString`.***
635
- * ----------------------------------------------------------
636
- * **Normalizes a string by ensuring it is a valid string and trimming whitespace.**
637
- * - **Behavior:**
638
- * - If the input is `undefined`, `null`, or an `empty string` after trimming,
639
- * it returns an empty string `("")`.
640
- * @param {string | undefined | null} input - The input string to be normalize. If `null` or `undefined`, returns an empty string.
641
- * @returns {string} A trimmed string or an empty string if the input is invalid.
642
- * @example
643
- * normalizeString(" Hello World ");
644
- * // ➔ "Hello World"
645
- * normalizeString(" Hello World ");
646
- * // ➔ "Hello World"
647
- * normalizeString("");
648
- * // ➔ ""
649
- * normalizeString(null);
650
- * // ➔ ""
651
- * normalizeString(undefined);
652
- * // ➔ ""
653
- */
654
- declare const normalizeString: (input: string | null | undefined) => string;
655
-
656
- type RemoveSpacesOptions = {
657
- /** If `true`, only trims the string, defaultValue: `false`.
658
- *
659
- * @default false */
660
- trimOnly?: boolean;
661
- };
662
- /** ----------------------------------------------------------
663
- * * ***Utility: `removeSpaces`.***
664
- * ----------------------------------------------------------
665
- * **Removes all spaces from a string or trims only, based on the options provided.**
666
- * - **Behavior:**
667
- * - If `trimOnly` is `true`, the string is simply trimmed.
668
- * - Otherwise, removes **all spaces**, tabs, newlines, etc.
669
- * - If the input is `null` or `undefined`, returns an empty string `("")`.
670
- * @param {string | null | undefined} value - The input string to be processed. If `null` or `undefined`, returns an empty string.
671
- * @param {RemoveSpacesOptions} [options] - The options object.
672
- * @param {RemoveSpacesOptions["trimOnly"]} [options.trimOnly=false] - If `true`, only trims the string without removing spaces inside.
673
- * @returns {string} The processed string.
674
- * @example
675
- * removeSpaces(" Hello World ");
676
- * // ➔ "HelloWorld"
677
- * removeSpaces(" Hello World ", { trimOnly: true });
678
- * // ➔ "Hello World"
679
- * removeSpaces(null);
680
- * // ➔ ""
681
- */
682
- declare const removeSpaces: (value: string | null | undefined, options?: RemoveSpacesOptions) => string;
683
-
684
- /** ----------------------------------------------------------
685
- * * ***Utility: `stripHtmlTags`.***
686
- * ----------------------------------------------------------
687
- * **This function removes valid HTML tags (including nested and self-closing ones)
688
- * by replacing them with spaces, then collapses multiple whitespaces into a single space.**
689
- * - **It handles the following cases:**
690
- * - If the input is not a string (`null`, `undefined`, or any non-string), it is returned as undefined.
691
- * - If the input is an empty or whitespace-only string, it returns an empty string (`""`).
692
- * - Otherwise, it returns the cleaned string with tags removed and normalized whitespace.
693
- * @template T - Input string type (string | null | undefined).
694
- * @param {string | null | undefined} input - A string potentially containing HTML tags.
695
- * @returns {string | undefined} Cleaned string if input is string, or original input otherwise.
696
- * @example
697
- * stripHtmlTags("<p>Hello</p>");
698
- * // ➔ "Hello"
699
- * stripHtmlTags("<div><b>Bold</b> text</div>");
700
- * // ➔ "Bold text"
701
- * stripHtmlTags("Line<br/>Break");
702
- * // ➔ "Line Break"
703
- * stripHtmlTags("2 < 5 and 5 > 2");
704
- * // ➔ "2 < 5 and 5 > 2"
705
- * stripHtmlTags("");
706
- * // ➔ ""
707
- * stripHtmlTags(" ");
708
- * // ➔ ""
709
- * stripHtmlTags(null);
710
- * // ➔ undefined
711
- * stripHtmlTags(undefined);
712
- * // ➔ undefined
713
- */
714
- declare function stripHtmlTags(input: string): string;
715
- declare function stripHtmlTags<T>(input: T): Extends<string, T> extends true ? string | undefined : undefined;
716
-
717
- /** ----------------------------------------------------------
718
- * * ***Utility: `getInitialsName`.***
719
- * ----------------------------------------------------------
720
- * **Extracts initials from the given name string.**
721
- * - **Behavior:**
722
- * - For names with two or more words, returns the first letter of the first and second words.
723
- * - For a single word with 2+ characters, returns the first two letters.
724
- * - For a single character, returns that character.
725
- * - For `empty`, `null`, `undefined` or `whitespace-only input`, returns an empty string (`""`).
726
- * @param {string | null | undefined} name - The name to extract initials from.
727
- * @returns {string} The extracted initials (e.g., "JD" for "John Doe").
728
- * @example
729
- * getInitialsName("Alice"); // ➔ "AL"
730
- * getInitialsName("John Doe"); // ➔ "JD"
731
- * getInitialsName(" Bob Marley "); // ➔ "BM"
732
- * getInitialsName("John Ronald Donal"); // ➔ "JR"
733
- * getInitialsName("Lord John Doe Moe"); // ➔ "LJ"
734
- * getInitialsName("X"); // ➔ "X"
735
- * getInitialsName(""); // ➔ "" (empty string)
736
- * getInitialsName(" "); // ➔ "" (empty string)
737
- * getInitialsName(null); // ➔ "" (null input)
738
- * getInitialsName(undefined); // ➔ "" (undefined input)
739
- */
740
- declare const getInitialsName: (name: string | null | undefined) => string;
741
-
742
- /** ----------------------------------------------------------
743
- * * ***Utility: `replaceAt`.***
744
- * ----------------------------------------------------------
745
- * **Replaces exactly one character at the specified index in the original string
746
- * with the provided `replaceTo` string.**
747
- * - **Behavior:**
748
- * - If `replaceTo` has more than one character,
749
- * the result will expand accordingly.
750
- * @param {number} index - The starting index where the replacement should occur.
751
- * @param {string} originalString - The original string to modify.
752
- * @param {string} replaceTo - The string to insert at the specified index.
753
- * @returns {string} The modified string with the replacement applied.
754
- * @example
755
- * replaceAt(3, "hello", "X");
756
- * // ➔ "helXo"
757
- * replaceAt(1, "world", "AB");
758
- * // ➔ "wABrld"
759
- * replaceAt(0, "cat", "br");
760
- * // ➔ "brat"
761
- * replaceAt(2, "12345", "-");
762
- * // ➔ "12-45"
763
- * replaceAt(4, "ABCDE", "Z");
764
- * // ➔ "ABCDZ"
765
- * // ❌ Examples that throw:
766
- * replaceAt(10, "short", "X");
767
- * // ➔ ❌ RangeError: First parameter (`index`) is out of range from second parameter `originalString`.
768
- * replaceAt(-1, "test", "X");
769
- * // ➔ ❌ RangeError: First parameter (`index`) is out of range from second parameter `originalString`.
770
- * replaceAt("1", "test", "X");
771
- * // ➔ ❌ 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`,...]."
772
- * replaceAt(2, null, "X");
773
- * // ➔ ❌ 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`,...]."
774
- */
775
- declare const replaceAt: (index: number, originalString: string, replaceTo: string) => string;
776
-
2
+ * ========================================================================
3
+ * @rzl-zone/utils-js
4
+ * ------------------------------------------------------------------------
5
+ * Version: `3.12.1-beta.0`
6
+ * Author: `Rizalvin Dwiky <rizalvindwiky@gmail.com>`
7
+ * Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/utils-js`
8
+ * ========================================================================
9
+ */
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-26W7ItWx.js";
777
12
  export { capitalizeFirst, capitalizeWords, getInitialsName, normalizeSpaces, normalizeString, removeSpaces, replaceAt, slugify, stripHtmlTags, toCamelCase, toDotCase, toKebabCase, toLowerCase, toPascalCase, toPascalCaseSpace, toSnakeCase };