@rzl-zone/utils-js 3.12.0 → 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 -214
  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 -212
  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-2AFQ33D3.cjs +0 -64
  213. package/dist/chunk-2CYDJVGM.js +0 -246
  214. package/dist/chunk-2MW4JDQ2.cjs +0 -598
  215. package/dist/chunk-2VTDXC3N.cjs +0 -1825
  216. package/dist/chunk-44XX2P34.js +0 -209
  217. package/dist/chunk-4YLBKLGS.cjs +0 -18
  218. package/dist/chunk-566CXQW7.cjs +0 -560
  219. package/dist/chunk-57EPKYID.cjs +0 -397
  220. package/dist/chunk-5MGEC3YG.js +0 -63
  221. package/dist/chunk-6EF52423.cjs +0 -249
  222. package/dist/chunk-6SCOKU3S.js +0 -109
  223. package/dist/chunk-6VUXD3CF.js +0 -119
  224. package/dist/chunk-7B76BSNK.cjs +0 -118
  225. package/dist/chunk-7Y6I2DSU.cjs +0 -101
  226. package/dist/chunk-A7S7E2EE.cjs +0 -308
  227. package/dist/chunk-AJZ6PMMZ.js +0 -16
  228. package/dist/chunk-AXGBL2IO.cjs +0 -251
  229. package/dist/chunk-B4TC6FBV.cjs +0 -678
  230. package/dist/chunk-BAV5T2E3.cjs +0 -15
  231. package/dist/chunk-BKIJBNIE.js +0 -21
  232. package/dist/chunk-BNIMTFK5.js +0 -59
  233. package/dist/chunk-BXW7YXB7.js +0 -1823
  234. package/dist/chunk-CFYZC4S6.js +0 -53
  235. package/dist/chunk-CSG4SCL3.js +0 -1587
  236. package/dist/chunk-CWQW7AKK.js +0 -676
  237. package/dist/chunk-DVMHRLKP.cjs +0 -16
  238. package/dist/chunk-EN7LVZBZ.js +0 -548
  239. package/dist/chunk-EV4Y7HCY.cjs +0 -26
  240. package/dist/chunk-F66VDYIZ.cjs +0 -18
  241. package/dist/chunk-FLJX37EL.cjs +0 -30
  242. package/dist/chunk-GKC3UDMC.cjs +0 -1623
  243. package/dist/chunk-H65I3GRZ.cjs +0 -106
  244. package/dist/chunk-HHYWB7VZ.js +0 -24
  245. package/dist/chunk-HNGGISFL.cjs +0 -65
  246. package/dist/chunk-HNSQAVSZ.cjs +0 -35
  247. package/dist/chunk-HSP6IWZK.js +0 -17
  248. package/dist/chunk-IDZS7J6T.js +0 -242
  249. package/dist/chunk-JS6R55VL.js +0 -302
  250. package/dist/chunk-JZVT5FK7.js +0 -232
  251. package/dist/chunk-KHO2SBNA.cjs +0 -16
  252. package/dist/chunk-KIDJCMNJ.js +0 -33
  253. package/dist/chunk-KOLEURVT.cjs +0 -38
  254. package/dist/chunk-L4V53MQK.cjs +0 -269
  255. package/dist/chunk-L5RDAVVH.js +0 -14
  256. package/dist/chunk-NODTV4F3.js +0 -16
  257. package/dist/chunk-NYK5K3V2.cjs +0 -211
  258. package/dist/chunk-ODUO3RTL.cjs +0 -113
  259. package/dist/chunk-ONZFBJVW.js +0 -14
  260. package/dist/chunk-PFXCTE37.js +0 -28
  261. package/dist/chunk-PPST7QAQ.js +0 -587
  262. package/dist/chunk-Q5IMYDFL.cjs +0 -33
  263. package/dist/chunk-QFFBIOJ4.js +0 -31
  264. package/dist/chunk-QNKGP5DY.js +0 -14
  265. package/dist/chunk-RRQHMOPE.cjs +0 -19
  266. package/dist/chunk-RU5OSRBU.js +0 -95
  267. package/dist/chunk-SDMPEJ4F.js +0 -35
  268. package/dist/chunk-SYNL5IKP.js +0 -115
  269. package/dist/chunk-TCDOWZQE.js +0 -16
  270. package/dist/chunk-TQPGXGKB.cjs +0 -123
  271. package/dist/chunk-TULOI4GL.js +0 -370
  272. package/dist/chunk-UBHCP4N5.cjs +0 -36
  273. package/dist/chunk-UCHF3M34.cjs +0 -56
  274. package/dist/chunk-UDA26MCU.cjs +0 -16
  275. package/dist/chunk-V3C4FYZL.cjs +0 -18
  276. package/dist/chunk-VAAHZFBF.js +0 -32
  277. package/dist/chunk-VJDDGRIK.cjs +0 -16
  278. package/dist/chunk-WVSPXFTY.js +0 -14
  279. package/dist/chunk-WYP76WXB.js +0 -101
  280. package/dist/chunk-YDE4ZBB7.cjs +0 -237
  281. package/dist/chunk-YKQEOO7C.cjs +0 -23
  282. package/dist/chunk-YSZC56SZ.js +0 -264
  283. package/dist/chunk-YWHHVDT4.js +0 -13
  284. package/dist/index.d.ts +0 -24
  285. package/dist/isPlainObject-DTJVV2Kf.d.ts +0 -536
  286. package/dist/rzl-utils.global.js +0 -10
