@rzl-zone/utils-js 3.12.0 → 3.12.1-beta.1

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