@@ -0,0 +1,2139 @@
1
+ /*!
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 { AnyString, ExtractStrict, OmitStrict, OverrideTypes, Prettify } from "@rzl-zone/ts-types-plus";
12
+ import { CountryCode, NumberFormat } from "libphonenumber-js";
13
+ import { FormatOptions, Locale } from "date-fns";
14
+ type NegativeFormatOptionCustom = {
15
+ /** Custom formatter function for the final formatted negative string.
16
+ * If provided, it ***OVERRIDES*** style & space entirely. */
17
+ custom: (formatted: string) => string;
18
+ style?: never;
19
+ space?: never;
20
+ };
21
+ type NegativeFormatOptionUnCustom = {
22
+ custom?: never;
23
+ /** Use style & optional spacing for negative numbers.
24
+ *
25
+ * @default "dash"
26
+ */
27
+ style?: "dash" | "brackets" | "abs";
28
+ /** Whether to include space inside brackets or after dash.
29
+ *
30
+ * Default: false
31
+ * @default false
32
+ */
33
+ space?: boolean;
34
+ };
35
+ /** ---------------------------------------------------------------------------
36
+ * * ***Type for negative number formatting options.***
37
+ * ---------------------------------------------------------------------------
38
+ */
39
+ type NegativeFormatOption = "dash" | "brackets" | "abs" | NegativeFormatOptionCustom | NegativeFormatOptionUnCustom;
40
+ /** ---------------------------------------------------------------------------
41
+ * * ***Type Options for {@link formatCurrency|`formatCurrency`}.***
42
+ * ---------------------------------------------------------------------------
43
+ */
44
+ type FormatCurrencyOptions = {
45
+ /** ---------------------------------------------------------------------------
46
+ * * ***Prefix currency string.***
47
+ * ---------------------------------------------------------------------------
48
+ * **Does not auto-keep input symbols.**
49
+ * - ***DefaultValue:** `""`.*
50
+ * - **Example:** `"Rp "` ➔ `Rp 1.000`.
51
+ *
52
+ * @default ""
53
+ */
54
+ suffixCurrency?: string;
55
+ /** ---------------------------------------------------------------------------
56
+ * * ***Thousands separator.***
57
+ * ---------------------------------------------------------------------------
58
+ * - ***DefaultValue:** `"."`.*
59
+ * - **Example:** `"."` ➔ `1.000.000`.
60
+ * @default "."
61
+ */
62
+ separator?: string;
63
+ /** ---------------------------------------------------------------------------
64
+ * * ***Prefix currency string.***
65
+ * ---------------------------------------------------------------------------
66
+ * **Whether to show decimals, if `false`, decimals are truncated.**
67
+ * - ***DefaultValue:** `false`.*
68
+ * @default false
69
+ */
70
+ decimal?: boolean;
71
+ /** ---------------------------------------------------------------------------
72
+ * * ***Total decimal digits.***
73
+ * ---------------------------------------------------------------------------
74
+ * **If `decimal: true` & `roundedDecimal: false`, simply cuts.**
75
+ * - ***DefaultValue:** `2`.*
76
+ * @default 2
77
+ */
78
+ totalDecimal?: number;
79
+ /** ---------------------------------------------------------------------------
80
+ * * ***Actually append `suffixDecimal`.***
81
+ * ---------------------------------------------------------------------------
82
+ * - ***DefaultValue:** `true`.*
83
+ * @default true
84
+ */
85
+ endDecimal?: boolean;
86
+ /** ---------------------------------------------------------------------------
87
+ * * ***Text appended after decimals.***
88
+ * ---------------------------------------------------------------------------
89
+ * - ***DefaultValue:** `""`.*
90
+ * - **Example:**
91
+ * - `".-"` ➔ `1.000,00.-`.
92
+ * - `" USD"` ➔ `1.000,00 USD`.
93
+ * @default ""
94
+ */
95
+ suffixDecimal?: string;
96
+ /** ---------------------------------------------------------------------------
97
+ * * ***Rounding mode for decimals.***
98
+ * ---------------------------------------------------------------------------
99
+ * - **Behavior:**
100
+ * - `"round"` ➔ nearest.
101
+ * - `"ceil"` ➔ always up.
102
+ * - `"floor"` ➔ always down.
103
+ * - `false` ➔ truncate.
104
+ * - ***DefaultValue:** `"round"`.*
105
+ * @default "round"
106
+ */
107
+ roundedDecimal?: "round" | "ceil" | "floor" | false;
108
+ /** ---------------------------------------------------------------------------
109
+ * * ***Decimal separator.***
110
+ * ---------------------------------------------------------------------------
111
+ * - ***DefaultValue:** `","`.*
112
+ * - **Example:** `","` ➔ `1.000,10`.
113
+ * @default ","
114
+ */
115
+ separatorDecimals?: string;
116
+ /** ---------------------------------------------------------------------------
117
+ * * ***Negative formatting option.***
118
+ * ---------------------------------------------------------------------------
119
+ * **Can be string ("dash" | "brackets" | "abs") or object with custom formatter.**
120
+ * - **Behavior:**
121
+ * - `"dash"` ➔ `-15.000`.
122
+ * - `"brackets"` ➔ `(15.000)`.
123
+ * - `"abs"` ➔ `15.000` (always positive).
124
+ * - Or object:
125
+ * `{
126
+ * style: "dash"|"brackets"|"abs",
127
+ * space: true|false,
128
+ * custom: (formatted) => string
129
+ * }`.
130
+ * - ***DefaultValue:** `"dash"`.*
131
+ *
132
+ * @default "dash"
133
+ */
134
+ negativeFormat?: NegativeFormatOption;
135
+ /** ---------------------------------------------------------------------------
136
+ * * ***Applies Indian Format.***
137
+ * ---------------------------------------------------------------------------
138
+ * - **Behavior:**
139
+ * - If `true`, formats as Indian: `12,34,567`.
140
+ * - Also forces `separator: ","`, `separatorDecimals: "."`.
141
+ * - ***DefaultValue:** `false`.*
142
+ * @default false
143
+ */
144
+ indianFormat?: boolean;
145
+ };
146
+ /** -------------------------------------------------------
147
+ * * ***Utility: `formatCurrency`.***
148
+ * -------------------------------------------------------
149
+ * **Formats a number or messy currency string into a
150
+ * beautifully formatted currency string, with highly
151
+ * customizable separators, decimal control, rounding,
152
+ * currency symbols, and negative styling.**
153
+ * - **✅ Highlights:**
154
+ * - ***Accepts:***
155
+ * - Pure numbers: `15300.95`.
156
+ * - Messy currency strings from **any locale**:
157
+ * - `"Rp 15.000,21"` ***(Indonesian / Euro)***.
158
+ * - `"$12,345.60"` ***(US)***.
159
+ * - `"CHF 12'345.60"` ***(Swiss)***.
160
+ * - `"1,23,456.78"` ***(Indian)***.
161
+ * - Auto extracts numeric value with smart multi-locale parsing
162
+ * via ***`parseCurrencyString` utility function***.
163
+ * - Strong type checks & clear errors for misconfigured options.
164
+ * - **Handles:**
165
+ * - Thousands separators: `.`, `,`, `'`, ` `.
166
+ * - Decimal separators: `,`, `.`.
167
+ * - Decimal suffix (eg. `".-"`, `" USD"`).
168
+ * - Currency prefix (eg. `"Rp "`, `"$ "`).
169
+ * - Rounding: `"round"`, `"ceil"`, `"floor"`, or truncate.
170
+ * - Negative styling: dash `-`, brackets `( )`, absolute, or custom.
171
+ * - **✅ How input is parsed:**
172
+ * - Removes all non-digit except `.`, `,`, `'` and spaces.
173
+ * - Detects bracket negatives: `"(15.000,10)"` ➔ `-15000.10`.
174
+ * - Uses last `,` or `.` as decimal separator (others are thousands).
175
+ * - Ignores currency symbols like `Rp`, `$` (must re-apply with `suffixCurrency`).
176
+ * - **ℹ️ Note:**
177
+ * - Always re-apply symbols via `suffixCurrency`.
178
+ * - `parseCurrencyString` smartly detects last decimal,
179
+ * so `"1.121.234,56"` and `"1,121,234.56"` both parsed correctly.
180
+ * @param {string|number} value
181
+ * ***The input value to format, examples:***
182
+ * - `"Rp 15.000,21"`.
183
+ * - `"$12,345.60"`.
184
+ * - `"CHF 12'345.60"`.
185
+ * - `15300.95`.
186
+ * @param {FormatCurrencyOptions} [options] ***Optional configuration object.***
187
+ * @param {FormatCurrencyOptions["separator"]} [options.separator]
188
+ * ***Thousands separator:***
189
+ * - `{ separator: "." }` ➔ `1.000.000`.
190
+ * - *DefaultValue: `"."`.*
191
+ * @param {FormatCurrencyOptions["separatorDecimals"]} [options.separatorDecimals]
192
+ * ***Decimal separator:***
193
+ * - `{ separatorDecimals: "," }` ➔ `1.000,10`.
194
+ * - *DefaultValue: `","`.*
195
+ * @param {FormatCurrencyOptions["suffixCurrency"]} [options.suffixCurrency]
196
+ * ***Prefix currency string:***
197
+ * - Does **not auto-keep input symbols**.
198
+ * - Must set manually e.g: `{ suffixCurrency: "Rp " }`.
199
+ * - `{ suffixCurrency: "Rp " }` ➔ `Rp 1.000`.
200
+ * - *DefaultValue: `""`.*
201
+ * @param {FormatCurrencyOptions["decimal"]} [options.decimal]
202
+ * ***Whether to show decimals. If `false`, decimals are truncated:***
203
+ * - If `false`, cut the decimal.
204
+ * - *DefaultValue: `false`.*
205
+ * @param {FormatCurrencyOptions["totalDecimal"]} [options.totalDecimal]
206
+ * ***Total decimal digits:***
207
+ * - If `decimal: true` & `roundedDecimal: false`, simply cuts.
208
+ * - *DefaultValue: `2`.*
209
+ * @param {FormatCurrencyOptions["separatorDecimals"]} [options.suffixDecimal]
210
+ * ***Text appended after decimals:***
211
+ * - E.g: (`".-"`, `" USD"`).
212
+ * - Example 1: `".-"` ➔ `1.000,00.-`.
213
+ * - Example 2: `" USD"` ➔ `1.000,00 USD`.
214
+ * - *DefaultValue: `""`.*
215
+ * @param {FormatCurrencyOptions["endDecimal"]} [options.endDecimal]
216
+ * ***Actually append `suffixDecimal`:***
217
+ * - *DefaultValue: `true`.*
218
+ * @param {FormatCurrencyOptions["roundedDecimal"]} [options.roundedDecimal]
219
+ * ***Rounding mode:***
220
+ * - `"round"` ➔ nearest.
221
+ * - `"ceil"` ➔ always up.
222
+ * - `"floor"` ➔ always down.
223
+ * - `false` ➔ truncate.
224
+ * - *DefaultValue: `"round"`.*
225
+ * @param {FormatCurrencyOptions["negativeFormat"]} [options.negativeFormat]
226
+ * ***How to format negatives:***
227
+ * - `"dash"` ➔ `-15.000`.
228
+ * - `"brackets"` ➔ `(15.000)`.
229
+ * - `"abs"` ➔ `15.000` (always positive).
230
+ * - Or object: `{ style: "dash" | "brackets" | "abs", space: true | false, custom: (formatted) => string }`.
231
+ * - *DefaultValue: `"dash"`.*
232
+ * @param {FormatCurrencyOptions["indianFormat"]} [options.indianFormat]
233
+ * ***Applies Indian Format:***
234
+ * - If `true`, formats as Indian: `12,34,567`.
235
+ * - Also forces `separator: ","`, `separatorDecimals: "."`.
236
+ * @returns {string}
237
+ * ***Nicely formatted currency string, examples:***
238
+ * - `"15.000,10"`.
239
+ * - `"Rp 15.000,10.-"`.
240
+ * - `"15'000.10 USD"`.
241
+ * - `"12,34,567.89"`.
242
+ * @throws **{@link TypeError | `TypeError`}** ***If:***
243
+ * - The `value` is not string or number.
244
+ * - Cannot parse to valid number.
245
+ * - Options have invalid types.
246
+ * @example
247
+ * // --- Number input (default, decimals off) ---
248
+ * formatCurrency(1234567.89);
249
+ * // ➔ "1.234.567"
250
+ *
251
+ * // --- Decimals enabled ---
252
+ * formatCurrency(1234567.89, { decimal: true });
253
+ * // ➔ "1.234.567,89"
254
+ *
255
+ * // --- Indian format ---
256
+ * formatCurrency(1234567.89, { decimal: true, indianFormat: true });
257
+ * // ➔ "12,34,567.89"
258
+ *
259
+ * // --- String input (Indonesian style) ---
260
+ * formatCurrency("Rp 15.000,21", { decimal: true });
261
+ * // ➔ "15.000,21"
262
+ *
263
+ * // --- String input (US style) ---
264
+ * formatCurrency("$12,345.60", { decimal: true });
265
+ * // ➔ "12.345,60"
266
+ *
267
+ * // --- String input (Swiss style) ---
268
+ * formatCurrency("CHF 12'345.60", { decimal: true });
269
+ * // ➔ "12'345,60"
270
+ *
271
+ * // --- String input (Indian style) ---
272
+ * formatCurrency("1,23,456.78", { decimal: true, indianFormat: true });
273
+ * // ➔ "12,34,567.78"
274
+ *
275
+ * // --- Negative numbers (dash) ---
276
+ * formatCurrency(-1234.56, { decimal: true });
277
+ * // ➔ "-1.234,56"
278
+ *
279
+ * // --- Negative numbers (brackets) ---
280
+ * formatCurrency(-1234.56, {
281
+ * decimal: true,
282
+ * negativeFormat: "brackets"
283
+ * });
284
+ * // ➔ "(1.234,56)"
285
+ *
286
+ * // --- Negative numbers (custom object style) ---
287
+ * formatCurrency(-1234.56, {
288
+ * decimal: true,
289
+ * negativeFormat: { style: "brackets", space: true }
290
+ * });
291
+ * // ➔ "( 1.234,56 )"
292
+ *
293
+ * // --- Negative numbers (custom function) ---
294
+ * formatCurrency(-1234.56, {
295
+ * decimal: true,
296
+ * negativeFormat: { custom: (val) => `NEGATIVE[${val}]` }
297
+ * });
298
+ * // ➔ "NEGATIVE[1.234,56]"
299
+ *
300
+ * // --- With prefix currency ---
301
+ * formatCurrency(1234.56, {
302
+ * decimal: true,
303
+ * suffixCurrency: "Rp "
304
+ * });
305
+ * // ➔ "Rp 1.234,56"
306
+ *
307
+ * // --- With suffix decimal ---
308
+ * formatCurrency(1234.56, {
309
+ * decimal: true,
310
+ * suffixDecimal: ".-"
311
+ * });
312
+ * // ➔ "1.234,56.-"
313
+ *
314
+ * // --- With suffix currency + suffix decimal ---
315
+ * formatCurrency(1234.56, {
316
+ * decimal: true,
317
+ * suffixCurrency: "Rp ",
318
+ * suffixDecimal: ".-"
319
+ * });
320
+ * // ➔ "Rp 1.234,56.-"
321
+ *
322
+ * // --- Custom separators ---
323
+ * formatCurrency(1234567.89, {
324
+ * decimal: true,
325
+ * separator: "'",
326
+ * separatorDecimals: "."
327
+ * });
328
+ * // ➔ "1'234'567.89"
329
+ *
330
+ * // --- Rounding: ceil ---
331
+ * formatCurrency(1234.561, {
332
+ * decimal: true,
333
+ * roundedDecimal: "ceil"
334
+ * });
335
+ * // ➔ "1.234,57"
336
+ *
337
+ * // --- Rounding: floor ---
338
+ * formatCurrency(1234.569, {
339
+ * decimal: true,
340
+ * roundedDecimal: "floor"
341
+ * });
342
+ * // ➔ "1.234,56"
343
+ *
344
+ * // --- Rounding: truncate (false) ---
345
+ * formatCurrency(1234.569, {
346
+ * decimal: true,
347
+ * roundedDecimal: false
348
+ * });
349
+ * // ➔ "1.234,56"
350
+ *
351
+ * // --- Force no decimals (decimal: false) ---
352
+ * formatCurrency(1234.567, { decimal: false });
353
+ * // ➔ "1.235"
354
+ *
355
+ * // --- Edge case: messy input with dots & commas ---
356
+ * formatCurrency("1.121.234,561", {
357
+ * decimal: true,
358
+ * totalDecimal: 2,
359
+ * roundedDecimal: "ceil",
360
+ * suffixCurrency: "Rp ",
361
+ * negativeFormat: { style: "brackets" }
362
+ * });
363
+ * // ➔ "(Rp 1.121.234,57)"
364
+ *
365
+ * // --- Edge case: integer string input ---
366
+ * formatCurrency("1.121.234", {
367
+ * decimal: true,
368
+ * suffixCurrency: "Rp ",
369
+ * roundedDecimal: "ceil"
370
+ * });
371
+ * // ➔ "Rp 1.121.234,00"
372
+ */
373
+ declare const formatCurrency: (value: string | number, options?: FormatCurrencyOptions) => string;
374
+ /** ----------------------------------------------------------
375
+ * * ***Utility: `formatNumber`.***
376
+ * ----------------------------------------------------------
377
+ * **Formats a number or numeric string by adding a custom separator
378
+ * every three digits (thousands separator), and intelligently flips
379
+ * the decimal separator according to the chosen separator.**
380
+ * - **Features:**
381
+ * - Converts a number to string before formatting.
382
+ * - Defaults to using `,` as the thousands separator.
383
+ * - If `.` is used as the separator, the decimal will automatically
384
+ * become `,`, and vice versa.
385
+ * - Handles input with existing formatting (e.g. "1,234,567.89") and normalizes it.
386
+ * - Supports custom separators, including spaces.
387
+ * - Preserves decimals even if more than 2 digits.
388
+ * @param {string | number} value - The numeric value or string to format, can be plain numbers, or already formatted strings like `"1,234,567.89"`.
389
+ * @param {string} [separator=","] - The thousands separator to use, examples: `","` ***(default)***, `"."`, `" "`, etc.
390
+ * @returns {string} The formatted string with thousands separators and
391
+ * appropriate decimal separator.
392
+ * @throws **{@link TypeError | `TypeError`}** if `value` is not a string or number, or `separator` is not a string.
393
+ * @example
394
+ * formatNumber(1000000);
395
+ * // ➔ "1,000,000"
396
+ * formatNumber("987654321");
397
+ * // ➔ "987,654,321"
398
+ * formatNumber(1234567.89);
399
+ * // ➔ "1,234,567.89"
400
+ * formatNumber("1234567,89");
401
+ * // ➔ "1,234,567.89"
402
+ * formatNumber("1234567.892");
403
+ * // ➔ "1,234,567.892"
404
+ * formatNumber("1234567.89", ".");
405
+ * // ➔ "1.234.567,89"
406
+ * formatNumber("1234567,89", ",");
407
+ * // ➔ "1,234,567.89"
408
+ * formatNumber("987654321", " ");
409
+ * // ➔ "987 654 321"
410
+ * formatNumber("1,234,567.89");
411
+ * // ➔ "1,234,567.89"
412
+ * formatNumber("1.234.567,89", ",");
413
+ * // ➔ "1,234,567.89"
414
+ * formatNumber("1.234.567,893", ".");
415
+ * // ➔ "1.234.567,893"
416
+ * formatNumber("1234.56", ".");
417
+ * // ➔ "1.234,56"
418
+ * formatNumber("1234,56", ",");
419
+ * // ➔ "1,234.56"
420
+ */
421
+ declare const formatNumber: (value: string | number, separator?: string) => string;
422
+ /** -------------------------------------------------------
423
+ * * ***Output format mode for {@link formatPhoneNumber|`formatPhoneNumber`}.***
424
+ * -------------------------------------------------------
425
+ * - `'E.164'` ➔ `+6281234567890`
426
+ * - `'RFC3966'` ➔ `tel:+62-812-3456-7890`
427
+ * - `'NATIONAL'` ➔ `0812 3456 7890`
428
+ * - `'INTERNATIONAL'` ➔ `+62 812 3456 7890`
429
+ */
430
+ type OutputFormat = ExtractStrict<NumberFormat, "INTERNATIONAL" | "NATIONAL" | "RFC3966" | "E.164">;
431
+ /** -------------------------------------------------------
432
+ * * ***Single input value for {@link formatPhoneNumber|`formatPhoneNumber`}.***
433
+ * -------------------------------------------------------
434
+ * - **Accepts:**
435
+ * - `string` — e.g. `"0812 3456 7890"`
436
+ * - `number` — e.g. `81234567890`
437
+ * - `null` or `undefined` — represents no input
438
+ * - **ℹ️ Notes**
439
+ * - The function normalizes all **non-digit characters** (spaces, dots, dashes,
440
+ * parentheses, etc.) before validation/formatting.
441
+ * - When you pass a `number`, any **leading zeros are lost by JavaScript**.
442
+ * - Prefer using a `string` if the number may begin with `0`.
443
+ * - E.164 international standard allows **up to 15 digits** (not counting `+`).
444
+ */
445
+ type ValueFormatPhoneNumber = string | number | null | undefined;
446
+ /** -------------------------------------------------------
447
+ * * ***Base option set for {@link formatPhoneNumber|`formatPhoneNumber`}.***
448
+ * -------------------------------------------------------
449
+ * **All properties are optional.**
450
+ * @description
451
+ * Defaults apply when a property is omitted or `undefined`.
452
+ *
453
+ * **⚠️ Overload-aware notes:**
454
+ * - If `checkValidOnly` is `true`, **all other properties are ignored**.
455
+ * - If `takeNumberOnly` is `true`, **all formatting properties are ignored**.
456
+ * - The leading `+` is **recommended** but not required;
457
+ * the regex will still validate numbers without `+`
458
+ * as long as the digit count ≤ **15**.
459
+ */
460
+ type FormatPhoneNumberMain = {
461
+ /** -------------------------------------------------------
462
+ * * ***Separator for formatted output.***
463
+ * -------------------------------------------------------
464
+ * **Defines the string used to separate groups of digits**
465
+ * in the formatted phone number.
466
+ * - **Default:** `" "`.
467
+ * - **Executed only when:**
468
+ * - Parameter options `checkValidOnly` and `takeNumberOnly` are both `false`.
469
+ * - (This option is ignored if either `checkValidOnly` or `takeNumberOnly` is `true`.)
470
+ * - **Behavior:**
471
+ * - The formatter inserts this separator between number blocks
472
+ * according to the selected `outputFormat`.
473
+ * @default " "
474
+ * @example
475
+ * ```ts
476
+ * // Using dash as separator
477
+ * formatPhoneNumber("081234567890", { defaultCountry: "ID", separator: "-" });
478
+ * // ➔ "+62 812-3456-7890"
479
+ *
480
+ * // Using space as separator
481
+ * formatPhoneNumber("(151) 2345-6789", { defaultCountry: "DE", separator: " " });
482
+ * // ➔ "+49 1512 3456789"
483
+ * ```
484
+ */
485
+ separator?: string;
486
+ /** -------------------------------------------------------
487
+ * * ***Output format style for the returned phone number.***
488
+ * -------------------------------------------------------
489
+ * **Determines how the formatted phone number string is returned.**
490
+ *
491
+ * - **Default:** `"INTERNATIONAL"`.
492
+ * - **Applicable only when:**
493
+ * - Parameter options `checkValidOnly` and `takeNumberOnly`
494
+ * are both **`false`**.
495
+ * - (Ignored if either of those options is `true`.)
496
+ *
497
+ * - **Supported values (from {@link NumberFormat}):**
498
+ * - `"NATIONAL"` – Local/national format, e.g. `0812 3456 7890`.
499
+ * - `"INTERNATIONAL"` – International format with leading plus, e.g. `+62 812 3456 7890`.
500
+ * - `"E.164"` – Compact E.164 format, e.g. `+6281234567890`.
501
+ * - `"RFC3966"` – RFC 3966 URI format, e.g. `tel:+62-812-3456-7890`.
502
+ *
503
+ * @default "INTERNATIONAL"
504
+ * @example
505
+ * ```ts
506
+ * // Returns a national-format string
507
+ * formatPhoneNumber("+62 81234567890", { outputFormat: "NATIONAL" });
508
+ * // ➔ "0812 3456 7890"
509
+ *
510
+ * // Returns an E.164-format string
511
+ * formatPhoneNumber("+62 81234567890", { outputFormat: "E.164" });
512
+ * // ➔ "+6281234567890"
513
+ * ```
514
+ */
515
+ outputFormat?: OutputFormat;
516
+ /** -------------------------------------------------------
517
+ * * ***Prepend a plus sign and country calling code.***
518
+ * -------------------------------------------------------
519
+ * **Forces the returned phone number to start with a leading `+`
520
+ * followed by the detected country calling code (e.g. `+63`, `+1`).**
521
+ * - **Default:** `true`.
522
+ * - **Executed only when:**
523
+ * - Parameter options `outputFormat` is set to `"INTERNATIONAL"`.
524
+ * - (This option is ignored for `"NATIONAL"`, `"E.164"` or `"RFC3966"` formats.).
525
+ * - **Applicable when:**
526
+ * - You want to guarantee that the result
527
+ * always contains a plus sign and country code, regardless of
528
+ * the selected `outputFormat`.
529
+ * - **Behavior:**
530
+ * - When `true`, the formatter ensures the output begins with
531
+ * a `+` and the correct country code.
532
+ * - When `false`, the output follows the chosen `outputFormat`
533
+ * without forcing a `+` prefix.
534
+ * @default true
535
+ * @example
536
+ * ```ts
537
+ * // Automatically adds +63 (default: `true`) even if input is local format
538
+ * formatPhoneNumber("09171234567", {
539
+ * country: "PH",
540
+ * prependPlusCountryCode: true
541
+ * });
542
+ * // ➔ "+63 917 123 4567"
543
+ *
544
+ * formatPhoneNumber("09171234567", {
545
+ * country: "PH",
546
+ * prependPlusCountryCode: false
547
+ * });
548
+ * // ➔ "63 917 123 4567"
549
+ *
550
+ * // Leaves number in national format (no plus sign)
551
+ * formatPhoneNumber("+63 9171234567", {
552
+ * country: "PH",
553
+ * prependPlusCountryCode: false,
554
+ * outputFormat: "NATIONAL"
555
+ * });
556
+ * // ➔ "0917 123 4567"
557
+ * ```
558
+ */
559
+ prependPlusCountryCode?: boolean;
560
+ /** -------------------------------------------------------
561
+ * * ***Characters before the country code (e.g. `"("`).***
562
+ * -------------------------------------------------------
563
+ * **Adds a custom string that appears **immediately before** the
564
+ * international country calling code when formatting.**
565
+ * - **Default:** `""` (empty string).
566
+ * - **Behavior:**
567
+ * - **Active only when:**
568
+ * - `checkValidOnly` is **false**,
569
+ * - `takeNumberOnly` is **false**, **and**
570
+ * - `outputFormat` is `"INTERNATIONAL"`.
571
+ * - **Ignored if:**
572
+ * - The value is an empty string (after trimming),
573
+ * - `checkValidOnly` or `takeNumberOnly` is `true`,
574
+ * - `outputFormat` is not `"INTERNATIONAL"`,
575
+ * - `closingNumberCountry` is `undefined` or an empty string (after trimming).
576
+ * - **Invalid input:**
577
+ * - Returns no effect if the phone number is invalid or not compatible
578
+ * with the selected `defaultCountry`.
579
+ * @default ""
580
+ * @example
581
+ * ```ts
582
+ * formatPhoneNumber("+63 9171234567", {
583
+ * outputFormat: "INTERNATIONAL",
584
+ * openingNumberCountry: "(",
585
+ * closingNumberCountry: ")"
586
+ * });
587
+ * // ➔ "(+63) 917 123 4567"
588
+ * ```
589
+ */
590
+ openingNumberCountry?: string;
591
+ /** -------------------------------------------------------
592
+ * * ***Characters after the country code (e.g. `")"`).***
593
+ * -------------------------------------------------------
594
+ * **Adds a custom string that appears **immediately after** the
595
+ * international country calling code when formatting.**
596
+ * - **Default:** `""` (empty string).
597
+ * - **Behavior:**
598
+ * - **Active only when:**
599
+ * - `checkValidOnly` is **false**,
600
+ * - `takeNumberOnly` is **false**, **and**
601
+ * - `outputFormat` is `"INTERNATIONAL"`.
602
+ * - **Ignored if:**
603
+ * - The value is an empty string (after trimming),
604
+ * - `checkValidOnly` or `takeNumberOnly` is `true`,
605
+ * - `outputFormat` is not `"INTERNATIONAL"`,
606
+ * - `openingNumberCountry` is `undefined` or an empty string (after trimming).
607
+ * - **Invalid input:**
608
+ * Returns no effect if the phone number is invalid or not compatible
609
+ * with the selected `defaultCountry`.
610
+ * @default ""
611
+ * @example
612
+ * ```ts
613
+ * formatPhoneNumber("+63 9171234567", {
614
+ * outputFormat: "INTERNATIONAL",
615
+ * openingNumberCountry: "(",
616
+ * closingNumberCountry: ")"
617
+ * });
618
+ * // ➔ "(+63) 917 123 4567"
619
+ * ```
620
+ */
621
+ closingNumberCountry?: string;
622
+ /** -------------------------------------------------------
623
+ * * ***Return only a boolean validity flag.***
624
+ * -------------------------------------------------------
625
+ * - ***Behavior:***
626
+ * - **Exclusive mode:**
627
+ * - ⚠️ When `true`, all formatting options and `takeNumberOnly` must be omitted or are ignored.
628
+ * - Conflicts with `takeNumberOnly`:
629
+ * - ⚠️ When `checkValidOnly` is `true` and all formatting options and `takeNumberOnly` must be
630
+ * omitted or are ignored.
631
+ * - But if mistake passing props:
632
+ * - ⚠️ When `checkValidOnly` is `true` and other of formatting options was passing:
633
+ * - If `takeNumberOnly` is `true` or `false`:
634
+ * - Will return a `boolean` because `checkValidOnly` is prioritize first.
635
+ * - Output:
636
+ * - Boolean ➔ (`true` or `false`).
637
+ * - ***DefaultValue: false***
638
+ * @default false
639
+ * @example
640
+ * ```ts
641
+ * // Returns `true` if valid number and number with country code (no need `defaultCountry`)
642
+ * formatPhoneNumber("+63 912-123-4567", { checkValidOnly: true });
643
+ * // ➔ true
644
+ *
645
+ * // Returns `true` if valid number and number without country code but with `defaultCountry`
646
+ * formatPhoneNumber("213-373-4253", { defaultCountry: "US", checkValidOnly: true });
647
+ * // ➔ true
648
+ *
649
+ * // Returns `false` if without country code.
650
+ * formatPhoneNumber("213-373-4253", { checkValidOnly: true });
651
+ * // ➔ false
652
+ *
653
+ * // Returns `false` for invalid number.
654
+ * formatPhoneNumber("abcd", { checkValidOnly: true });
655
+ * // ➔ false
656
+ * ```
657
+ */
658
+ checkValidOnly?: boolean;
659
+ /** -------------------------------------------------------
660
+ * * ***Return only the digits of the phone number (local number only).***
661
+ * -------------------------------------------------------
662
+ * **Returns a string containing only numeric characters** from the **local number**,
663
+ * ignoring any country code, spaces, plus signs, or separators.
664
+ * - **Default:** `false`
665
+ * - **Behavior:**
666
+ * - **Exclusive mode:**
667
+ * - ⚠️ When set to `true`, all formatting options
668
+ * (`outputFormat`, `prependPlusCountryCode`, etc.)
669
+ * and `checkValidOnly` **must be omitted** or will be **ignored**.
670
+ * - **Conflict handling with `checkValidOnly`:**
671
+ * - If both `takeNumberOnly` and `checkValidOnly` are `true`,
672
+ * `checkValidOnly` takes priority and the function
673
+ * returns a `boolean`.
674
+ * - If `checkValidOnly` is `false` (or not provided),
675
+ * and `takeNumberOnly` is `true`,
676
+ * the function returns a **numeric string of the local number**.
677
+ * - **Invalid input:**
678
+ * - If the input is invalid or cannot be parsed
679
+ * (e.g. not matching the `defaultCountry`),
680
+ * the function returns an **empty string** (`""`).
681
+ * - **Output example:**
682
+ * - Valid input ➔ `"81234567890"` // country code removed
683
+ * - Invalid input ➔ `""`
684
+ * @default false
685
+ * @example
686
+ * ```ts
687
+ * // Returns only digits of the local number with country code (no need `defaultCountry`)
688
+ * formatPhoneNumber("+63 912-123-4567", { takeNumberOnly: true });
689
+ * // ➔ "09121234567"
690
+ *
691
+ * // Returns only digits of the local number without country code but with `defaultCountry`
692
+ * formatPhoneNumber("213-373-4253", { defaultCountry: "US", takeNumberOnly: true });
693
+ * // ➔ "2133734253"
694
+ *
695
+ * // Returns empty string if without country code.
696
+ * formatPhoneNumber("213-373-4253", { takeNumberOnly: true });
697
+ * // ➔ ""
698
+ *
699
+ * // Returns empty string for invalid number.
700
+ * formatPhoneNumber("abcd", { takeNumberOnly: true });
701
+ * // ➔ ""
702
+ * ```
703
+ */
704
+ takeNumberOnly?: boolean;
705
+ /** -------------------------------------------------------
706
+ * * ***A "country code" is a two-letter ISO ([`ISO-3166-1 alpha-2`](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements)) country code (like `"US"` | `"ID"` | `"DE"`).***
707
+ * -------------------------------------------------------
708
+ * **Used to interpret numbers without an explicit `+<countryCode>`.**
709
+ * - ***Behavior:***
710
+ * - Required if the input without country code (`+`).
711
+ * - Ignored if the input already starts with `+`.
712
+ * - ***Examples:***
713
+ * - `"ID"` ➔ Indonesian.
714
+ * - `"US"` ➔ United States.
715
+ * - `"GB"` ➔ United Kingdom.
716
+ * - ***DefaultValue: `undefined`***.
717
+ * @example
718
+ * formatPhoneNumber("081234567890", { defaultCountry: "ID" });
719
+ * @default undefined
720
+ */
721
+ defaultCountry?: CountryCode;
722
+ };
723
+ /** -------------------------------------------------------
724
+ * * ***Specialized options for the `transformPhoneNumber` variant of {@link formatPhoneNumber|`formatPhoneNumber`}.***
725
+ * -------------------------------------------------------
726
+ * **Ensures that `checkValidOnly` and `takeNumberOnly` are both
727
+ * forced to `false` when transforming/formatting.**
728
+ *
729
+ * This type is intended for scenarios where you **must** receive a formatted
730
+ * string as output and never a `boolean` or digit-only result.
731
+ *
732
+ * **Example Output:** `+62 812 3456 7890`
733
+ */
734
+ type FormatPhoneNumberTransform = OverrideTypes<FormatPhoneNumberMain, {
735
+ /** -------------------------------------------------------
736
+ * * ***Return only a boolean validity flag.***
737
+ * -------------------------------------------------------
738
+ * - ***Behavior:***
739
+ * - **Exclusive mode:**
740
+ * - ⚠️ When `true`, all formatting options and `takeNumberOnly` must be omitted or are ignored.
741
+ * - Conflicts with `takeNumberOnly`:
742
+ * - ⚠️ When `checkValidOnly` is `true` and all formatting options and `takeNumberOnly` must be
743
+ * omitted or are ignored.
744
+ * - But if mistake passing props:
745
+ * - ⚠️ When `checkValidOnly` is `true` and other of formatting options was passing:
746
+ * - If `takeNumberOnly` is `true` or `false`:
747
+ * - Will return a `boolean` because `checkValidOnly` is prioritize first.
748
+ * - Output:
749
+ * - Boolean ➔ (`true` or `false`).
750
+ * - ***DefaultValue: false***
751
+ * @default false
752
+ * @requires `false` or `undefined`
753
+ */
754
+ checkValidOnly?: never;
755
+ /** -------------------------------------------------------
756
+ * * ***Return only the digits of the phone number (local number only).***
757
+ * -------------------------------------------------------
758
+ * **Returns a string containing only numeric characters** from the **local number**,
759
+ * ignoring any country code, spaces, plus signs, or separators.
760
+ * - **Default:** `false`
761
+ * - **Behavior:**
762
+ * - **Exclusive mode:**
763
+ * - ⚠️ When set to `true`, all formatting options
764
+ * (`outputFormat`, `prependPlusCountryCode`, etc.)
765
+ * and `checkValidOnly` **must be omitted** or will be **ignored**.
766
+ * - **Conflict handling with `checkValidOnly`:**
767
+ * - If both `takeNumberOnly` and `checkValidOnly` are `true`,
768
+ * `checkValidOnly` takes priority and the function
769
+ * returns a `boolean`.
770
+ * - If `checkValidOnly` is `false` (or not provided),
771
+ * and `takeNumberOnly` is `true`,
772
+ * the function returns a **numeric string of the local number**.
773
+ * - **Invalid input:**
774
+ * - If the input is invalid or cannot be parsed
775
+ * (e.g. not matching the `defaultCountry`),
776
+ * the function returns an **empty string** (`""`).
777
+ * - **Output example:**
778
+ * - Valid input ➔ `"81234567890"` // country code removed
779
+ * - Invalid input ➔ `""`
780
+ * @default false
781
+ * @requires `false` or `undefined`
782
+ */
783
+ takeNumberOnly?: never;
784
+ }>;
785
+ type NeverForRestFormatPhoneNumberTransform = {
786
+ /** -------------------------------------------------------
787
+ * * ***Not used in this mode **`(Never allowed in this mode)`**.***
788
+ * -------------------------------------------------------
789
+ * - ***Behavior:***
790
+ * - **Exclusive mode:**
791
+ * - ⚠️ When `true`, all formatting options must be omitted or are ignored.
792
+ * - Conflicts with `takeNumberOnly` and `checkValidOnly`:
793
+ * - If both `takeNumberOnly` and `checkValidOnly` are `true`,
794
+ * `checkValidOnly` takes priority and the function
795
+ * returns a `boolean`.
796
+ * - If `checkValidOnly` is `false` (or not provided),
797
+ * and `takeNumberOnly` is `true`,
798
+ * the function returns a **numeric string of the local number**.
799
+ * @requires `undefined`
800
+ */
801
+ separator?: never;
802
+ /** -------------------------------------------------------
803
+ * * ***Not used in this mode **`(Never allowed in this mode)`**.***
804
+ * -------------------------------------------------------
805
+ * - ***Behavior:***
806
+ * - **Exclusive mode:**
807
+ * - ⚠️ When `true`, all formatting options must be omitted or are ignored.
808
+ * - Conflicts with `takeNumberOnly` and `checkValidOnly`:
809
+ * - If both `takeNumberOnly` and `checkValidOnly` are `true`,
810
+ * `checkValidOnly` takes priority and the function
811
+ * returns a `boolean`.
812
+ * - If `checkValidOnly` is `false` (or not provided),
813
+ * and `takeNumberOnly` is `true`,
814
+ * the function returns a **numeric string of the local number**.
815
+ *
816
+ * @requires `undefined`
817
+ */
818
+ openingNumberCountry?: never;
819
+ /** -------------------------------------------------------
820
+ * * ***Not used in this mode **`(Never allowed in this mode)`**.***
821
+ * -------------------------------------------------------
822
+ * - ***Behavior:***
823
+ * - **Exclusive mode:**
824
+ * - ⚠️ When `true`, all formatting options must be omitted or are ignored.
825
+ * - Conflicts with `takeNumberOnly` and `checkValidOnly`:
826
+ * - If both `takeNumberOnly` and `checkValidOnly` are `true`,
827
+ * `checkValidOnly` takes priority and the function
828
+ * returns a `boolean`.
829
+ * - If `checkValidOnly` is `false` (or not provided),
830
+ * and `takeNumberOnly` is `true`,
831
+ * the function returns a **numeric string of the local number**.
832
+ *
833
+ * @requires `undefined`
834
+ */
835
+ closingNumberCountry?: never;
836
+ };
837
+ /** -------------------------------------------------------
838
+ * * ***Options subset for **validity-check mode** of
839
+ * {@link formatPhoneNumber|`formatPhoneNumber`}.***
840
+ * -------------------------------------------------------
841
+ * Only `checkValidOnly` is allowed.
842
+ * All formatting-related properties are **intentionally disallowed**
843
+ * to avoid mixing validation with formatting.
844
+ *
845
+ * **Example Usage:**
846
+ * ```ts
847
+ * formatPhoneNumber("+6281234567890", { checkValidOnly: true }) // boolean
848
+ * ```
849
+ */
850
+ type FormatPhoneNumberCheckValidOnly = Prettify<OverrideTypes<FormatPhoneNumberMain, {
851
+ /** -------------------------------------------------------
852
+ * * ***Return only a boolean validity flag.***
853
+ * -------------------------------------------------------
854
+ * - ***Behavior:***
855
+ * - **Exclusive mode:**
856
+ * - ⚠️ When `true`, all formatting options and `takeNumberOnly` must be omitted or are ignored.
857
+ * - Conflicts with `takeNumberOnly`:
858
+ * - ⚠️ When `checkValidOnly` is `true` and all formatting options and `takeNumberOnly` must be
859
+ * omitted or are ignored.
860
+ * - But if mistake passing props:
861
+ * - ⚠️ When `checkValidOnly` is `true` and other of formatting options was passing:
862
+ * - If `takeNumberOnly` is `true` or `false`:
863
+ * - Will return a `boolean` because `checkValidOnly` is prioritize first.
864
+ * - Output:
865
+ * - Boolean ➔ (`true` or `false`).
866
+ * - ***DefaultValue: false***
867
+ * @default false
868
+ */
869
+ checkValidOnly: true;
870
+ /** -------------------------------------------------------
871
+ * * ***Return only the digits of the phone number (local number only).***
872
+ * -------------------------------------------------------
873
+ * **Returns a string containing only numeric characters** from the **local number**,
874
+ * ignoring any country code, spaces, plus signs, or separators.
875
+ * - **Default:** `false`
876
+ * - **Behavior:**
877
+ * - **Exclusive mode:**
878
+ * - ⚠️ When set to `true`, all formatting options
879
+ * (`outputFormat`, `prependPlusCountryCode`, etc.)
880
+ * and `checkValidOnly` **must be omitted** or will be **ignored**.
881
+ * - **Conflict handling with `checkValidOnly`:**
882
+ * - If both `takeNumberOnly` and `checkValidOnly` are `true`,
883
+ * `checkValidOnly` takes priority and the function
884
+ * returns a `boolean`.
885
+ * - If `checkValidOnly` is `false` (or not provided),
886
+ * and `takeNumberOnly` is `true`,
887
+ * the function returns a **numeric string of the local number**.
888
+ * - **Invalid input:**
889
+ * - If the input is invalid or cannot be parsed
890
+ * (e.g. not matching the `defaultCountry`),
891
+ * the function returns an **empty string** (`""`).
892
+ * - **Output example:**
893
+ * - Valid input ➔ `"81234567890"` // country code removed
894
+ * - Invalid input ➔ `""`
895
+ * @default false
896
+ * @requires `false` or `undefined`
897
+ */
898
+ takeNumberOnly?: false;
899
+ } & NeverForRestFormatPhoneNumberTransform>>;
900
+ /** -------------------------------------------------------
901
+ * * ***Options subset for calling {@link formatPhoneNumber|`formatPhoneNumber`} in
902
+ * **digits-only mode**.***
903
+ * -------------------------------------------------------
904
+ * **Only `takeNumberOnly` is allowed; all other formatting options are
905
+ * intentionally disallowed.**
906
+ *
907
+ * Use this when you want a pure numeric string without any separators or country
908
+ * decorations, but still want the function to normalize the input.
909
+ *
910
+ * **Example Output:** `"6281234567890"`
911
+ */
912
+ type FormatPhoneNumberTakeNumberOnly = Prettify<OverrideTypes<FormatPhoneNumberMain, {
913
+ /** -------------------------------------------------------
914
+ * * ***Return only a boolean validity flag.***
915
+ * -------------------------------------------------------
916
+ * - ***Behavior:***
917
+ * - **Exclusive mode:**
918
+ * - ⚠️ When `true`, all formatting options and `takeNumberOnly` must be omitted or are ignored.
919
+ * - Conflicts with `takeNumberOnly`:
920
+ * - ⚠️ When `checkValidOnly` is `true` and all formatting options and `takeNumberOnly` must be
921
+ * omitted or are ignored.
922
+ * - But if mistake passing props:
923
+ * - ⚠️ When `checkValidOnly` is `true` and other of formatting options was passing:
924
+ * - If `takeNumberOnly` is `true` or `false`:
925
+ * - Will return a `boolean` because `checkValidOnly` is prioritize first.
926
+ * - Output:
927
+ * - Boolean ➔ (`true` or `false`).
928
+ * - ***DefaultValue: false***
929
+ * @default false
930
+ * @requires `false` or `undefined`
931
+ */
932
+ checkValidOnly?: false;
933
+ /** -------------------------------------------------------
934
+ * * ***Return only the digits of the phone number (local number only).***
935
+ * -------------------------------------------------------
936
+ * **Returns a string containing only numeric characters** from the **local number**,
937
+ * ignoring any country code, spaces, plus signs, or separators.
938
+ * - **Default:** `false`
939
+ * - **Behavior:**
940
+ * - **Exclusive mode:**
941
+ * - ⚠️ When set to `true`, all formatting options
942
+ * (`outputFormat`, `prependPlusCountryCode`, etc.)
943
+ * and `checkValidOnly` **must be omitted** or will be **ignored**.
944
+ * - **Conflict handling with `checkValidOnly`:**
945
+ * - If both `takeNumberOnly` and `checkValidOnly` are `true`,
946
+ * `checkValidOnly` takes priority and the function
947
+ * returns a `boolean`.
948
+ * - If `checkValidOnly` is `false` (or not provided),
949
+ * and `takeNumberOnly` is `true`,
950
+ * the function returns a **numeric string of the local number**.
951
+ * - **Invalid input:**
952
+ * - If the input is invalid or cannot be parsed
953
+ * (e.g. not matching the `defaultCountry`),
954
+ * the function returns an **empty string** (`""`).
955
+ * - **Output example:**
956
+ * - Valid input ➔ `"81234567890"` // country code removed
957
+ * - Invalid input ➔ `""`
958
+ * @default false
959
+ */
960
+ takeNumberOnly: true;
961
+ } & NeverForRestFormatPhoneNumberTransform>>;
962
+ /** -------------------------------------------------------
963
+ * * ***Options subset for calling {@link formatPhoneNumber|`formatPhoneNumber`} force to **Validity-check Mode**.***
964
+ * -------------------------------------------------------
965
+ */
966
+ type FormatPhoneNumberAllPassing = OverrideTypes<FormatPhoneNumberMain, {
967
+ /** -------------------------------------------------------
968
+ * * ***Return only a boolean validity flag.***
969
+ * -------------------------------------------------------
970
+ * - ***Behavior:***
971
+ * - **Exclusive mode:**
972
+ * - ⚠️ When `true`, all formatting options and `takeNumberOnly` must be omitted or are ignored.
973
+ * - Conflicts with `takeNumberOnly`:
974
+ * - ⚠️ When `checkValidOnly` is `true` and all formatting options and `takeNumberOnly` must be
975
+ * omitted or are ignored.
976
+ * - But if mistake passing props:
977
+ * - ⚠️ When `checkValidOnly` is `true` and other of formatting options was passing:
978
+ * - If `takeNumberOnly` is `true` or `false`:
979
+ * - Will return a `boolean` because `checkValidOnly` is prioritize first.
980
+ * - Output:
981
+ * - Boolean ➔ (`true` or `false`).
982
+ * - ***DefaultValue: false***
983
+ * @default false
984
+ */
985
+ checkValidOnly: true;
986
+ /** -------------------------------------------------------
987
+ * * ***Return only the digits of the phone number (local number only).***
988
+ * -------------------------------------------------------
989
+ * **Returns a string containing only numeric characters** from the **local number**,
990
+ * ignoring any country code, spaces, plus signs, or separators.
991
+ * - **Default:** `false`
992
+ * - **Behavior:**
993
+ * - **Exclusive mode:**
994
+ * - ⚠️ When set to `true`, all formatting options
995
+ * (`outputFormat`, `prependPlusCountryCode`, etc.)
996
+ * and `checkValidOnly` **must be omitted** or will be **ignored**.
997
+ * - **Conflict handling with `checkValidOnly`:**
998
+ * - If both `takeNumberOnly` and `checkValidOnly` are `true`,
999
+ * `checkValidOnly` takes priority and the function
1000
+ * returns a `boolean`.
1001
+ * - If `checkValidOnly` is `false` (or not provided),
1002
+ * and `takeNumberOnly` is `true`,
1003
+ * the function returns a **numeric string of the local number**.
1004
+ * - **Invalid input:**
1005
+ * - If the input is invalid or cannot be parsed
1006
+ * (e.g. not matching the `defaultCountry`),
1007
+ * the function returns an **empty string** (`""`).
1008
+ * - **Output example:**
1009
+ * - Valid input ➔ `"81234567890"` // country code removed
1010
+ * - Invalid input ➔ `""`
1011
+ * @default false
1012
+ * @requires `false` or `undefined`
1013
+ */
1014
+ takeNumberOnly: true;
1015
+ }>;
1016
+ /** -------------------------------------------------------
1017
+ * * ***Options subset for calling {@link formatPhoneNumber|`formatPhoneNumber`} force to **Validity-check Mode**.***
1018
+ * -------------------------------------------------------
1019
+ */
1020
+ type FormatPhoneNumberAllPassingValidOnly = OverrideTypes<FormatPhoneNumberMain, {
1021
+ /** -------------------------------------------------------
1022
+ * * ***Return only a boolean validity flag.***
1023
+ * -------------------------------------------------------
1024
+ * - ***Behavior:***
1025
+ * - **Exclusive mode:**
1026
+ * - ⚠️ When `true`, all formatting options and `takeNumberOnly` must be omitted or are ignored.
1027
+ * - Conflicts with `takeNumberOnly`:
1028
+ * - ⚠️ When `checkValidOnly` is `true` and all formatting options and `takeNumberOnly` must be
1029
+ * omitted or are ignored.
1030
+ * - But if mistake passing props:
1031
+ * - ⚠️ When `checkValidOnly` is `true` and other of formatting options was passing:
1032
+ * - If `takeNumberOnly` is `true` or `false`:
1033
+ * - Will return a `boolean` because `checkValidOnly` is prioritize first.
1034
+ * - Output:
1035
+ * - Boolean ➔ (`true` or `false`).
1036
+ * - ***DefaultValue: false***
1037
+ * @default false
1038
+ */
1039
+ checkValidOnly: true;
1040
+ /** -------------------------------------------------------
1041
+ * * ***Return only the digits of the phone number (local number only).***
1042
+ * -------------------------------------------------------
1043
+ * **Returns a string containing only numeric characters** from the **local number**,
1044
+ * ignoring any country code, spaces, plus signs, or separators.
1045
+ * - **Default:** `false`
1046
+ * - **Behavior:**
1047
+ * - **Exclusive mode:**
1048
+ * - ⚠️ When set to `true`, all formatting options
1049
+ * (`outputFormat`, `prependPlusCountryCode`, etc.)
1050
+ * and `checkValidOnly` **must be omitted** or will be **ignored**.
1051
+ * - **Conflict handling with `checkValidOnly`:**
1052
+ * - If both `takeNumberOnly` and `checkValidOnly` are `true`,
1053
+ * `checkValidOnly` takes priority and the function
1054
+ * returns a `boolean`.
1055
+ * - If `checkValidOnly` is `false` (or not provided),
1056
+ * and `takeNumberOnly` is `true`,
1057
+ * the function returns a **numeric string of the local number**.
1058
+ * - **Invalid input:**
1059
+ * - If the input is invalid or cannot be parsed
1060
+ * (e.g. not matching the `defaultCountry`),
1061
+ * the function returns an **empty string** (`""`).
1062
+ * - **Output example:**
1063
+ * - Valid input ➔ `"81234567890"` // country code removed
1064
+ * - Invalid input ➔ `""`
1065
+ * @default false
1066
+ * @requires `false` or `undefined`
1067
+ */
1068
+ takeNumberOnly?: false;
1069
+ }>;
1070
+ /** -------------------------------------------------------
1071
+ * * ***Options subset for calling {@link formatPhoneNumber|`formatPhoneNumber`} force to **Digits-only Mode**.***
1072
+ * -------------------------------------------------------
1073
+ */
1074
+ type FormatPhoneNumberAllPassingTakeOnly = OverrideTypes<FormatPhoneNumberMain, {
1075
+ /** -------------------------------------------------------
1076
+ * * ***Return only a boolean validity flag.***
1077
+ * -------------------------------------------------------
1078
+ * - ***Behavior:***
1079
+ * - **Exclusive mode:**
1080
+ * - ⚠️ When `true`, all formatting options and `takeNumberOnly` must be omitted or are ignored.
1081
+ * - Conflicts with `takeNumberOnly`:
1082
+ * - ⚠️ When `checkValidOnly` is `true` and all formatting options and `takeNumberOnly` must be
1083
+ * omitted or are ignored.
1084
+ * - But if mistake passing props:
1085
+ * - ⚠️ When `checkValidOnly` is `true` and other of formatting options was passing:
1086
+ * - If `takeNumberOnly` is `true` or `false`:
1087
+ * - Will return a `boolean` because `checkValidOnly` is prioritize first.
1088
+ * - Output:
1089
+ * - Boolean ➔ (`true` or `false`).
1090
+ * - ***DefaultValue: false***
1091
+ * @default false
1092
+ * @requires `false` or `undefined`
1093
+ */
1094
+ checkValidOnly?: false;
1095
+ /** -------------------------------------------------------
1096
+ * * ***Return only the digits of the phone number (local number only).***
1097
+ * -------------------------------------------------------
1098
+ * **Returns a string containing only numeric characters** from the **local number**,
1099
+ * ignoring any country code, spaces, plus signs, or separators.
1100
+ * - **Default:** `false`
1101
+ * - **Behavior:**
1102
+ * - **Exclusive mode:**
1103
+ * - ⚠️ When set to `true`, all formatting options
1104
+ * (`outputFormat`, `prependPlusCountryCode`, etc.)
1105
+ * and `checkValidOnly` **must be omitted** or will be **ignored**.
1106
+ * - **Conflict handling with `checkValidOnly`:**
1107
+ * - If both `takeNumberOnly` and `checkValidOnly` are `true`,
1108
+ * `checkValidOnly` takes priority and the function
1109
+ * returns a `boolean`.
1110
+ * - If `checkValidOnly` is `false` (or not provided),
1111
+ * and `takeNumberOnly` is `true`,
1112
+ * the function returns a **numeric string of the local number**.
1113
+ * - **Invalid input:**
1114
+ * - If the input is invalid or cannot be parsed
1115
+ * (e.g. not matching the `defaultCountry`),
1116
+ * the function returns an **empty string** (`""`).
1117
+ * - **Output example:**
1118
+ * - Valid input ➔ `"81234567890"` // country code removed
1119
+ * - Invalid input ➔ `""`
1120
+ * @default false
1121
+ */
1122
+ takeNumberOnly: true;
1123
+ }>;
1124
+ /** -------------------------------------------------------
1125
+ * * ***Utility: `formatPhoneNumber`.***
1126
+ * -------------------------------------------------------
1127
+ * **Formats a phone number into a customizable local or international style.**
1128
+ * - **Type:** ***`Formatting Number`.***
1129
+ * - **Can also:**
1130
+ * - Return only digits string when **digits-only mode** (`takeNumberOnly`):
1131
+ * - Return empty-string (""), if invalid number phone.
1132
+ * - Return boolean when **validity-check mode** (`checkValidOnly`):
1133
+ * - ***Return `true` if:***
1134
+ * - A phone number is "valid" when it has valid length, and the actual phone number digits match the
1135
+ * regular expressions for its country (parameter options `defaultCountry`).
1136
+ * - **E.164 compliance:**
1137
+ * - Optional leading `+` is recommended but **not required**.
1138
+ * - If Without leading `+`, you must passing `defaultCountry`.
1139
+ * @throws **{@link TypeError | `TypeError`}** if `value` is not string, number, null or undefined.
1140
+ * @throws **{@link TypeError | `TypeError`}** if `options` is not an object or contains wrong types.
1141
+ * @param {ValueFormatPhoneNumber} value
1142
+ * ***Phone number to format, accepts:***
1143
+ * - `string` (recommended to preserve leading zeros).
1144
+ * - `number` (leading zeros will be lost).
1145
+ * - `null` or `undefined` (returns empty string).
1146
+ * @param {FormatPhoneNumberMain} [options]
1147
+ * ***Main options object controlling:***
1148
+ * - `separator` (**string**): Group separator, default `" "`.
1149
+ * - `plusNumberCountry` (**string**): Country code with optional leading `+`.
1150
+ * - `openingNumberCountry` (**string**): Characters before the country code, e.g. `"("`.
1151
+ * - `closingNumberCountry` (**string**): Characters after the country code, e.g. `")"`.
1152
+ * - `checkValidOnly` (**boolean**): Return only validity.
1153
+ * - `takeNumberOnly` (**boolean**): Return digits only.
1154
+ * - `defaultCountry` (**string** - **`<ISO-3166-1 alpha-2>`**): Used to interpret numbers without an explicit `+<countryCode>`.
1155
+ * @returns {string|boolean} Formatted phone number string, digits-only string, or boolean.
1156
+ * @overload
1157
+ * @param {ValueFormatPhoneNumber} value The phone number input (string or number).
1158
+ * @param {FormatPhoneNumberCheckValidOnly} [options] With `checkValidOnly: true`.
1159
+ * Return a **validity-check mode** when `checkValidOnly: true`.
1160
+ * @returns {boolean} A boolean indicating whether the input is a valid phone number.
1161
+ * @overload
1162
+ * @param {ValueFormatPhoneNumber} value The phone number input (string or number).
1163
+ * @param {FormatPhoneNumberTransform} [options] With `takeNumberOnly: true`.
1164
+ * Return **digits-only mode** when `takeNumberOnly: true`.
1165
+ * @returns {string} A string of digits only.
1166
+ * @overload
1167
+ * @param {ValueFormatPhoneNumber} value The phone number input (string or number).
1168
+ * @param {FormatPhoneNumberTakeNumberOnly} [options] Options to customize format output (country code, separator, etc).
1169
+ * Return a **formatted phone number string** with custom formatting and (`checkValidOnly: false`, `takeNumberOnly: false`).
1170
+ * @returns {string} Formatting number. return a string of digits only with formatter.
1171
+ * @example
1172
+ * 1. ***Formatting Phone Number String:***
1173
+ * ```ts
1174
+ * formatPhoneNumber("081234567890");
1175
+ * // ➔ "0812 3456 7890"
1176
+ * formatPhoneNumber("081234567890", {
1177
+ * separator: "-",
1178
+ * plusNumberCountry: "+44",
1179
+ * openingNumberCountry: "(",
1180
+ * closingNumberCountry: ")"
1181
+ * });
1182
+ * // ➔ "(+44) 8123-4567-890"
1183
+ * ```
1184
+ * 2. ***Digits-Only Mode:***
1185
+ * ```ts
1186
+ * formatPhoneNumber("(0812) 3456-7890", {
1187
+ * takeNumberOnly: true,
1188
+ * defaultCountry: "ID"
1189
+ * });
1190
+ * // ➔ "081234567890"
1191
+ * formatPhoneNumber("(0812) 3456-7890", { takeNumberOnly: true });
1192
+ * // ➔ ""
1193
+ * formatPhoneNumber("(63) 917 123 4567", {
1194
+ * takeNumberOnly: true,
1195
+ * defaultCountry: "PH"
1196
+ * });
1197
+ * // ➔ "0917 123 4567"
1198
+ * formatPhoneNumber("(63) 4567-8901", {
1199
+ * takeNumberOnly: true,
1200
+ * defaultCountry: "PH"
1201
+ * });
1202
+ * // ➔ "" // is not valid number from PH.
1203
+ * formatPhoneNumber("(63) 917 123 4567", { takeNumberOnly: true });
1204
+ * // ➔ ""
1205
+ * formatPhoneNumber("49 (151) 2345 6789", {
1206
+ * takeNumberOnly: true,
1207
+ * defaultCountry: "DE"
1208
+ * });
1209
+ * // ➔ "015123456789"
1210
+ * formatPhoneNumber("49 (151) 2345 6789", { takeNumberOnly: true });
1211
+ * // ➔ ""
1212
+ * ```
1213
+ * 3. ***Validity-Check Mode:***
1214
+ * ```ts
1215
+ * formatPhoneNumber("+6281234567890", { checkValidOnly: true });
1216
+ * // ➔ true
1217
+ * formatPhoneNumber("0812-3456-7890", {
1218
+ * checkValidOnly: true,
1219
+ * defaultCountry: "ID"
1220
+ * });
1221
+ * // ➔ true
1222
+ * formatPhoneNumber("0812 3456 7890", { checkValidOnly: true });
1223
+ * // ➔ false
1224
+ * formatPhoneNumber("(0812) 3456-7890", {
1225
+ * checkValidOnly: true,
1226
+ * defaultCountry: "ID"
1227
+ * });
1228
+ * // ➔ true
1229
+ * formatPhoneNumber("(0812) 3456-7890", { checkValidOnly: true});
1230
+ * // ➔ false
1231
+ * formatPhoneNumber("+44 20 7946 0958", { checkValidOnly: true });
1232
+ * // ➔ true
1233
+ * formatPhoneNumber("+1 (800) 123-4567", { checkValidOnly: true });
1234
+ * // ➔ true
1235
+ * formatPhoneNumber("+62.812.3456.7890", { checkValidOnly: true });
1236
+ * // ➔ true
1237
+ * formatPhoneNumber("+62(812)3456-7890", { checkValidOnly: true });
1238
+ * // ➔ true
1239
+ * formatPhoneNumber("+62abc123", { checkValidOnly: true });
1240
+ * // ➔ false
1241
+ * formatPhoneNumber("invalid@@@", { checkValidOnly: true });
1242
+ * // ➔ false
1243
+ * formatPhoneNumber("0812-3456-hello", { checkValidOnly: true });
1244
+ * // ➔ false
1245
+ * ```
1246
+ */
1247
+ declare function formatPhoneNumber(value: ValueFormatPhoneNumber, options?: FormatPhoneNumberTransform): string;
1248
+ /** -------------------------------------------------------
1249
+ * * ***Utility: `formatPhoneNumber`.***
1250
+ * -------------------------------------------------------
1251
+ * **Formats a phone number into a customizable local or international style.**
1252
+ * - **Type:** ***`Digits-only Mode`.***
1253
+ * - **Can also:**
1254
+ * - Return only digits string when **digits-only mode** (`takeNumberOnly`).
1255
+ * - Return boolean when **validity-check mode** (`checkValidOnly`) using a
1256
+ * regex for international-style phone numbers:
1257
+ * - ***Valid if:***
1258
+ * - Only contains digits, optional leading `+`, spaces, parentheses `()`,
1259
+ * hyphens `-`, or dots `.`.
1260
+ * - Digits-only length < 16.
1261
+ * - **E.164 compliance:**
1262
+ * - Optional leading `+` is recommended but **not required**.
1263
+ * - If Without leading `+`, you must passing `defaultCountry`.
1264
+ * @throws **{@link TypeError | `TypeError`}** if `value` is not string, number, null or undefined.
1265
+ * @throws **{@link TypeError | `TypeError`}** if `options` is not an object or contains wrong types.
1266
+ * @param {ValueFormatPhoneNumber} value
1267
+ * Phone number to format. Accepts:
1268
+ * - `string` (recommended to preserve leading zeros)
1269
+ * - `number` (leading zeros will be lost)
1270
+ * - `null` or `undefined` (returns empty string).
1271
+ * @param {FormatPhoneNumberTakeNumberOnly} [options] Options to customize format output (country code, separator, etc).
1272
+ * @returns {string} Digits-only mode, return string a digits-only.
1273
+ * @example
1274
+ * ```ts
1275
+ * formatPhoneNumber("(0812) 3456-7890", {
1276
+ * takeNumberOnly: true,
1277
+ * defaultCountry: "ID"
1278
+ * });
1279
+ * // ➔ "081234567890"
1280
+ * formatPhoneNumber("(0812) 3456-7890", { takeNumberOnly: true });
1281
+ * // ➔ ""
1282
+ * formatPhoneNumber("(63) 917 123 4567", {
1283
+ * takeNumberOnly: true,
1284
+ * defaultCountry: "PH"
1285
+ * });
1286
+ * // ➔ "0917 123 4567"
1287
+ * formatPhoneNumber("(63) 4567-8901", {
1288
+ * takeNumberOnly: true,
1289
+ * defaultCountry: "PH"
1290
+ * });
1291
+ * // ➔ "" // is not valid number from PH.
1292
+ * formatPhoneNumber("(63) 917 123 4567", { takeNumberOnly: true });
1293
+ * // ➔ ""
1294
+ * formatPhoneNumber("49 (151) 2345 6789", {
1295
+ * takeNumberOnly: true,
1296
+ * defaultCountry: "DE"
1297
+ * });
1298
+ * // ➔ "015123456789"
1299
+ * formatPhoneNumber("49 (151) 2345 6789", { takeNumberOnly: true });
1300
+ * // ➔ ""
1301
+ * ```
1302
+ */
1303
+ declare function formatPhoneNumber(value: ValueFormatPhoneNumber, options?: FormatPhoneNumberTakeNumberOnly): string;
1304
+ /** -------------------------------------------------------
1305
+ * * ***Utility: `formatPhoneNumber`.***
1306
+ * -------------------------------------------------------
1307
+ * **Formats a phone number into a customizable local or international style.**
1308
+ * - **Type:** ***`Validity-check Mode`.***
1309
+ * - **Can also:**
1310
+ * - Return only digits string when **digits-only mode** (`takeNumberOnly`).
1311
+ * - Return boolean when **validity-check mode** (`checkValidOnly`) using a
1312
+ * regex for international-style phone numbers:
1313
+ * - ***Valid if:***
1314
+ * - Only contains digits, optional leading `+`, spaces, parentheses `()`,
1315
+ * hyphens `-`, or dots `.`.
1316
+ * - Digits-only length < 16.
1317
+ * - **E.164 compliance:**
1318
+ * - Optional leading `+` is recommended but **not required**.
1319
+ * - If Without leading `+`, you must passing `defaultCountry`.
1320
+ * @throws **{@link TypeError | `TypeError`}** if `value` is not string, number, null or undefined.
1321
+ * @throws **{@link TypeError | `TypeError`}** if `options` is not an object or contains wrong types.
1322
+ * @param {ValueFormatPhoneNumber} value
1323
+ * Phone number to format. Accepts:
1324
+ * - `string` (recommended to preserve leading zeros).
1325
+ * - `number` (leading zeros will be lost).
1326
+ * - `null` or `undefined` (returns empty string).
1327
+ * @param {FormatPhoneNumberTakeNumberOnly} [options] Options to customize format output (country code, separator, etc).
1328
+ * @returns {boolean} Validity-check mode, return a boolean.
1329
+ * @example
1330
+ * ```ts
1331
+ * formatPhoneNumber("+6281234567890", { checkValidOnly: true });
1332
+ * // ➔ true
1333
+ * formatPhoneNumber("0812-3456-7890", {
1334
+ * checkValidOnly: true,
1335
+ * defaultCountry: "ID"
1336
+ * });
1337
+ * // ➔ true
1338
+ * formatPhoneNumber("0812 3456 7890", { checkValidOnly: true });
1339
+ * // ➔ false
1340
+ * formatPhoneNumber("(0812) 3456-7890", {
1341
+ * checkValidOnly: true,
1342
+ * defaultCountry: "ID"
1343
+ * });
1344
+ * // ➔ true
1345
+ * formatPhoneNumber("(0812) 3456-7890", { checkValidOnly: true});
1346
+ * // ➔ false
1347
+ * formatPhoneNumber("+44 20 7946 0958", { checkValidOnly: true });
1348
+ * // ➔ true
1349
+ * formatPhoneNumber("+1 (800) 123-4567", { checkValidOnly: true });
1350
+ * // ➔ true
1351
+ * formatPhoneNumber("+62.812.3456.7890", { checkValidOnly: true });
1352
+ * // ➔ true
1353
+ * formatPhoneNumber("+62(812)3456-7890", { checkValidOnly: true });
1354
+ * // ➔ true
1355
+ * formatPhoneNumber("+62abc123", { checkValidOnly: true });
1356
+ * // ➔ false
1357
+ * formatPhoneNumber("invalid@@@", { checkValidOnly: true });
1358
+ * // ➔ false
1359
+ * formatPhoneNumber("0812-3456-hello", { checkValidOnly: true });
1360
+ * // ➔ false
1361
+ * ```
1362
+ */
1363
+ declare function formatPhoneNumber(value: ValueFormatPhoneNumber, options?: FormatPhoneNumberCheckValidOnly): boolean;
1364
+ /** -------------------------------------------------------
1365
+ * * ***Utility: `formatPhoneNumber`.***
1366
+ * -------------------------------------------------------
1367
+ * **Formats a phone number into a customizable local or international style.**
1368
+ * - **Type:** ***Forced to `Validity-check Mode`***, because `checkValidOnly` has set to `true`.
1369
+ * - **Can also:**
1370
+ * - Return only digits string when **digits-only mode** (`takeNumberOnly`).
1371
+ * - Return boolean when **validity-check mode** (`checkValidOnly`) using a
1372
+ * regex for international-style phone numbers:
1373
+ * - ***Valid if:***
1374
+ * - Only contains digits, optional leading `+`, spaces, parentheses `()`,
1375
+ * hyphens `-`, or dots `.`.
1376
+ * - Digits-only length < 16.
1377
+ * - **E.164 compliance:**
1378
+ * - Optional leading `+` is recommended but **not required**.
1379
+ * - If Without leading `+`, you must passing `defaultCountry`.
1380
+ * @throws **{@link TypeError | `TypeError`}** if `value` is not string, number, null or undefined.
1381
+ * @throws **{@link TypeError | `TypeError`}** if `options` is not an object or contains wrong types.
1382
+ * @param {ValueFormatPhoneNumber} value
1383
+ * Phone number to format. Accepts:
1384
+ * - `string` (recommended to preserve leading zeros).
1385
+ * - `number` (leading zeros will be lost).
1386
+ * - `null` or `undefined` (returns empty string).
1387
+ * @param {FormatPhoneNumberTakeNumberOnly} [options] Options to customize format output (country code, separator, etc).
1388
+ * @returns {boolean} Validity-check mode, return a boolean.
1389
+ * @example
1390
+ * ```ts
1391
+ * formatPhoneNumber("+6281234567890", {
1392
+ * // Formatting Phone Number Options
1393
+ * separator: "-",
1394
+ * // Validity-check Mode
1395
+ * checkValidOnly: true,
1396
+ * });
1397
+ * // ➔ true
1398
+ * formatPhoneNumber("0812-3456-7890", {
1399
+ * defaultCountry: "ID",
1400
+ * // Formatting Phone Number Options
1401
+ * separator: "-",
1402
+ * // Validity-check Mode
1403
+ * checkValidOnly: true,
1404
+ * });
1405
+ * // ➔ true
1406
+ * formatPhoneNumber("0812 3456 7890", {
1407
+ * // Formatting Phone Number Options
1408
+ * separator: "-",
1409
+ * // Validity-check Mode
1410
+ * checkValidOnly: true,
1411
+ * });
1412
+ * // ➔ false
1413
+ * formatPhoneNumber("(0812) 3456-7890", {
1414
+ * defaultCountry: "ID",
1415
+ * // Formatting Phone Number Options
1416
+ * separator: "-",
1417
+ * // Validity-check Mode
1418
+ * checkValidOnly: true,
1419
+ * });
1420
+ * // ➔ true
1421
+ * formatPhoneNumber("(0812) 3456-7890", {
1422
+ * // Formatting Phone Number Options
1423
+ * separator: "-",
1424
+ * // Validity-check Mode
1425
+ * checkValidOnly: true
1426
+ * });
1427
+ * // ➔ false
1428
+ * formatPhoneNumber("+44 20 7946 0958", {
1429
+ * // Formatting Phone Number Options
1430
+ * separator: "-",
1431
+ * // Validity-check Mode
1432
+ * checkValidOnly: true
1433
+ * });
1434
+ * // ➔ true
1435
+ * formatPhoneNumber("+1 (800) 123-4567", {
1436
+ * // Formatting Phone Number Options
1437
+ * separator: "-",
1438
+ * // Validity-check Mode
1439
+ * checkValidOnly: true
1440
+ * });
1441
+ * // ➔ true
1442
+ * formatPhoneNumber("+62.812.3456.7890", {
1443
+ * // Formatting Phone Number Options
1444
+ * separator: "-",
1445
+ * // Validity-check Mode
1446
+ * checkValidOnly: true
1447
+ * });
1448
+ * // ➔ true
1449
+ * formatPhoneNumber("+62(812)3456-7890", {
1450
+ * // Formatting Phone Number Options
1451
+ * separator: "-",
1452
+ * // Validity-check Mode
1453
+ * checkValidOnly: true
1454
+ * });
1455
+ * // ➔ true
1456
+ * formatPhoneNumber("+62abc123", {
1457
+ * // Formatting Phone Number Options
1458
+ * separator: "-",
1459
+ * // Validity-check Mode
1460
+ * checkValidOnly: true
1461
+ * });
1462
+ * // ➔ false
1463
+ * formatPhoneNumber("invalid@@@", {
1464
+ * // Formatting Phone Number Options
1465
+ * separator: "-",
1466
+ * // Validity-check Mode
1467
+ * checkValidOnly: true
1468
+ * });
1469
+ * // ➔ false
1470
+ * formatPhoneNumber("0812-3456-hello", {
1471
+ * // Formatting Phone Number Options
1472
+ * separator: "-",
1473
+ * // Validity-check Mode
1474
+ * checkValidOnly: true
1475
+ * });
1476
+ * // ➔ false
1477
+ * ```
1478
+ */
1479
+ declare function formatPhoneNumber(value: ValueFormatPhoneNumber, options?: FormatPhoneNumberAllPassingValidOnly): boolean;
1480
+ /** -------------------------------------------------------
1481
+ * * ***Utility: `formatPhoneNumber`.***
1482
+ * -------------------------------------------------------
1483
+ * **Formats a phone number into a customizable local or international style.**
1484
+ * - **Type:** ***Forced to `Digits-only Mode`***, because `takeNumberOnly` has set to `true`.
1485
+ * - **Can also:**
1486
+ * - Return only digits string when **digits-only mode** (`takeNumberOnly`).
1487
+ * - Return boolean when **validity-check mode** (`checkValidOnly`) using a
1488
+ * regex for international-style phone numbers:
1489
+ * - ***Valid if:***
1490
+ * - Only contains digits, optional leading `+`, spaces, parentheses `()`,
1491
+ * hyphens `-`, or dots `.`.
1492
+ * - Digits-only length < 16.
1493
+ * - **E.164 compliance:**
1494
+ * - Optional leading `+` is recommended but **not required**.
1495
+ * - If Without leading `+`, you must passing `defaultCountry`.
1496
+ * @throws **{@link TypeError | `TypeError`}** if `value` is not string, number, null or undefined.
1497
+ * @throws **{@link TypeError | `TypeError`}** if `options` is not an object or contains wrong types.
1498
+ * @param {ValueFormatPhoneNumber} value
1499
+ * Phone number to format. Accepts:
1500
+ * - `string` (recommended to preserve leading zeros)
1501
+ * - `number` (leading zeros will be lost)
1502
+ * - `null` or `undefined` (returns empty string).
1503
+ * @param {FormatPhoneNumberTakeNumberOnly} [options] Options to customize format output (country code, separator, etc).
1504
+ * @returns {string} Digits-only mode, return string a digits-only.
1505
+ * @example
1506
+ * ```ts
1507
+ * formatPhoneNumber("(0812) 3456-7890", {
1508
+ * defaultCountry: "ID",
1509
+ * // Formatting Phone Number Options
1510
+ * separator: "-",
1511
+ * // Digits-only Mode
1512
+ * takeNumberOnly: true,
1513
+ * });
1514
+ * // ➔ "081234567890"
1515
+ * formatPhoneNumber("(0812) 3456-7890", {
1516
+ * // Formatting Phone Number Options
1517
+ * separator: "-",
1518
+ * // Digits-only Mode
1519
+ * takeNumberOnly: true,
1520
+ * });
1521
+ * // ➔ ""
1522
+ * formatPhoneNumber("(63) 917 123 4567", {
1523
+ * defaultCountry: "PH",
1524
+ * // Formatting Phone Number Options
1525
+ * separator: "-",
1526
+ * // Digits-only Mode
1527
+ * takeNumberOnly: true,
1528
+ * });
1529
+ * // ➔ "0917 123 4567"
1530
+ * formatPhoneNumber("(63) 4567-8901", {
1531
+ * defaultCountry: "PH",
1532
+ * // Formatting Phone Number Options
1533
+ * separator: "-",
1534
+ * // Digits-only Mode
1535
+ * takeNumberOnly: true,
1536
+ * });
1537
+ * // ➔ "" // is not valid number from PH.
1538
+ * formatPhoneNumber("(63) 917 123 4567", { takeNumberOnly: true });
1539
+ * // ➔ ""
1540
+ * formatPhoneNumber("49 (151) 2345 6789", {
1541
+ * defaultCountry: "DE",
1542
+ * // Formatting Phone Number Options
1543
+ * separator: "-",
1544
+ * // Digits-only Mode
1545
+ * takeNumberOnly: true,
1546
+ * });
1547
+ * // ➔ "015123456789"
1548
+ * formatPhoneNumber("49 (151) 2345 6789", {
1549
+ * // Formatting Phone Number Options
1550
+ * separator: "-",
1551
+ * // Digits-only Mode
1552
+ * takeNumberOnly: true,
1553
+ * });
1554
+ * // ➔ ""
1555
+ * ```
1556
+ */
1557
+ declare function formatPhoneNumber(value: ValueFormatPhoneNumber, options?: FormatPhoneNumberAllPassingTakeOnly): string;
1558
+ /** -------------------------------------------------------
1559
+ * * ***Utility: `formatPhoneNumber`.***
1560
+ * -------------------------------------------------------
1561
+ * **Formats a phone number into a customizable local or international style.**
1562
+ * - **Type:** ***Forced to `Validity-check Mode`***, because `checkValidOnly` and `takeNumberOnly` has set to `true`,
1563
+ * but `checkValidOnly` will prioritize one.
1564
+ * - **Can also:**
1565
+ * - Return only digits string when **digits-only mode** (`takeNumberOnly`).
1566
+ * - Return boolean when **validity-check mode** (`checkValidOnly`) using a
1567
+ * regex for international-style phone numbers:
1568
+ * - ***Valid if:***
1569
+ * - Only contains digits, optional leading `+`, spaces, parentheses `()`,
1570
+ * hyphens `-`, or dots `.`.
1571
+ * - Digits-only length < 16.
1572
+ * - **E.164 compliance:**
1573
+ * - Optional leading `+` is recommended but **not required**.
1574
+ * - If Without leading `+`, you must passing `defaultCountry`.
1575
+ * @throws **{@link TypeError | `TypeError`}** if `value` is not string, number, null or undefined.
1576
+ * @throws **{@link TypeError | `TypeError`}** if `options` is not an object or contains wrong types.
1577
+ * @param {ValueFormatPhoneNumber} value
1578
+ * Phone number to format. Accepts:
1579
+ * - `string` (recommended to preserve leading zeros).
1580
+ * - `number` (leading zeros will be lost).
1581
+ * - `null` or `undefined` (returns empty string).
1582
+ * @param {FormatPhoneNumberTakeNumberOnly} [options] Options to customize format output (country code, separator, etc).
1583
+ * @returns {boolean} Validity-check mode, return a boolean.
1584
+ * @example
1585
+ * ```ts
1586
+ * formatPhoneNumber("+6281234567890", {
1587
+ * // Formatting Phone Number Options
1588
+ * separator: "-",
1589
+ * // Validity-check Mode
1590
+ * checkValidOnly: true,
1591
+ * // Digits-only Mode
1592
+ * takeNumberOnly: true,
1593
+ * });
1594
+ * // ➔ true
1595
+ * formatPhoneNumber("0812-3456-7890", {
1596
+ * defaultCountry: "ID",
1597
+ * // Formatting Phone Number Options
1598
+ * separator: "-",
1599
+ * // Validity-check Mode
1600
+ * checkValidOnly: true,
1601
+ * // Digits-only Mode
1602
+ * takeNumberOnly: true,
1603
+ * });
1604
+ * // ➔ true
1605
+ * formatPhoneNumber("0812 3456 7890", {
1606
+ * // Formatting Phone Number Options
1607
+ * separator: "-",
1608
+ * // Validity-check Mode
1609
+ * checkValidOnly: true,
1610
+ * // Digits-only Mode
1611
+ * takeNumberOnly: true,
1612
+ * });
1613
+ * // ➔ false
1614
+ * formatPhoneNumber("(0812) 3456-7890", {
1615
+ * defaultCountry: "ID",
1616
+ * // Formatting Phone Number Options
1617
+ * separator: "-",
1618
+ * // Validity-check Mode
1619
+ * checkValidOnly: true,
1620
+ * // Digits-only Mode
1621
+ * takeNumberOnly: true,
1622
+ * });
1623
+ * // ➔ true
1624
+ * formatPhoneNumber("(0812) 3456-7890", {
1625
+ * // Formatting Phone Number Options
1626
+ * separator: "-",
1627
+ * // Validity-check Mode
1628
+ * checkValidOnly: true,
1629
+ * // Digits-only Mode
1630
+ * takeNumberOnly: true,
1631
+ * });
1632
+ * // ➔ false
1633
+ * formatPhoneNumber("+44 20 7946 0958", {
1634
+ * // Formatting Phone Number Options
1635
+ * separator: "-",
1636
+ * // Validity-check Mode
1637
+ * checkValidOnly: true,
1638
+ * // Digits-only Mode
1639
+ * takeNumberOnly: true,
1640
+ * });
1641
+ * // ➔ true
1642
+ * formatPhoneNumber("+1 (800) 123-4567", {
1643
+ * // Formatting Phone Number Options
1644
+ * separator: "-",
1645
+ * // Validity-check Mode
1646
+ * checkValidOnly: true,
1647
+ * // Digits-only Mode
1648
+ * takeNumberOnly: true,
1649
+ * });
1650
+ * // ➔ true
1651
+ * formatPhoneNumber("+62.812.3456.7890", {
1652
+ * // Formatting Phone Number Options
1653
+ * separator: "-",
1654
+ * // Validity-check Mode
1655
+ * checkValidOnly: true,
1656
+ * // Digits-only Mode
1657
+ * takeNumberOnly: true,
1658
+ * });
1659
+ * // ➔ true
1660
+ * formatPhoneNumber("+62(812)3456-7890", {
1661
+ * // Formatting Phone Number Options
1662
+ * separator: "-",
1663
+ * // Validity-check Mode
1664
+ * checkValidOnly: true,
1665
+ * // Digits-only Mode
1666
+ * takeNumberOnly: true,
1667
+ * });
1668
+ * // ➔ true
1669
+ * formatPhoneNumber("+62abc123", {
1670
+ * // Formatting Phone Number Options
1671
+ * separator: "-",
1672
+ * // Validity-check Mode
1673
+ * checkValidOnly: true,
1674
+ * // Digits-only Mode
1675
+ * takeNumberOnly: true,
1676
+ * });
1677
+ * // ➔ false
1678
+ * formatPhoneNumber("invalid@@@", {
1679
+ * // Formatting Phone Number Options
1680
+ * separator: "-",
1681
+ * // Validity-check Mode
1682
+ * checkValidOnly: true,
1683
+ * // Digits-only Mode
1684
+ * takeNumberOnly: true,
1685
+ * });
1686
+ * // ➔ false
1687
+ * formatPhoneNumber("0812-3456-hello", {
1688
+ * // Formatting Phone Number Options
1689
+ * separator: "-",
1690
+ * // Validity-check Mode
1691
+ * checkValidOnly: true,
1692
+ * // Digits-only Mode
1693
+ * takeNumberOnly: true,
1694
+ * });
1695
+ * // ➔ false
1696
+ * ```
1697
+ */
1698
+ declare function formatPhoneNumber(value: ValueFormatPhoneNumber, options?: FormatPhoneNumberAllPassing): boolean;
1699
+ type CensorEmailOptions = {
1700
+ /** ----------------------------------------------------------
1701
+ * * ***Censorship Mode.***
1702
+ * ----------------------------------------------------------
1703
+ * - **Valid value:**
1704
+ * - `"fixed"` (default) – Deterministic censorship based on a hash of the email, same input always produces the same output.
1705
+ * - `"random"` – Each character is randomly replaced every time the function is called.
1706
+ */
1707
+ mode?: "random" | "fixed";
1708
+ };
1709
+ /** ----------------------------------------------------------
1710
+ * * ***Utility: `censorEmail`.***
1711
+ * ----------------------------------------------------------
1712
+ * **Censors an email by replacing characters with `"*"` while supporting random or fixed mode.**
1713
+ * - **This function replaces parts of an email with asterisks to protect privacy.**
1714
+ * - **Modes:**
1715
+ * - `"fixed"` (default) – Deterministic censorship based on a hash of the email, same input always produces the same output.
1716
+ * - `"random"` – Each character is randomly replaced every time the function is called.
1717
+ * - **ℹ️ Note:**
1718
+ * - Invalid emails or non-string input will return an empty-string (`""`).
1719
+ * @param {string | null | undefined} email - The email address to censor.
1720
+ * @param {CensorEmailOptions} [options={}] - Options object for mode.
1721
+ * @returns {string} The censored email, or an empty string if input is invalid.
1722
+ * @throws **{@link TypeError | `TypeError`}** if `options` is not a plain object or `mode` is invalid.
1723
+ * @example
1724
+ * // Fixed mode (default, deterministic)
1725
+ * censorEmail("john.doe@gmail.com");
1726
+ * // ➔ "j**n.**e@g***l.com"
1727
+ *
1728
+ * // Fixed mode explicitly
1729
+ * censorEmail("john.doe@gmail.com", { mode: "fixed" });
1730
+ * // ➔ "j**n.**e@g***l.com"
1731
+ *
1732
+ * // Random mode (output may vary each time)
1733
+ * censorEmail("john.doe@gmail.com", { mode: "random" });
1734
+ * // ➔ "j*hn.***e@g***l.com" (random)
1735
+ *
1736
+ * // Invalid email returns empty string
1737
+ * censorEmail("invalid-email");
1738
+ * // ➔ ""
1739
+ */
1740
+ declare const censorEmail: (email: string | null | undefined, options?: CensorEmailOptions) => string;
1741
+ type ChunkStringOptions = {
1742
+ /** ***The separator string to insert between characters or words.***
1743
+ *
1744
+ * - Used when inserting separators every `limiter` characters.
1745
+ * - Default is a single space `" "`.
1746
+ *
1747
+ * @default " "
1748
+ */
1749
+ separator?: string;
1750
+ /** ***Determines whether counting for `limiter` resets after each space.***
1751
+ *
1752
+ * - If `true`, the string is treated as words separated by spaces,
1753
+ * and separators are applied within words, then words are grouped.
1754
+ * - If `false` ***(default)***, counting is continuous across the whole string,
1755
+ * treating spaces as normal characters.
1756
+ *
1757
+ * @default false
1758
+ */
1759
+ reCountAfterSpace?: boolean;
1760
+ };
1761
+ /** ----------------------------------------------
1762
+ * * ***Utility: `chunkString`.***
1763
+ * ----------------------------------------------
1764
+ * **Chunks a string by inserting a separator every `limiter` characters.**
1765
+ * - **This function handles two main behaviors based on `reCountAfterSpace`:**
1766
+ * 1. ***If `reCountAfterSpace` is `false` (default):***
1767
+ * - The separator is inserted strictly every `limiter` characters throughout the entire string, regardless of spaces, spaces are treated as regular characters in the count.
1768
+ * - Example: `chunkString("1234567890", 3, "-")` ➔ `"123-456-789-0"`.
1769
+ * - Example: `chunkString("Hello World", 3, "-")` ➔ `"Hel-lo -Wor-ld"`.
1770
+ * 2. ***If `reCountAfterSpace` is `true`:***
1771
+ * - The function first processes the input string to replace any multiple consecutive spaces with a
1772
+ * single space (e.g., "A B" becomes "A B").
1773
+ * Then, it treats the string as a sequence of "words" (segments separated by single spaces).
1774
+ * - Each word is processed independently:
1775
+ * - if a word's length exceeds the `limiter`, separators are inserted internally within that word.
1776
+ * - Words are then grouped. Each group will contain `limiter` number of words.
1777
+ * - Words within the same group are joined by the specified `separator`.
1778
+ * - Finally, these groups are joined by a single space, preserving the original word separation
1779
+ * structure between groups.
1780
+ * @param {string} subject - ***The target string to chunk.****
1781
+ * @param {number} limiter
1782
+ * ***The interval (number of characters) for inserting separators, behavior:***
1783
+ * - If `reCountAfterSpace = false`, it counts characters.
1784
+ * - If `reCountAfterSpace = true`, it counts both characters within words and words per group.
1785
+ * @param {ChunkStringOptions} [options={}] - ***Optional settings for separator and counting behavior.***
1786
+ * @returns {string} Return the formatted string with separators.
1787
+ * @example
1788
+ * // Basic usage
1789
+ * chunkString("1234567890", 3);
1790
+ * // ➔ "123 456 789 0"
1791
+ *
1792
+ * // Basic usage `reCountAfterSpace = false` (default)
1793
+ * chunkString("1234567890", 3, { separator: "-");
1794
+ * // ➔ "123-456-789-0"
1795
+ * chunkString("HelloWorld", 2, { separator: "_", reCountAfterSpace: false });
1796
+ * // ➔ "He_ll_oW_or_ld"
1797
+ *
1798
+ * // Usage with reCountAfterSpace = true:
1799
+ * // Multiple spaces are normalized to single spaces before processing.
1800
+ * chunkString("AB CD EF GH", 2, { separator: "-", reCountAfterSpace: true });
1801
+ * // ➔ "AB-CD EF-GH" (after normalization to "AB CD EF GH")
1802
+ * // Words "AB" and "CD" form a group and are joined by "-", "EF" and "GH" form another group.
1803
+ * // The groups "AB-CD" and "EF-GH" are then joined by a space.
1804
+ *
1805
+ * // Another usage with reCountAfterSpace = true:
1806
+ * chunkString("ABC DEF GHI JKL", 3, { separator: "-", reCountAfterSpace: true });
1807
+ * // ➔ "ABC-DEF-GHI JKL"
1808
+ * // Words "ABC", "DEF", "GHI" form a group and are joined by "-".
1809
+ * // The word "JKL" forms its own group (as it's the last word and completes no other group).
1810
+ * // The groups "ABC-DEF-GHI" and "JKL" are then joined by a space.
1811
+ */
1812
+ declare function chunkString(subject: string, limiter: number, options?: ChunkStringOptions): string;
1813
+ type TruncateStringOptions = {
1814
+ /** ***Maximum length of the truncated string **(default: `10`)**.***
1815
+ *
1816
+ * @default 10
1817
+ */
1818
+ length?: number;
1819
+ /** ***String to append if truncation occurs.***
1820
+ *
1821
+ * - Will be trimmed first; defaults to `"..."` if empty.
1822
+ *
1823
+ * @default "..."
1824
+ */
1825
+ ending?: string;
1826
+ /** ***Whether to trim the input string before truncation ***(default: `true`)***.***
1827
+ *
1828
+ * @default true
1829
+ */
1830
+ trim?: boolean;
1831
+ };
1832
+ /** ----------------------------------------------------------
1833
+ * * ***Utility: `truncateString`.***
1834
+ * ----------------------------------------------------------
1835
+ * **Features:**
1836
+ * - Truncates a string to a specified length and optionally appends an ending.
1837
+ * - Supports trimming the input before truncation.
1838
+ * - If truncation occurs, trailing spaces before the ending are removed.
1839
+ * - The `ending` parameter is always trimmed first; if empty, it defaults to `"..."`.
1840
+ * @param {string|null|undefined} text
1841
+ * ***The input string to truncate, behavior:***
1842
+ * - If `null`, `undefined`, or empty after trim, returns `""`.
1843
+ * @param {TruncateStringOptions} [options]
1844
+ * ***Optional settings:***
1845
+ * - `length` (number, default 10): Maximum length of the truncated string.
1846
+ * - `ending` (string, default `"..."`): String to append if truncation occurs.
1847
+ * - `trim` (boolean, default `true`): Whether to trim the input before truncation.
1848
+ * @returns {string} The truncated string with optional trimming and ending, returns `""` if input is empty or length < 1.
1849
+ * @throws **{@link TypeError | `TypeError`}** if `options.length` is not a finite number, or if `options.ending` is not a string, or if `options.trim` is not a boolean.
1850
+ * @example
1851
+ * truncateString("hello world", { length: 5 });
1852
+ * // ➔ "hello..."
1853
+ * truncateString("hello world", { length: 5, ending: "---" });
1854
+ * // ➔ "hello---"
1855
+ * truncateString("hello world", { length: 5, ending: " " });
1856
+ * // ➔ "hello..." (ending trimmed to default)
1857
+ * truncateString("hello world", { length: 5, ending: " !!! " });
1858
+ * // ➔ "hello!!!" (ending trimmed)
1859
+ * truncateString(" long data string ", { length: 8, ending: "...", trim: true });
1860
+ * // ➔ "long dat..."
1861
+ * truncateString(" long data string ", { length: 8, ending: "...", trim: false });
1862
+ * // ➔ " long ..."
1863
+ * truncateString(null, { length: 5 });
1864
+ * // ➔ ""
1865
+ */
1866
+ declare const truncateString: (text: string | null | undefined, options?: TruncateStringOptions) => string;
1867
+ /** ----------------------------------------------------------------------
1868
+ * * ***Options for formatting dates with `date-fns/format`.***
1869
+ * ----------------------------------------------------------------------
1870
+ *
1871
+ * Extends the base **{@link FormatOptions | *`FormatOptions`*}** (without **`locale`**) with extra options
1872
+ * for handling output formatting, localization, and parsing non-standard inputs.
1873
+ *
1874
+ * @private ***types for {@link formatDateFns}.***
1875
+ */
1876
+ type FormatDateFnsOptions = Prettify<OmitStrict<FormatOptions, "locale", true, false> & {
1877
+ /** ------------------------------------------------------------
1878
+ * * ***Output format string passed to `date-fns/format`.***
1879
+ * ------------------------------------------------------------
1880
+ * - **Behavior:**
1881
+ * - Determines how the date will be rendered.
1882
+ * - Uses the full power of `date-fns` tokens.
1883
+ * - ***Default Value***: `"dd MMM yyyy - HH:mm:ss"`.
1884
+ * @example
1885
+ * "dd MMMM yyyy, HH:mm:ss" // ➔ "03 September 2025, 10:25:42"
1886
+ * @default "dd MMM yyyy - HH:mm:ss"
1887
+ */
1888
+ format?: string;
1889
+ /** ------------------------------------------------------------
1890
+ * * ***Locale used for formatting.***
1891
+ * ------------------------------------------------------------
1892
+ * - **Behavior:**
1893
+ * - If `string`: only accepts `"id"` (Indonesian) or `"en"` (English) - **(default)**.
1894
+ * - If `Locale`: accepts a locale object from `date-fns/locale`.
1895
+ * - ***Default Value***: `"en"`.
1896
+ * ```ts
1897
+ * import { ar } from "date-fns/locale";
1898
+ *
1899
+ * formatDateFns(new Date(), {
1900
+ * locale: ar,
1901
+ * format: "dd MMMM yyyy"
1902
+ * });
1903
+ * // ➔ "03 سبتمبر 2025"
1904
+ * ```
1905
+ * @default "en"
1906
+ */
1907
+ locale?: "id" | "en" | AnyString | Locale;
1908
+ /** ------------------------------------------------------------
1909
+ * * ***Input locale used when parsing non-standard string dates.***
1910
+ * ------------------------------------------------------------
1911
+ * - **Behavior:**
1912
+ * - Required if `date` is a **localized string**
1913
+ * (e.g. `"03 Mei 2025 10:25:42"` in Indonesian).
1914
+ * - Same accepted types as `locale` parameter.
1915
+ * - ***Default Value***: `"en"`.
1916
+ * ```ts
1917
+ * import { ar } from "date-fns/locale";
1918
+ *
1919
+ * formatDateFns("03 مايو 2025 10:25:42", {
1920
+ * inputFormat: "dd MMMM yyyy HH:mm:ss",
1921
+ * inputLocale: ar,
1922
+ * format: "PPpp"
1923
+ * });
1924
+ * // ➔ "May 3, 2025 at 10:25:42 AM"
1925
+ * ```
1926
+ * @default "en"
1927
+ */
1928
+ inputLocale?: "id" | "en" | AnyString | Locale;
1929
+ /** ------------------------------------------------------------
1930
+ * * ***Input format string for parsing non-ISO string dates.***
1931
+ * ------------------------------------------------------------
1932
+ * - **Behavior:**
1933
+ * - Required if `date` is **not ISO-8601** and not a native `Date`.
1934
+ * - Works together with `inputLocale` parameter.
1935
+ * - ***Default Value***: `undefined`.
1936
+ * @default undefined
1937
+ * @example
1938
+ * "dd MMMM yyyy HH:mm:ss" // ➔ "03 May 2025 10:25:42"
1939
+ */
1940
+ inputFormat?: string;
1941
+ }>;
1942
+ /** ----------------------------------------------------------
1943
+ * * ***Utility: `formatDateFns`.***
1944
+ * ----------------------------------------------------------
1945
+ * **Formats a date into a human-readable string using `date-fns`.**
1946
+ * - **Features:**
1947
+ * - Supports custom output formats using `date-fns/format`.
1948
+ * - Can parse localized non-ISO strings via `inputFormat` & `inputLocale`.
1949
+ * - Supports `locale` as `"id"`, `"en"` or `date-fns` `Locale` objects (like `id` or `enUS`).
1950
+ * - Returns `null` if the date is invalid, not provided, or parsing fails.
1951
+ * @param {string | Date | null | undefined} date
1952
+ * ***The date input to format, can be:***
1953
+ * - A `Date` object.
1954
+ * - An ISO string (e.g. `"2024-01-01T12:00:00Z"`).
1955
+ * - A localized string (requires `inputFormat` + `inputLocale`).
1956
+ * @param {FormatDateFnsOptions} [options] ***Options for formatting and parsing.***
1957
+ * @param {FormatDateFnsOptions["format"]} [options.format="dd MMM yyyy - HH:mm:ss"]
1958
+ * ***The output format string (passed to `date-fns/format`), e.g:***
1959
+ * - `"dd MMMM yyyy, HH:mm:ss" ➔ "14 Juli 2025, 17:25:42"`.
1960
+ * @param {FormatDateFnsOptions["locale"]} [options.locale="id"]
1961
+ * The output locale. If string, only `"id"` (Indonesian) or `"en"` (English)
1962
+ * is recognized. Or you can pass a `date-fns` `Locale` object.
1963
+ * - Example:
1964
+ * ```ts
1965
+ * import { ar } from "date-fns/locale";
1966
+ * formatDateFns(new Date(), { locale: ar, format: "PPPppp" });
1967
+ * ```
1968
+ * @param {FormatDateFnsOptions["inputLocale"]} [options.inputLocale]
1969
+ * Required if `date` is a localized non-ISO string. Used with `inputFormat`.
1970
+ * - Example for Indonesian string:
1971
+ * ```ts
1972
+ * formatDateFns("14 Juli 2025 10:25:42", { inputFormat: "dd MMMM yyyy HH:mm:ss", inputLocale: "id" });
1973
+ * ```
1974
+ * @param {FormatDateFnsOptions["inputFormat"]} [options.inputFormat]
1975
+ * The format string to parse `date` if it is a non-ISO string.
1976
+ * Required together with `inputLocale`.
1977
+ * @returns {string | null} A formatted date string or `null` if input is invalid.
1978
+ * @example
1979
+ * formatDateFns(new Date());
1980
+ * // ➔ "14 Jul 2025 - 17:25:42"
1981
+ * formatDateFns("2025-07-14T10:25:42Z", { format: "dd/MM/yyyy", locale: "en" });
1982
+ * // ➔ "14/07/2025"
1983
+ * formatDateFns("14 Juli 2025 10:25:42", {
1984
+ * inputFormat: "dd MMMM yyyy HH:mm:ss",
1985
+ * inputLocale: "id",
1986
+ * format: "yyyy-MM-dd"
1987
+ * });
1988
+ * // ➔ "2025-07-14"
1989
+ * formatDateFns(null);
1990
+ * // ➔ null
1991
+ */
1992
+ declare const formatDateFns: (date: string | Date | null | undefined, options?: FormatDateFnsOptions) => string | null;
1993
+ /** -------------------------------------------------------------
1994
+ * * ***Supported IETF BCP-47 locale codes for Intl API.***
1995
+ * -------------------------------------------------------------
1996
+ * **This type ensures proper autocompletion & validation in TS
1997
+ * but does not restrict at runtime (must validate separately).**
1998
+ * - **Includes:**
1999
+ * - Major global locales (`en-US`, `fr-FR`, `zh-CN`, `etc`)
2000
+ * - Regional & minor locales (`mi-NZ`, `rw-RW`, `bi-VU`, `etc`)
2001
+ * - Useful for `Intl.DateTimeFormat`, `Intl.NumberFormat`, `etc`.
2002
+ * - Still allows fallback via `({} & string)` for arbitrary locales.
2003
+ * @example
2004
+ * const locale: SupportedLocales = "fr-CA";
2005
+ * new Intl.DateTimeFormat(locale).format(new Date());
2006
+ */
2007
+ type SupportedLocales = "en-US" | "en-GB" | "en-AU" | "en-CA" | "en-NZ" | "en-ZA" | "en-IN" | "en-IE" | "en-SG" | "en-HK" | "en-PH" | "en-MY" | "en-PK" | "en-KE" | "en-TZ" | "en-NG" | "en-LK" | "en-BW" | "en-ZM" | "id-ID" | "ms-MY" | "th-TH" | "vi-VN" | "tl-PH" | "ms-BN" | "zh-CN" | "zh-HK" | "zh-TW" | "zh-SG" | "zh-MO" | "ja-JP" | "ko-KR" | "fr-FR" | "fr-CA" | "fr-BE" | "fr-CH" | "fr-LU" | "fr-MA" | "fr-SN" | "fr-CM" | "fr-CI" | "fr-HT" | "fr-DZ" | "fr-TN" | "fr-ML" | "fr-NC" | "fr-PF" | "fr-GP" | "fr-MQ" | "fr-GF" | "de-DE" | "de-AT" | "de-CH" | "de-LU" | "de-LI" | "es-ES" | "es-MX" | "es-AR" | "es-CL" | "es-CO" | "es-PE" | "es-UY" | "es-VE" | "es-CR" | "es-EC" | "es-GT" | "es-HN" | "es-NI" | "es-PA" | "es-PR" | "es-SV" | "es-BO" | "es-PY" | "es-DO" | "es-CU" | "es-GQ" | "pt-BR" | "pt-PT" | "pt-MZ" | "pt-AO" | "pt-GW" | "pt-CV" | "pt-ST" | "it-IT" | "it-CH" | "it-SM" | "it-VA" | "nl-NL" | "nl-BE" | "nl-SR" | "nl-AW" | "nl-CW" | "ru-RU" | "uk-UA" | "kk-KZ" | "uz-UZ" | "ky-KG" | "tt-RU" | "ba-RU" | "cv-RU" | "sah-RU" | "pl-PL" | "cs-CZ" | "sk-SK" | "hu-HU" | "sl-SI" | "sv-SE" | "da-DK" | "no-NO" | "fi-FI" | "is-IS" | "ro-RO" | "bg-BG" | "hr-HR" | "sr-RS" | "mk-MK" | "bs-BA" | "me-ME" | "sq-AL" | "sq-XK" | "el-GR" | "el-CY" | "tr-TR" | "tr-CY" | "he-IL" | "ar-SA" | "ar-AE" | "ar-EG" | "ar-MA" | "ar-JO" | "ar-LB" | "ar-QA" | "ar-KW" | "ar-OM" | "ar-BH" | "ar-IQ" | "ar-LY" | "ar-TN" | "ar-YE" | "ar-SY" | "ar-PS" | "ar-SD" | "ar-DZ" | "ar-MR" | "ar-DJ" | "ar-SO" | "lt-LT" | "lv-LV" | "et-EE" | "hi-IN" | "bn-BD" | "pa-IN" | "ta-IN" | "te-IN" | "ml-IN" | "gu-IN" | "kn-IN" | "mr-IN" | "or-IN" | "as-IN" | "ne-IN" | "fa-IR" | "ur-PK" | "ps-AF" | "dv-MV" | "sw-KE" | "sw-TZ" | "zu-ZA" | "af-ZA" | "xh-ZA" | "ss-SZ" | "ts-ZA" | "tn-BW" | "ny-MW" | "lo-LA" | "mt-MT" | "ga-IE" | "cy-GB" | "ne-NP" | "si-LK" | "am-ET" | "om-ET" | "ti-ER" | "km-KH" | "my-MM" | "mn-MN" | "tg-TJ" | "tk-TM" | "hy-AM" | "ka-GE" | "az-AZ" | "be-BY" | "mo-MD" | "ro-MD" | "ht-HT" | "jw-ID" | "su-ID" | "to-TO" | "sm-WS" | "mi-NZ" | "bi-VU" | "fj-FJ" | "ty-PF" | "pau-PW" | "niu-NU" | "ck-CK" | "rw-RW" | "ln-CD" | "kg-CD" | "ha-NE" | "yo-NG" | "ig-NG" | "ak-GH" | "lg-UG" | "bo-CN" | "dz-BT" | "iu-CA" | "kl-GL" | "cv-RU" | "pap-AW" | "chr-US" | "haw-US" | "gv-IM" | "gd-GB" | "br-FR" | "co-FR" | "rm-CH" | "wa-BE" | "lb-LU" | "fur-IT" | "sc-IT" | "vec-IT" | "nap-IT" | "gsw-CH" | "rha-CH" | ({} & string);
2008
+ /** ----------------------------------------------------------------
2009
+ * * ***Options for formatting dates with `Intl.DateTimeFormat`.***
2010
+ * ----------------------------------------------------------------
2011
+ * **Extends the native
2012
+ * **{@link Intl.DateTimeFormatOptions | `Intl.DateTimeFormatOptions`}** with
2013
+ * an additional `locale` property that is validated against **{@link SupportedLocales | `SupportedLocales`}**.**
2014
+ * @private ***types for {@link formatDateIntl}.***
2015
+ */
2016
+ type FormatDateIntlOptions = Intl.DateTimeFormatOptions & {
2017
+ /** ------------------------------------------------------------
2018
+ * * ***Locale for date formatting.***
2019
+ * ------------------------------------------------------------
2020
+ * - **Behavior:**
2021
+ * - Must be a valid [***BCP-47 locale***](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locales_argument),
2022
+ * validated against {@link SupportedLocales | **`SupportedLocales`**}.
2023
+ * - If `locale` is `undefined` or an empty string (after trimming),
2024
+ * it will **default to `"en-US"`**.
2025
+ * @default "en-US"
2026
+ * @example
2027
+ * { year: "numeric", month: "long" }
2028
+ * // Unset locale, default locale ➔ "en-US"
2029
+ * { locale: "fr-FR", ...}
2030
+ * // Explicit locale
2031
+ * { locale: " ", ...}
2032
+ * // Empty string locale ➔ defaults to "en-US"
2033
+ * { locale: " en-GB ", ...}
2034
+ * // Value will trimming ➔ "en-GB"
2035
+ *
2036
+ */
2037
+ locale?: SupportedLocales;
2038
+ };
2039
+ /** ----------------------------------------------------------
2040
+ * * ***Utility: `formatDateIntl`.***
2041
+ * ----------------------------------------------------------
2042
+ * **Formats a date using the `Intl.DateTimeFormat` API.**
2043
+ * - **Features:**
2044
+ * - Supports custom locales (type-safe `SupportedLocales`).
2045
+ * - Accepts additional `Intl.DateTimeFormatOptions` like `timeZone`, `hour12`, etc.
2046
+ * - Defaults to `"en-US"` if `locale` is not provided or is an empty string.
2047
+ * - Returns `null` if the date is invalid, not provided, or options are invalid.
2048
+ * @param {string | Date | null | undefined} date
2049
+ * ***The date to format.***
2050
+ * - Can be a `Date` object or an ISO string.
2051
+ * - If invalid or not provided, returns `null`.
2052
+ * @param {FormatDateIntlOptions} [options] ***Optional formatting options for `Intl.DateTimeFormat`, use `locale` to specify the language & region format.***
2053
+ * @returns {string | null}
2054
+ * - Formatted date string.
2055
+ * - Returns `null` if date is invalid or options are of wrong type.
2056
+ * @example
2057
+ * formatDateIntl(new Date());
2058
+ * // ➔ "7/14/2025"
2059
+ * formatDateIntl("2025-07-14T00:00:00Z", { locale: "fr-FR", dateStyle: "long" });
2060
+ * // ➔ "14 juillet 2025"
2061
+ * formatDateIntl(null);
2062
+ * // ➔ null
2063
+ * formatDateIntl(new Date(), { timeZone: "UTC", hour: "2-digit", minute: "2-digit" });
2064
+ * // ➔ "01:30 AM"
2065
+ */
2066
+ declare const formatDateIntl: (date: string | Date | null | undefined, options?: FormatDateIntlOptions) => string | null;
2067
+ /** ----------------------------------------------------------
2068
+ * * ***Utility: `formatDateTime`.***
2069
+ * ----------------------------------------------------------
2070
+ * **Formats a date and time into a custom string format.**
2071
+ * - **Features:**
2072
+ * - Supports only `YYYY`, `MM`, `DD`, `hh`, `mm`, and `ss` as placeholders.
2073
+ * - Uses a simple string replace (no locale).
2074
+ * - Returns `null` if the date is invalid or not provided.
2075
+ * - Defaults to `"YYYY-MM-DD hh:mm:ss"` format if none is specified.
2076
+ * @param {string | Date | null| undefined} date - The date to format.
2077
+ * @param {string} [format="YYYY-MM-DD hh:mm:ss"] - The desired date format, if format is `null` or `undefined` will force to defaultValue, defaultValue is: `"YYYY-MM-DD hh:mm:ss"`.
2078
+ * @returns {string | null} The formatted date string or `null` if invalid.
2079
+ * @example
2080
+ * formatDateTime(new Date());
2081
+ * // ➔ "2024-02-09 14:30:45" (example output with current time)
2082
+ * formatDateTime("2023-07-01T14:30:45");
2083
+ * // ➔ "2023-07-01 14:30:45"
2084
+ * formatDateTime("2023-07-01T14:30:45", "DD/MM/YYYY");
2085
+ * // ➔ "01/07/2023"
2086
+ * formatDateTime("2023-07-01T14:30:45", "YYYY/MM/DD hh-mm-ss");
2087
+ * // ➔ "2023/07/01 14-30-45"
2088
+ * formatDateTime("2023-07-01T14:30:45", "hh:mm");
2089
+ * // ➔ "14:30"
2090
+ * formatDateTime("2023-07-01T14:30:45", "DATE: YYYY.MM.DD");
2091
+ * // ➔ "DATE: 2023.07.01"
2092
+ * formatDateTime("2023-07-01T14:30:45", "Year: YYYY, Time: hh:mm:ss");
2093
+ * // ➔ "Year: 2023, Time: 14:30:45"
2094
+ * formatDateTime("2023-07-01T14:30:45", "YYYY-MM");
2095
+ * // ➔ "2023-07"
2096
+ * formatDateTime("2023-07-01T14:30:45", "YYYYYYYY");
2097
+ * // ➔ "20232023"
2098
+ * formatDateTime("2023-07-01T14:30:45", "hh:mm:ss:ss");
2099
+ * // ➔ "14:30:45:45"
2100
+ * formatDateTime("invalid-date");
2101
+ * // ➔ null
2102
+ * formatDateTime(null);
2103
+ * // ➔ null
2104
+ * formatDateTime(undefined);
2105
+ * // ➔ null
2106
+ */
2107
+ declare const formatDateTime: (date: string | Date | null | undefined, format?: string) => string | null;
2108
+ /** ----------------------------------------------------------
2109
+ * * ***Utility: `getGMTOffset`.***
2110
+ * ----------------------------------------------------------
2111
+ * **Returns the formatted GMT offset (e.g., `+0700`, `-0500`) for a given date.**
2112
+ * - **Features:**
2113
+ * - If `date` is **not provided** or empty string, it defaults to the current date/time.
2114
+ * - If `date` is **invalid** or of wrong type (like object or number), it returns `"0"`.
2115
+ * - The returned string follows the **GMT offset format** (`±HHMM`), where:
2116
+ * - `±` is `+` if ahead of UTC, `-` if behind.
2117
+ * - `HH` is two-digit hours.
2118
+ * - `MM` is two-digit minutes.
2119
+ * @param {string | Date | null} [date]
2120
+ * ***The date to get the GMT offset from.***
2121
+ * - Accepts `Date` object or ISO date string (e.g., `"2024-01-01T12:00:00Z"`).
2122
+ * - If `null`, `undefined`, or empty string, uses current system date.
2123
+ * - If invalid date or wrong type (like `123` or `{}`), returns `"0"`.
2124
+ * @returns {string} The GMT offset string in format `±HHMM`,
2125
+ * e.g. `"+0700"`, `"-0530"`, or `"0"` if invalid.
2126
+ * @example
2127
+ * getGMTOffset();
2128
+ * // ➔ "+0700" (depends on your system timezone)
2129
+ * getGMTOffset(new Date("2024-02-09T12:00:00Z"));
2130
+ * // ➔ "+0000"
2131
+ * getGMTOffset("2024-02-09");
2132
+ * // ➔ "+0700" (depends on your system timezone)
2133
+ * getGMTOffset("invalid-date");
2134
+ * // ➔ "0"
2135
+ * getGMTOffset(123);
2136
+ * // ➔ "0"
2137
+ */
2138
+ declare const getGMTOffset: (date?: string | Date | null) => string;
2139
+ export { truncateString as a, formatPhoneNumber as c, formatDateFns as i, formatNumber as l, formatDateTime as n, chunkString as o, formatDateIntl as r, censorEmail as s, getGMTOffset as t, formatCurrency as u };