@rzl-zone/utils-js 3.13.1 → 3.14.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (281) hide show
  1. package/README.md +7 -6
  2. package/dist/.references/index.d.cts +2 -1
  3. package/dist/.references/index.d.ts +2 -1
  4. package/dist/AbortError-DK6kpzbu.cjs +26 -0
  5. package/dist/AbortError-DK6kpzbu.cjs.map +1 -0
  6. package/dist/AbortError-DVT8lAKn.js +20 -0
  7. package/dist/AbortError-DVT8lAKn.js.map +1 -0
  8. package/dist/{assertIsArray-HgzPQIAM.js → assertIsArray-CG7L7vlt.js} +3 -3
  9. package/dist/assertIsArray-CG7L7vlt.js.map +1 -0
  10. package/dist/{assertIsArray-CeXL4xv5.cjs → assertIsArray-CtCRD-_G.cjs} +5 -5
  11. package/dist/assertIsArray-CtCRD-_G.cjs.map +1 -0
  12. package/dist/assertIsPlainObject-DPZLj-Ho.cjs +26 -0
  13. package/dist/assertIsPlainObject-DPZLj-Ho.cjs.map +1 -0
  14. package/dist/assertIsPlainObject-j9bDqNLo.js +20 -0
  15. package/dist/assertIsPlainObject-j9bDqNLo.js.map +1 -0
  16. package/dist/{assertIsString-CY_WkCLr.js → assertIsString-CHIwE12y.js} +4 -4
  17. package/dist/assertIsString-CHIwE12y.js.map +1 -0
  18. package/dist/{assertIsString-DUrVt82d.cjs → assertIsString-CjE9kbQ_.cjs} +6 -6
  19. package/dist/assertIsString-CjE9kbQ_.cjs.map +1 -0
  20. package/dist/assertions/index.cjs +14 -12
  21. package/dist/assertions/index.cjs.map +1 -1
  22. package/dist/assertions/index.d.cts +2 -2
  23. package/dist/assertions/index.d.ts +2 -2
  24. package/dist/assertions/index.js +10 -8
  25. package/dist/assertions/index.js.map +1 -1
  26. package/dist/conversions/index.cjs +6 -6
  27. package/dist/conversions/index.d.cts +2 -2
  28. package/dist/conversions/index.d.ts +2 -2
  29. package/dist/conversions/index.js +6 -6
  30. package/dist/conversions-BFz6MKaV.cjs +449 -0
  31. package/dist/conversions-BFz6MKaV.cjs.map +1 -0
  32. package/dist/{conversions-1s7xMBe_.js → conversions-Ben5p5Ts.js} +43 -40
  33. package/dist/conversions-Ben5p5Ts.js.map +1 -0
  34. package/dist/errors/index.cjs +13 -0
  35. package/dist/errors/index.d.cts +180 -0
  36. package/dist/errors/index.d.ts +180 -0
  37. package/dist/errors/index.js +11 -0
  38. package/dist/events/index.cjs +10 -9
  39. package/dist/events/index.cjs.map +1 -1
  40. package/dist/events/index.d.cts +185 -100
  41. package/dist/events/index.d.ts +185 -100
  42. package/dist/events/index.js +9 -8
  43. package/dist/events/index.js.map +1 -1
  44. package/dist/formatter-ekJQF_bA-BepnCBkQ.cjs +67 -0
  45. package/dist/formatter-ekJQF_bA-BepnCBkQ.cjs.map +1 -0
  46. package/dist/formatter-ekJQF_bA-xLD9mGk4.js +55 -0
  47. package/dist/formatter-ekJQF_bA-xLD9mGk4.js.map +1 -0
  48. package/dist/formatters/index.cjs +2 -2
  49. package/dist/formatters/index.d.cts +2 -2
  50. package/dist/formatters/index.d.ts +2 -2
  51. package/dist/formatters/index.js +2 -2
  52. package/dist/{formatters-C6cVZBbG.js → formatters-BAbGsnYA.js} +78 -71
  53. package/dist/formatters-BAbGsnYA.js.map +1 -0
  54. package/dist/formatters-zd0Gs4Cs.cjs +436 -0
  55. package/dist/formatters-zd0Gs4Cs.cjs.map +1 -0
  56. package/dist/generators/index.cjs +37 -31
  57. package/dist/generators/index.cjs.map +1 -1
  58. package/dist/generators/index.d.cts +2 -2
  59. package/dist/generators/index.d.ts +2 -2
  60. package/dist/generators/index.js +29 -23
  61. package/dist/generators/index.js.map +1 -1
  62. package/dist/hasOwnProp-CVIhlD1i.js +47 -0
  63. package/dist/hasOwnProp-CVIhlD1i.js.map +1 -0
  64. package/dist/hasOwnProp-D9Tpgokd.cjs +53 -0
  65. package/dist/hasOwnProp-D9Tpgokd.cjs.map +1 -0
  66. package/dist/{index-RNQBTK8A.d.cts → index-9JsU_wMu.d.ts} +1375 -937
  67. package/dist/{index-ORbo-7zA.d.cts → index-BP3sUrAx.d.ts} +242 -133
  68. package/dist/{index-BG8wdusZ.d.cts → index-BVovC-yK.d.cts} +229 -200
  69. package/dist/index-C1X6ha9s.d.cts +1041 -0
  70. package/dist/index-CcPQZ41G.d.cts +1103 -0
  71. package/dist/index-CjpbuJF4.d.ts +2424 -0
  72. package/dist/index-CssrQyHh.d.cts +2424 -0
  73. package/dist/index-DZHiYYR7.d.cts +2179 -0
  74. package/dist/index-DZHiYYR7.d.ts +2179 -0
  75. package/dist/index-DlyDmXUo.d.ts +1103 -0
  76. package/dist/index-Dm4a___O.d.ts +1041 -0
  77. package/dist/{index-CRz9rSZL.d.ts → index-Dwduk7ez.d.cts} +1375 -937
  78. package/dist/{index-DPJ-e2JZ.d.ts → index-I5V6RbZM.d.cts} +1592 -790
  79. package/dist/{index-B5EBAgmC.d.cts → index-hOqBIL7F.d.ts} +1592 -790
  80. package/dist/{index-B1VQ6USF.d.ts → index-jyuOZMX7.d.ts} +229 -200
  81. package/dist/{index-ORbo-7zA.d.ts → index-lI0b7iUz.d.cts} +242 -133
  82. package/dist/{isBigInt-y7s3rsKc.js → isBigInt-Cez32M69.js} +2 -2
  83. package/dist/isBigInt-Cez32M69.js.map +1 -0
  84. package/dist/{isBigInt-BVj0M5pq.cjs → isBigInt-YgpNKTbA.cjs} +2 -2
  85. package/dist/isBigInt-YgpNKTbA.cjs.map +1 -0
  86. package/dist/{isEmptyString-BYMz_wt9.js → isEmptyString-C9QLWjx2.js} +4 -4
  87. package/dist/isEmptyString-C9QLWjx2.js.map +1 -0
  88. package/dist/{isEmptyString-C8PYNPgw.cjs → isEmptyString-O4TFe1Ao.cjs} +5 -5
  89. package/dist/isEmptyString-O4TFe1Ao.cjs.map +1 -0
  90. package/dist/isEmptyValue-CFExALXZ.cjs +54 -0
  91. package/dist/isEmptyValue-CFExALXZ.cjs.map +1 -0
  92. package/dist/isEmptyValue-kCjnLjbN.js +36 -0
  93. package/dist/isEmptyValue-kCjnLjbN.js.map +1 -0
  94. package/dist/{isFinite-DeDaBDr2.cjs → isFinite-B_hHbDpa.cjs} +6 -6
  95. package/dist/isFinite-B_hHbDpa.cjs.map +1 -0
  96. package/dist/{isFinite-BEJFOv6B.js → isFinite-ZvNhyHlF.js} +5 -5
  97. package/dist/isFinite-ZvNhyHlF.js.map +1 -0
  98. package/dist/{isInteger-DEDbBGez.js → isInteger-aZgzTTZG.js} +4 -4
  99. package/dist/isInteger-aZgzTTZG.js.map +1 -0
  100. package/dist/{isInteger-CQLThJOR.cjs → isInteger-dnc6W63Z.cjs} +4 -4
  101. package/dist/isInteger-dnc6W63Z.cjs.map +1 -0
  102. package/dist/isNumber-BCWD4dW0.js +20 -0
  103. package/dist/isNumber-BCWD4dW0.js.map +1 -0
  104. package/dist/isNumber-BkzwAe50.cjs +26 -0
  105. package/dist/isNumber-BkzwAe50.cjs.map +1 -0
  106. package/dist/isPlainObject-CAe_ElKO.d.cts +331 -0
  107. package/dist/isPlainObject-CJvRG4Je.d.ts +331 -0
  108. package/dist/{isServer-q3o6cSwD.js → isServer-CQzrX5e0.js} +2 -2
  109. package/dist/isServer-CQzrX5e0.js.map +1 -0
  110. package/dist/{isServer-DmycqWsF.cjs → isServer-DhFaedeT.cjs} +2 -2
  111. package/dist/isServer-DhFaedeT.cjs.map +1 -0
  112. package/dist/{isEqual-DaPDxMyw.cjs → isTypedArray-DjADSu8q.cjs} +45 -13
  113. package/dist/isTypedArray-DjADSu8q.cjs.map +1 -0
  114. package/dist/{isEqual-DM4S_kWh.js → isTypedArray-DxsPKrLh.js} +29 -9
  115. package/dist/isTypedArray-DxsPKrLh.js.map +1 -0
  116. package/dist/{isValidDomain-B8Nukgw0.js → isValidDomain-CDtNOhMc.js} +13 -54
  117. package/dist/isValidDomain-CDtNOhMc.js.map +1 -0
  118. package/dist/{isValidDomain-ZbyeGOO9.cjs → isValidDomain-D_x7uNIu.cjs} +16 -69
  119. package/dist/isValidDomain-D_x7uNIu.cjs.map +1 -0
  120. package/dist/{assertIsBoolean-CWUs-I5l.js → logger-CLWnKRKE.js} +657 -587
  121. package/dist/logger-CLWnKRKE.js.map +1 -0
  122. package/dist/{assertIsBoolean-D41HrTB_.cjs → logger-CUacYy3D.cjs} +658 -612
  123. package/dist/logger-CUacYy3D.cjs.map +1 -0
  124. package/dist/{noop-BY43WaoU.cjs → noop-CjEbNsJL.cjs} +2 -2
  125. package/dist/noop-CjEbNsJL.cjs.map +1 -0
  126. package/dist/{noop-CjY8xVHv.js → noop-qxrcogt5.js} +2 -2
  127. package/dist/noop-qxrcogt5.js.map +1 -0
  128. package/dist/{normalizeSpaces-BhZp0U_6.cjs → normalizeSpaces-D0_Z4qnO.cjs} +6 -9
  129. package/dist/normalizeSpaces-D0_Z4qnO.cjs.map +1 -0
  130. package/dist/{normalizeSpaces-BoUDtq5P.js → normalizeSpaces-DAsxzBEQ.js} +4 -7
  131. package/dist/normalizeSpaces-DAsxzBEQ.js.map +1 -0
  132. package/dist/operations/index.cjs +152 -22
  133. package/dist/operations/index.cjs.map +1 -1
  134. package/dist/operations/index.d.cts +257 -35
  135. package/dist/operations/index.d.ts +257 -35
  136. package/dist/operations/index.js +142 -13
  137. package/dist/operations/index.js.map +1 -1
  138. package/dist/parsers/index.cjs +2 -2
  139. package/dist/parsers/index.d.cts +238 -180
  140. package/dist/parsers/index.d.ts +238 -180
  141. package/dist/parsers/index.js +2 -2
  142. package/dist/{parsers-B8KYXIjE.js → parsers-BBAE_xVM.js} +9 -8
  143. package/dist/parsers-BBAE_xVM.js.map +1 -0
  144. package/dist/{parsers-B_FPX35n.cjs → parsers-i8WEeMJl.cjs} +10 -9
  145. package/dist/parsers-i8WEeMJl.cjs.map +1 -0
  146. package/dist/{parsing-Bfaw85Hd.js → parsing-D9tbKQ0v.js} +3 -3
  147. package/dist/parsing-D9tbKQ0v.js.map +1 -0
  148. package/dist/{parsing-BCZGco7n.cjs → parsing-DGjB8cwr.cjs} +4 -4
  149. package/dist/parsing-DGjB8cwr.cjs.map +1 -0
  150. package/dist/predicates/index.cjs +43 -43
  151. package/dist/predicates/index.d.cts +3 -3
  152. package/dist/predicates/index.d.ts +3 -3
  153. package/dist/predicates/index.js +14 -14
  154. package/dist/{predicates-KlyOvBSC.js → predicates-C0dova7l.js} +45 -40
  155. package/dist/predicates-C0dova7l.js.map +1 -0
  156. package/dist/{predicates-8y28VrbT.cjs → predicates-Dd7To7B4.cjs} +89 -84
  157. package/dist/predicates-Dd7To7B4.cjs.map +1 -0
  158. package/dist/promises/index.cjs +27 -26
  159. package/dist/promises/index.cjs.map +1 -1
  160. package/dist/promises/index.d.cts +227 -75
  161. package/dist/promises/index.d.ts +227 -75
  162. package/dist/promises/index.js +27 -26
  163. package/dist/promises/index.js.map +1 -1
  164. package/dist/{punyCode-DnKi0qjS.cjs → punyCode-DHTLhGdD.cjs} +12 -12
  165. package/dist/punyCode-DHTLhGdD.cjs.map +1 -0
  166. package/dist/{punyCode-Dwto1RpA.js → punyCode-Deb1Mrkc.js} +12 -12
  167. package/dist/punyCode-Deb1Mrkc.js.map +1 -0
  168. package/dist/{removeSpaces--8NW-HSx.js → removeSpaces-BPnsdRN0.js} +4 -4
  169. package/dist/removeSpaces-BPnsdRN0.js.map +1 -0
  170. package/dist/{removeSpaces-CmrrkeXz.cjs → removeSpaces-CN3pxBz_.cjs} +7 -7
  171. package/dist/removeSpaces-CN3pxBz_.cjs.map +1 -0
  172. package/dist/rzl-utils.global.js +13 -13
  173. package/dist/safeJsonParse-D1FLVTEM.cjs +209 -0
  174. package/dist/safeJsonParse-D1FLVTEM.cjs.map +1 -0
  175. package/dist/{safeJsonParse-OnUwG2El.js → safeJsonParse-DEVKNDSn.js} +29 -28
  176. package/dist/safeJsonParse-DEVKNDSn.js.map +1 -0
  177. package/dist/safeStableStringify-C5HHKUdn.cjs +125 -0
  178. package/dist/safeStableStringify-C5HHKUdn.cjs.map +1 -0
  179. package/dist/{safeStableStringify-B2KTTS3r.js → safeStableStringify-DfwxmiWn.js} +20 -13
  180. package/dist/safeStableStringify-DfwxmiWn.js.map +1 -0
  181. package/dist/strings/index.cjs +26 -30
  182. package/dist/strings/index.cjs.map +1 -1
  183. package/dist/strings/index.d.cts +2 -2
  184. package/dist/strings/index.d.ts +2 -2
  185. package/dist/strings/index.js +13 -17
  186. package/dist/strings/index.js.map +1 -1
  187. package/dist/tailwind/index.cjs +3 -3
  188. package/dist/tailwind/index.d.cts +3 -3
  189. package/dist/tailwind/index.d.ts +3 -3
  190. package/dist/tailwind/index.js +3 -3
  191. package/dist/{tailwind-DUuboq52.cjs → tailwind-BG7B0cDs.cjs} +59 -53
  192. package/dist/tailwind-BG7B0cDs.cjs.map +1 -0
  193. package/dist/{tailwind-CUdmv-oO.js → tailwind-tJNnFPsF.js} +38 -32
  194. package/dist/tailwind-tJNnFPsF.js.map +1 -0
  195. package/dist/{toStringArrayUnRecursive-OOHGazks.js → toStringArrayUnRecursive-D0WbLIRz.js} +9 -9
  196. package/dist/toStringArrayUnRecursive-D0WbLIRz.js.map +1 -0
  197. package/dist/toStringArrayUnRecursive-QLoaNX_-.cjs +51 -0
  198. package/dist/toStringArrayUnRecursive-QLoaNX_-.cjs.map +1 -0
  199. package/dist/urls/index.cjs +3 -3
  200. package/dist/urls/index.d.cts +635 -443
  201. package/dist/urls/index.d.ts +635 -443
  202. package/dist/urls/index.js +3 -3
  203. package/dist/{urls-BXT4Krsq.js → urls-EoWslGgg.js} +50 -41
  204. package/dist/urls-EoWslGgg.js.map +1 -0
  205. package/dist/urls-NCzPepe2.cjs +308 -0
  206. package/dist/urls-NCzPepe2.cjs.map +1 -0
  207. package/package.json +6 -6
  208. package/dist/assertIsArray-CeXL4xv5.cjs.map +0 -1
  209. package/dist/assertIsArray-HgzPQIAM.js.map +0 -1
  210. package/dist/assertIsBoolean-CWUs-I5l.js.map +0 -1
  211. package/dist/assertIsBoolean-D41HrTB_.cjs.map +0 -1
  212. package/dist/assertIsString-CY_WkCLr.js.map +0 -1
  213. package/dist/assertIsString-DUrVt82d.cjs.map +0 -1
  214. package/dist/conversions-1s7xMBe_.js.map +0 -1
  215. package/dist/conversions-B3Rf8uId.cjs +0 -446
  216. package/dist/conversions-B3Rf8uId.cjs.map +0 -1
  217. package/dist/formatters-C6cVZBbG.js.map +0 -1
  218. package/dist/formatters-aEAAuzjx.cjs +0 -429
  219. package/dist/formatters-aEAAuzjx.cjs.map +0 -1
  220. package/dist/index-CPCt6_Wq.d.cts +0 -765
  221. package/dist/index-CPCt6_Wq.d.ts +0 -765
  222. package/dist/index-DBwNa1iO.d.ts +0 -947
  223. package/dist/index-DPTYOQkn.d.cts +0 -947
  224. package/dist/index-Dig1fIhZ.d.cts +0 -1716
  225. package/dist/index-Dig1fIhZ.d.ts +0 -1716
  226. package/dist/isBigInt-BVj0M5pq.cjs.map +0 -1
  227. package/dist/isBigInt-y7s3rsKc.js.map +0 -1
  228. package/dist/isEmptyObject-BsHngDz4.cjs +0 -37
  229. package/dist/isEmptyObject-BsHngDz4.cjs.map +0 -1
  230. package/dist/isEmptyObject-DPGR9iPj.js +0 -25
  231. package/dist/isEmptyObject-DPGR9iPj.js.map +0 -1
  232. package/dist/isEmptyString-BYMz_wt9.js.map +0 -1
  233. package/dist/isEmptyString-C8PYNPgw.cjs.map +0 -1
  234. package/dist/isEmptyValue-BXf7f1jz.cjs +0 -30
  235. package/dist/isEmptyValue-BXf7f1jz.cjs.map +0 -1
  236. package/dist/isEmptyValue-D4OHTB3u.js +0 -24
  237. package/dist/isEmptyValue-D4OHTB3u.js.map +0 -1
  238. package/dist/isEqual-DM4S_kWh.js.map +0 -1
  239. package/dist/isEqual-DaPDxMyw.cjs.map +0 -1
  240. package/dist/isFinite-BEJFOv6B.js.map +0 -1
  241. package/dist/isFinite-DeDaBDr2.cjs.map +0 -1
  242. package/dist/isInteger-CQLThJOR.cjs.map +0 -1
  243. package/dist/isInteger-DEDbBGez.js.map +0 -1
  244. package/dist/isPlainObject-BwTkj3G0.d.cts +0 -339
  245. package/dist/isPlainObject-BwTkj3G0.d.ts +0 -339
  246. package/dist/isServer-DmycqWsF.cjs.map +0 -1
  247. package/dist/isServer-q3o6cSwD.js.map +0 -1
  248. package/dist/isTypedArray-BQLbLXsU.cjs +0 -43
  249. package/dist/isTypedArray-BQLbLXsU.cjs.map +0 -1
  250. package/dist/isTypedArray-XiBnifLN.js +0 -31
  251. package/dist/isTypedArray-XiBnifLN.js.map +0 -1
  252. package/dist/isValidDomain-B8Nukgw0.js.map +0 -1
  253. package/dist/isValidDomain-ZbyeGOO9.cjs.map +0 -1
  254. package/dist/noop-BY43WaoU.cjs.map +0 -1
  255. package/dist/noop-CjY8xVHv.js.map +0 -1
  256. package/dist/normalizeSpaces-BhZp0U_6.cjs.map +0 -1
  257. package/dist/normalizeSpaces-BoUDtq5P.js.map +0 -1
  258. package/dist/parsers-B8KYXIjE.js.map +0 -1
  259. package/dist/parsers-B_FPX35n.cjs.map +0 -1
  260. package/dist/parsing-BCZGco7n.cjs.map +0 -1
  261. package/dist/parsing-Bfaw85Hd.js.map +0 -1
  262. package/dist/predicates-8y28VrbT.cjs.map +0 -1
  263. package/dist/predicates-KlyOvBSC.js.map +0 -1
  264. package/dist/punyCode-DnKi0qjS.cjs.map +0 -1
  265. package/dist/punyCode-Dwto1RpA.js.map +0 -1
  266. package/dist/removeSpaces--8NW-HSx.js.map +0 -1
  267. package/dist/removeSpaces-CmrrkeXz.cjs.map +0 -1
  268. package/dist/safeJsonParse-OnUwG2El.js.map +0 -1
  269. package/dist/safeJsonParse-sFqVXf-e.cjs +0 -208
  270. package/dist/safeJsonParse-sFqVXf-e.cjs.map +0 -1
  271. package/dist/safeStableStringify-B2KTTS3r.js.map +0 -1
  272. package/dist/safeStableStringify-Cmi6GyWj.cjs +0 -106
  273. package/dist/safeStableStringify-Cmi6GyWj.cjs.map +0 -1
  274. package/dist/tailwind-CUdmv-oO.js.map +0 -1
  275. package/dist/tailwind-DUuboq52.cjs.map +0 -1
  276. package/dist/toStringArrayUnRecursive-OOHGazks.js.map +0 -1
  277. package/dist/toStringArrayUnRecursive-pfk2oP8C.cjs +0 -51
  278. package/dist/toStringArrayUnRecursive-pfk2oP8C.cjs.map +0 -1
  279. package/dist/urls-BL9C_yU3.cjs +0 -299
  280. package/dist/urls-BL9C_yU3.cjs.map +0 -1
  281. package/dist/urls-BXT4Krsq.js.map +0 -1
@@ -2,19 +2,18 @@
2
2
  * ========================================================================
3
3
  * @rzl-zone/utils-js
4
4
  * ------------------------------------------------------------------------
5
- * Version: `3.13.1`
5
+ * Version: `3.14.0-beta.0`
6
6
  * Author: `Rizalvin Dwiky <rizalvindwiky@gmail.com>`
7
7
  * Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/utils-js`
8
8
  * ========================================================================
9
9
  */
10
10
 
11
- import { FormatOptions, Locale } from "date-fns";
12
- import { AnyString, ExtractStrict, OmitStrict, OverrideTypes, Prettify } from "@rzl-zone/ts-types-plus";
11
+ import { A as OverrideTypes, N as Prettify, O as OmitStrict, c as ExtractStrict, i as AnyString } from "./index-DZHiYYR7.cjs";
13
12
  import { CountryCode, NumberFormat } from "libphonenumber-js";
13
+ import { FormatOptions, Locale } from "date-fns";
14
14
  type NegativeFormatOptionCustom = {
15
15
  /**
16
- * Custom formatter function for the final formatted negative string.
17
- * If provided, it ***OVERRIDES*** style & space entirely.
16
+ * * ***Custom formatter function for the final formatted negative string, if provided, it ***OVERRIDES*** style & space entirely.***
18
17
  */
19
18
  custom: (formatted: string) => string;
20
19
  style?: never;
@@ -22,394 +21,496 @@ type NegativeFormatOptionCustom = {
22
21
  };
23
22
  type NegativeFormatOptionUnCustom = {
24
23
  custom?: never;
25
- /** Use style & optional spacing for negative numbers.
24
+ /** ---------------------------------------------------------------------------
25
+ * * ***Use style & optional spacing for negative numbers.***
26
+ * ----------------------------------------------------------------------------
26
27
  *
27
28
  * @default "dash"
28
29
  */
29
30
  style?: "dash" | "brackets" | "abs";
30
- /** Whether to include space inside brackets or after dash.
31
+ /** ---------------------------------------------------------------------------
32
+ * * ***Whether to include space inside brackets or after dash.***
33
+ * ----------------------------------------------------------------------------
31
34
  *
32
- * Default: false
33
35
  * @default false
34
36
  */
35
37
  space?: boolean;
36
38
  };
37
- /** ---------------------------------------------------------------------------
39
+ /** -----------------------------------------------------------------------------
38
40
  * * ***Type for negative number formatting options.***
39
- * ---------------------------------------------------------------------------
41
+ * ------------------------------------------------------------------------------
40
42
  */
41
43
  type NegativeFormatOption = "dash" | "brackets" | "abs" | NegativeFormatOptionCustom | NegativeFormatOptionUnCustom;
42
- /** ---------------------------------------------------------------------------
44
+ /** -----------------------------------------------------------------------------
43
45
  * * ***Type Options for {@link formatCurrency|`formatCurrency`}.***
44
- * ---------------------------------------------------------------------------
46
+ * ------------------------------------------------------------------------------
45
47
  */
46
48
  type FormatCurrencyOptions = {
47
49
  /** ---------------------------------------------------------------------------
48
50
  * * ***Prefix currency string.***
49
- * ---------------------------------------------------------------------------
50
- *
51
+ * ----------------------------------------------------------------------------
51
52
  * **Does not auto-keep input symbols.**
52
- * - ***DefaultValue:** `""`.*
53
- * - **Example:** `"Rp "` ➔ `Rp 1.000`.
54
53
  *
54
+ * ---
55
+ * - DefaultValue: `""`.
56
+ * - Example: `"Rp "` ➔ `Rp 1.000`.
57
+ *
58
+ * ---
55
59
  * @default ""
56
60
  */
57
61
  suffixCurrency?: string;
58
62
  /** ---------------------------------------------------------------------------
59
63
  * * ***Thousands separator.***
60
- * ---------------------------------------------------------------------------
64
+ * ----------------------------------------------------------------------------
61
65
  *
62
- * - ***DefaultValue:** `"."`.*
63
- * - **Example:** `"."` ➔ `1.000.000`.
66
+ * - DefaultValue: `"."`.
67
+ * - Example: `"."` ➔ `1.000.000`.
64
68
  *
69
+ * ---
65
70
  * @default "."
66
71
  */
67
72
  separator?: string;
68
73
  /** ---------------------------------------------------------------------------
69
74
  * * ***Prefix currency string.***
70
- * ---------------------------------------------------------------------------
71
- *
75
+ * ----------------------------------------------------------------------------
72
76
  * **Whether to show decimals, if `false`, decimals are truncated.**
73
- * - ***DefaultValue:** `false`.*
74
77
  *
78
+ * ---
79
+ * - DefaultValue: `false`.
80
+ *
81
+ * ---
75
82
  * @default false
76
83
  */
77
84
  decimal?: boolean;
78
85
  /** ---------------------------------------------------------------------------
79
86
  * * ***Total decimal digits.***
80
- * ---------------------------------------------------------------------------
81
- *
87
+ * ----------------------------------------------------------------------------
82
88
  * **If `decimal: true` & `roundedDecimal: false`, simply cuts.**
83
- * - ***DefaultValue:** `2`.*
84
89
  *
90
+ * ---
91
+ * - DefaultValue: `2`.
92
+ *
93
+ * ---
85
94
  * @default 2
86
95
  */
87
96
  totalDecimal?: number;
88
97
  /** ---------------------------------------------------------------------------
89
98
  * * ***Actually append `suffixDecimal`.***
90
- * ---------------------------------------------------------------------------
99
+ * ----------------------------------------------------------------------------
91
100
  *
92
- * - ***DefaultValue:** `true`.*
101
+ * - DefaultValue: `true`.
93
102
  *
103
+ * ---
94
104
  * @default true
95
105
  */
96
106
  endDecimal?: boolean;
97
107
  /** ---------------------------------------------------------------------------
98
108
  * * ***Text appended after decimals.***
99
- * ---------------------------------------------------------------------------
109
+ * ----------------------------------------------------------------------------
100
110
  *
101
- * - ***DefaultValue:** `""`.*
102
- * - **Example:**
103
- * - `".-"` ➔ `1.000,00.-`.
104
- * - `" USD"` ➔ `1.000,00 USD`.
111
+ * - DefaultValue: `""`.
112
+ * - Example:
113
+ * - `".-"` ➔ `1.000,00.-`.
114
+ * - `" USD"` ➔ `1.000,00 USD`.
105
115
  *
116
+ * ---
106
117
  * @default ""
107
118
  */
108
119
  suffixDecimal?: string;
109
120
  /** ---------------------------------------------------------------------------
110
121
  * * ***Rounding mode for decimals.***
111
- * ---------------------------------------------------------------------------
122
+ * ----------------------------------------------------------------------------
112
123
  *
113
- * - **Behavior:**
124
+ * - Behavior:
114
125
  * - `"round"` ➔ nearest.
115
126
  * - `"ceil"` ➔ always up.
116
127
  * - `"floor"` ➔ always down.
117
128
  * - `false` ➔ truncate.
118
- * - ***DefaultValue:** `"round"`.*
129
+ * - DefaultValue: `"round"`.
119
130
  *
131
+ * ---
120
132
  * @default "round"
121
133
  */
122
134
  roundedDecimal?: "round" | "ceil" | "floor" | false;
123
135
  /** ---------------------------------------------------------------------------
124
136
  * * ***Decimal separator.***
125
- * ---------------------------------------------------------------------------
137
+ * ----------------------------------------------------------------------------
126
138
  *
127
- * - ***DefaultValue:** `","`.*
128
- * - **Example:** `","` ➔ `1.000,10`.
139
+ * - DefaultValue: `","`.
140
+ * - Example: `","` ➔ `1.000,10`.
129
141
  *
142
+ * ---
130
143
  * @default ","
131
144
  */
132
145
  separatorDecimals?: string;
133
146
  /** ---------------------------------------------------------------------------
134
147
  * * ***Negative formatting option.***
135
- * ---------------------------------------------------------------------------
148
+ * ----------------------------------------------------------------------------
149
+ * **Can be string (`"dash"` | `"brackets"` | `"abs"`) or object with custom formatter.**
136
150
  *
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"`.*
151
+ * ---
152
+ * - Behavior:
153
+ * - `"dash"` ➔ `-15.000`.
154
+ * - `"brackets"` ➔ `(15.000)`.
155
+ * - `"abs"` ➔ `15.000` (always positive).
156
+ * - Or object:
157
+ * `{
158
+ * style: "dash"|"brackets"|"abs",
159
+ * space: true|false,
160
+ * custom: (formatted) => string
161
+ * }`.
162
+ * - DefaultValue: `"dash"`.
149
163
  *
164
+ * ---
150
165
  * @default "dash"
151
166
  */
152
167
  negativeFormat?: NegativeFormatOption;
153
168
  /** ---------------------------------------------------------------------------
154
169
  * * ***Applies Indian Format.***
155
- * ---------------------------------------------------------------------------
170
+ * ----------------------------------------------------------------------------
156
171
  *
157
- * - **Behavior:**
158
- * - If `true`, formats as Indian: `12,34,567`.
159
- * - Also forces `separator: ","`, `separatorDecimals: "."`.
160
- * - ***DefaultValue:** `false`.*
172
+ * - Behavior:
173
+ * - If `true`, formats as Indian: `12,34,567`.
174
+ * - Also forces `separator: ","`, `separatorDecimals: "."`.
175
+ * - DefaultValue: `false`.
161
176
  *
177
+ * ---
162
178
  * @default false
163
179
  */
164
180
  indianFormat?: boolean;
165
181
  };
166
182
  /** -------------------------------------------------------
167
183
  * * ***Utility: `formatCurrency`.***
168
- * -------------------------------------------------------
184
+ * --------------------------------------------------------
169
185
  * **Formats a number or messy currency string into a
170
186
  * beautifully formatted currency string, with highly
171
187
  * customizable separators, decimal control, rounding,
172
188
  * 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)***.
189
+ *
190
+ * ---
191
+ * - **Highlights:**
192
+ * - ***Accepts:***
193
+ * - Pure numbers: `15300.95`.
194
+ * - Messy currency strings from **any locale**:
195
+ * - `"Rp 15.000,21"` ***(Indonesian / Euro)***.
196
+ * - `"$12,345.60"` ***(US)***.
197
+ * - `"CHF 12'345.60"` ***(Swiss)***.
198
+ * - `"1,23,456.78"` ***(Indian)***.
181
199
  * - Auto extracts numeric value with smart multi-locale parsing
182
200
  * via ***`parseCurrencyString` utility function***.
183
201
  * - Strong type checks & clear errors for misconfigured options.
184
202
  * - **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.
203
+ * - Thousands separators: `.`, `,`, `'`, ` `.
204
+ * - Decimal separators: `,`, `.`.
205
+ * - Decimal suffix (eg. `".-"`, `" USD"`).
206
+ * - Currency prefix (eg. `"Rp "`, `"$ "`).
207
+ * - Rounding: `"round"`, `"ceil"`, `"floor"`, or truncate.
208
+ * - Negative styling: dash `-`, brackets `( )`, absolute, or custom.
209
+ * - **How input is parsed:**
210
+ * - Removes all non-digit except `.`, `,`, `'` and spaces.
211
+ * - Detects bracket negatives: `"(15.000,10)"` ➔ `-15000.10`.
212
+ * - Uses last `,` or `.` as decimal separator (others are thousands).
213
+ * - Ignores currency symbols like `Rp`, `$` (must re-apply with `suffixCurrency`).
214
+ * - **Note:**
215
+ * - Always re-apply symbols via `suffixCurrency`.
216
+ * - `parseCurrencyString` smartly detects last decimal,
217
+ * so `"1.121.234,56"` and `"1,121,234.56"` both parsed correctly.
218
+ *
219
+ * ---
200
220
  * @param {string|number} value
201
221
  * ***The input value to format, examples:***
202
- * - `"Rp 15.000,21"`.
203
- * - `"$12,345.60"`.
204
- * - `"CHF 12'345.60"`.
205
- * - `15300.95`.
222
+ * - `"Rp 15.000,21"`.
223
+ * - `"$12,345.60"`.
224
+ * - `"CHF 12'345.60"`.
225
+ * - `15300.95`.
206
226
  * @param {FormatCurrencyOptions} [options] ***Optional configuration object.***
207
227
  * @param {FormatCurrencyOptions["separator"]} [options.separator]
208
228
  * ***Thousands separator:***
209
- * - `{ separator: "." }` ➔ `1.000.000`.
210
- * - *DefaultValue: `"."`.*
229
+ * - `{ separator: "." }` ➔ `1.000.000`.
230
+ * - *DefaultValue: `"."`.*
211
231
  * @param {FormatCurrencyOptions["separatorDecimals"]} [options.separatorDecimals]
212
232
  * ***Decimal separator:***
213
- * - `{ separatorDecimals: "," }` ➔ `1.000,10`.
214
- * - *DefaultValue: `","`.*
233
+ * - `{ separatorDecimals: "," }` ➔ `1.000,10`.
234
+ * - *DefaultValue: `","`.*
215
235
  * @param {FormatCurrencyOptions["suffixCurrency"]} [options.suffixCurrency]
216
236
  * ***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: `""`.*
237
+ * - Does **not auto-keep input symbols**.
238
+ * - Must set manually e.g: `{ suffixCurrency: "Rp " }`.
239
+ * - `{ suffixCurrency: "Rp " }` ➔ `Rp 1.000`.
240
+ * - *DefaultValue: `""`.*
221
241
  * @param {FormatCurrencyOptions["decimal"]} [options.decimal]
222
242
  * ***Whether to show decimals. If `false`, decimals are truncated:***
223
- * - If `false`, cut the decimal.
224
- * - *DefaultValue: `false`.*
243
+ * - If `false`, cut the decimal.
244
+ * - *DefaultValue: `false`.*
225
245
  * @param {FormatCurrencyOptions["totalDecimal"]} [options.totalDecimal]
226
246
  * ***Total decimal digits:***
227
- * - If `decimal: true` & `roundedDecimal: false`, simply cuts.
228
- * - *DefaultValue: `2`.*
247
+ * - If `decimal: true` & `roundedDecimal: false`, simply cuts.
248
+ * - *DefaultValue: `2`.*
229
249
  * @param {FormatCurrencyOptions["separatorDecimals"]} [options.suffixDecimal]
230
250
  * ***Text appended after decimals:***
231
- * - E.g: (`".-"`, `" USD"`).
232
- * - Example 1: `".-"` ➔ `1.000,00.-`.
233
- * - Example 2: `" USD"` ➔ `1.000,00 USD`.
234
- * - *DefaultValue: `""`.*
251
+ * - E.g: (`".-"`, `" USD"`).
252
+ * - Example 1: `".-"` ➔ `1.000,00.-`.
253
+ * - Example 2: `" USD"` ➔ `1.000,00 USD`.
254
+ * - *DefaultValue: `""`.*
235
255
  * @param {FormatCurrencyOptions["endDecimal"]} [options.endDecimal]
236
256
  * ***Actually append `suffixDecimal`:***
237
- * - *DefaultValue: `true`.*
257
+ * - *DefaultValue: `true`.*
238
258
  * @param {FormatCurrencyOptions["roundedDecimal"]} [options.roundedDecimal]
239
259
  * ***Rounding mode:***
240
- * - `"round"` ➔ nearest.
241
- * - `"ceil"` ➔ always up.
242
- * - `"floor"` ➔ always down.
243
- * - `false` ➔ truncate.
244
- * - *DefaultValue: `"round"`.*
260
+ * - `"round"` ➔ nearest.
261
+ * - `"ceil"` ➔ always up.
262
+ * - `"floor"` ➔ always down.
263
+ * - `false` ➔ truncate.
264
+ * - *DefaultValue: `"round"`.*
245
265
  * @param {FormatCurrencyOptions["negativeFormat"]} [options.negativeFormat]
246
266
  * ***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"`.*
267
+ * - `"dash"` ➔ `-15.000`.
268
+ * - `"brackets"` ➔ `(15.000)`.
269
+ * - `"abs"` ➔ `15.000` (always positive).
270
+ * - Or object: `{ style: "dash" | "brackets" | "abs", space: true | false, custom: (formatted) => string }`.
271
+ * - *DefaultValue: `"dash"`.*
252
272
  * @param {FormatCurrencyOptions["indianFormat"]} [options.indianFormat]
253
273
  * ***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"
274
+ * - If `true`, formats as Indian: `12,34,567`.
275
+ * - Also forces `separator: ","`, `separatorDecimals: "."`.
294
276
  *
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"
277
+ * ---
278
+ * @throws **{@link TypeError | `TypeError`}** ***If:***
279
+ * - The `value` is not string or number.
280
+ * - Cannot parse to valid number.
363
281
  *
364
- * // --- Rounding: truncate (false) ---
365
- * formatCurrency(1234.569, {
366
- * decimal: true,
367
- * roundedDecimal: false
368
- * });
369
- * // ➔ "1.234,56"
282
+ * ---
283
+ * @returns {string}
284
+ * ***Nicely formatted currency string, examples:***
285
+ * - `"15.000,10"`.
286
+ * - `"Rp 15.000,10.-"`.
287
+ * - `"15'000.10 USD"`.
288
+ * - `"12,34,567.89"`.
370
289
  *
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)"
290
+ * ---
291
+ * @example
384
292
  *
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"
293
+ * 1. #### Number input (default, decimals off):
294
+ * ```ts
295
+ * formatCurrency(1234567.89);
296
+ * // "1.234.567"
297
+ * ```
298
+ * ---
299
+ * 2. #### Decimals enabled:
300
+ * ```ts
301
+ * formatCurrency(1234567.89, { decimal: true });
302
+ * // ➔ "1.234.567,89"
303
+ * ```
304
+ * ---
305
+ * 3. #### Indian format:
306
+ * ```ts
307
+ * formatCurrency(1234567.89, {
308
+ * decimal: true,
309
+ * indianFormat: true
310
+ * });
311
+ * // ➔ "12,34,567.89"
312
+ * ```
313
+ * ---
314
+ * 4. #### String input (Indonesian style):
315
+ * ```ts
316
+ * formatCurrency("Rp 15.000,21", {
317
+ * decimal: true
318
+ * });
319
+ * // ➔ "15.000,21"
320
+ * ```
321
+ * ---
322
+ * 5. #### String input (US style):
323
+ * ```ts
324
+ * formatCurrency("$12,345.60", {
325
+ * decimal: true
326
+ * });
327
+ * // ➔ "12.345,60"
328
+ * ```
329
+ * ---
330
+ * 6. #### String input (Swiss style):
331
+ * ```ts
332
+ * formatCurrency("CHF 12'345.60", {
333
+ * decimal: true
334
+ * });
335
+ * // ➔ "12'345,60"
336
+ * ```
337
+ * ---
338
+ * 7. #### String input (Indian style):
339
+ * ```ts
340
+ * formatCurrency("1,23,456.78", {
341
+ * decimal: true,
342
+ * indianFormat: true
343
+ * });
344
+ * // ➔ "12,34,567.78"
345
+ * ```
346
+ * ---
347
+ * 8. #### Negative numbers (dash):
348
+ * ```ts
349
+ * formatCurrency(-1234.56, {
350
+ * decimal: true
351
+ * });
352
+ * // ➔ "-1.234,56"
353
+ * ```
354
+ * ---
355
+ * 9. #### Negative numbers (brackets):
356
+ * ```ts
357
+ * formatCurrency(-1234.56, {
358
+ * decimal: true,
359
+ * negativeFormat: "brackets"
360
+ * });
361
+ * // ➔ "(1.234,56)"
362
+ * ```
363
+ * ---
364
+ * 10. #### Negative numbers (custom object style):
365
+ * ```ts
366
+ * formatCurrency(-1234.56, {
367
+ * decimal: true,
368
+ * negativeFormat: {
369
+ * style: "brackets",
370
+ * space: true
371
+ * }
372
+ * });
373
+ * // ➔ "( 1.234,56 )"
374
+ * ```
375
+ * ---
376
+ * 11. #### Negative numbers (custom function):
377
+ * ```ts
378
+ * formatCurrency(-1234.56, {
379
+ * decimal: true,
380
+ * negativeFormat: {
381
+ * custom: (val) => `NEGATIVE[${val}]`
382
+ * }
383
+ * });
384
+ * // ➔ "NEGATIVE[1.234,56]"
385
+ * ```
386
+ * ---
387
+ * 12. #### With prefix currency:
388
+ * ```ts
389
+ * formatCurrency(1234.56, {
390
+ * decimal: true,
391
+ * suffixCurrency: "Rp "
392
+ * });
393
+ * // ➔ "Rp 1.234,56"
394
+ * ```
395
+ * ---
396
+ * 13. #### With suffix decimal:
397
+ * ```ts
398
+ * formatCurrency(1234.56, {
399
+ * decimal: true,
400
+ * suffixDecimal: ".-"
401
+ * });
402
+ * // ➔ "1.234,56.-"
403
+ * ```
404
+ * ---
405
+ * 14. #### With suffix currency + suffix decimal:
406
+ * ```ts
407
+ * formatCurrency(1234.56, {
408
+ * decimal: true,
409
+ * suffixCurrency: "Rp ",
410
+ * suffixDecimal: ".-"
411
+ * });
412
+ * // ➔ "Rp 1.234,56.-"
413
+ * ```
414
+ * ---
415
+ * 15. #### Custom separators:
416
+ * ```ts
417
+ * formatCurrency(1234567.89, {
418
+ * decimal: true,
419
+ * separator: "'",
420
+ * separatorDecimals: "."
421
+ * });
422
+ * // ➔ "1'234'567.89"
423
+ * ```
424
+ * ---
425
+ * 16. #### Rounding: ceil:
426
+ * ```ts
427
+ * formatCurrency(1234.561, {
428
+ * decimal: true,
429
+ * roundedDecimal: "ceil"
430
+ * });
431
+ * // ➔ "1.234,57"
432
+ * ```
433
+ * ---
434
+ * 17. #### Rounding: floor:
435
+ * ```ts
436
+ * formatCurrency(1234.569, {
437
+ * decimal: true,
438
+ * roundedDecimal: "floor"
439
+ * });
440
+ * // ➔ "1.234,56"
441
+ * ```
442
+ * ---
443
+ * 18. #### Rounding: truncate:
444
+ * ```ts
445
+ * formatCurrency(1234.569, {
446
+ * decimal: true,
447
+ * roundedDecimal: false
448
+ * });
449
+ * // ➔ "1.234,56"
450
+ * ```
451
+ * ---
452
+ * 19. #### Force no decimals:
453
+ * ```ts
454
+ * formatCurrency(1234.567, {
455
+ * decimal: false
456
+ * });
457
+ * // ➔ "1.235"
458
+ * ```
459
+ * ---
460
+ * 20. #### Edge case: messy input with dots & commas:
461
+ * ```ts
462
+ * formatCurrency("1.121.234,561", {
463
+ * decimal: true,
464
+ * totalDecimal: 2,
465
+ * roundedDecimal: "ceil",
466
+ * suffixCurrency: "Rp ",
467
+ * negativeFormat: {
468
+ * style: "brackets"
469
+ * }
470
+ * });
471
+ * // ➔ "(Rp 1.121.234,57)"
472
+ * ```
473
+ * ---
474
+ * 21. #### Edge case: integer string input:
475
+ * ```ts
476
+ * formatCurrency("1.121.234", {
477
+ * decimal: true,
478
+ * suffixCurrency: "Rp ",
479
+ * roundedDecimal: "ceil"
480
+ * });
481
+ * // ➔ "Rp 1.121.234,00"
482
+ * ```
392
483
  */
393
484
  declare const formatCurrency: (value: string | number, options?: FormatCurrencyOptions) => string;
394
485
  /** ----------------------------------------------------------
395
486
  * * ***Utility: `formatNumber`.***
396
- * ----------------------------------------------------------
487
+ * -----------------------------------------------------------
397
488
  * **Formats a number or numeric string by adding a custom separator
398
489
  * every three digits (thousands separator), and intelligently flips
399
490
  * the decimal separator according to the chosen separator.**
491
+ *
492
+ * ---
400
493
  * - **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.
494
+ * - Converts a number to string before formatting.
495
+ * - Defaults to using `,` as the thousands separator.
496
+ * - If `.` is used as the separator, the decimal will automatically
497
+ * become `,`, and vice versa.
498
+ * - Handles input with existing formatting (e.g. "1,234,567.89") and normalizes it.
499
+ * - Supports custom separators, including spaces.
500
+ * - Preserves decimals even if more than 2 digits.
501
+ *
502
+ * ---
408
503
  * @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
504
  * @param {string} [separator=","] - The thousands separator to use, examples: `","` ***(default)***, `"."`, `" "`, etc.
505
+ *
506
+ * ---
507
+ * @throws **{@link TypeError | `TypeError`}** if `value` is not a string or number, or `separator` is not a string.
508
+ *
509
+ * ---
410
510
  * @returns {string} The formatted string with thousands separators and
411
511
  * appropriate decimal separator.
412
- * @throws **{@link TypeError | `TypeError`}** if `value` is not a string or number, or `separator` is not a string.
512
+ *
513
+ * ---
413
514
  * @example
414
515
  * formatNumber(1000000);
415
516
  * // ➔ "1,000,000"
@@ -440,163 +541,198 @@ declare const formatCurrency: (value: string | number, options?: FormatCurrencyO
440
541
  */
441
542
  declare const formatNumber: (value: string | number, separator?: string) => string;
442
543
  /** -------------------------------------------------------
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`
544
+ * * ***Output format mode for {@link formatPhoneNumber | `formatPhoneNumber`}.***
545
+ * --------------------------------------------------------
546
+ * - `'E.164'` ➔ `+6281234567890`.
547
+ * - `'RFC3966'` ➔ `tel:+62-812-3456-7890`.
548
+ * - `'NATIONAL'` ➔ `0812 3456 7890`.
549
+ * - `'INTERNATIONAL'` ➔ `+62 812 3456 7890`.
449
550
  */
450
551
  type OutputFormat = ExtractStrict<NumberFormat, "INTERNATIONAL" | "NATIONAL" | "RFC3966" | "E.164">;
451
552
  /** -------------------------------------------------------
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 `+`).
553
+ * * ***Single input value for {@link formatPhoneNumber | `formatPhoneNumber`}.***
554
+ * --------------------------------------------------------
555
+ * - ***Accepts:***
556
+ * - `string` — e.g. `"0812 3456 7890"`.
557
+ * - `number` — e.g. `81234567890`.
558
+ * - `null` or `undefined` — represents no input.
559
+ *
560
+ * ---
561
+ * - ***Notes***
562
+ * - The function normalizes all **non-digit characters** (spaces, dots, dashes,
563
+ * parentheses, etc.) before validation/formatting.
564
+ * - When you pass a `number`, any **leading zeros are lost by JavaScript**.
565
+ * - Prefer using a `string` if the number may begin with `0`.
566
+ * - E.164 international standard allows **up to 15 digits** (not counting `+`).
464
567
  */
465
568
  type ValueFormatPhoneNumber = string | number | null | undefined;
466
569
  /** -------------------------------------------------------
467
- * * ***Base option set for {@link formatPhoneNumber|`formatPhoneNumber`}.***
468
- * -------------------------------------------------------
570
+ * * ***Base option set for {@link formatPhoneNumber | `formatPhoneNumber`}.***
571
+ * --------------------------------------------------------
469
572
  * **All properties are optional.**
573
+ *
574
+ * ---
470
575
  * @description
471
576
  * Defaults apply when a property is omitted or `undefined`.
472
577
  *
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**.
578
+ * ---
579
+ * - ***⚠️ Overload-aware notes:***
580
+ * - If `checkValidOnly` is `true`, **all other properties are ignored**.
581
+ * - If `takeNumberOnly` is `true`, **all formatting properties are ignored**.
582
+ * - The leading `+` is **recommended** but not required;
583
+ * the regex will still validate numbers without `+`
584
+ * as long as the digit count ≤ **15**.
479
585
  */
480
586
  type FormatPhoneNumberMain = {
481
587
  /** -------------------------------------------------------
482
588
  * * ***Separator for formatted output.***
483
- * -------------------------------------------------------
589
+ * --------------------------------------------------------
484
590
  * **Defines the string used to separate groups of digits**
485
591
  * 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
592
  *
500
- * // Using space as separator
501
- * formatPhoneNumber("(151) 2345-6789", { defaultCountry: "DE", separator: " " });
502
- * // "+49 1512 3456789"
593
+ * ---
594
+ * - ***Executed only when:***
595
+ * - Parameter options `checkValidOnly` and `takeNumberOnly` are both `false`, *(This option is ignored if either `checkValidOnly` or `takeNumberOnly` is `true`)*.
596
+ * - ***DefaultValue:*** `" "`.
597
+ * - ***Behavior:***
598
+ * - The formatter inserts this separator between number blocks
599
+ * according to the selected `outputFormat`.
600
+ *
601
+ * ---
602
+ * @default
603
+ * ```ts
604
+ * " "
503
605
  * ```
606
+ *
607
+ * ---
608
+ * @example
609
+ *
610
+ * 1. #### Using dash as separator:
611
+ * ```ts
612
+ * formatPhoneNumber("081234567890", { defaultCountry: "ID", separator: "-" });
613
+ * // ➔ "+62 812-3456-7890"
614
+ * ```
615
+ * ---
616
+ * 2. #### Using space as separator:
617
+ * ```ts
618
+ * formatPhoneNumber("(151) 2345-6789", { defaultCountry: "DE", separator: " " });
619
+ * // ➔ "+49 1512 3456789"
620
+ * ```
504
621
  */
505
622
  separator?: string;
506
623
  /** -------------------------------------------------------
507
624
  * * ***Output format style for the returned phone number.***
508
- * -------------------------------------------------------
625
+ * --------------------------------------------------------
509
626
  * **Determines how the formatted phone number string is returned.**
510
627
  *
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`.
628
+ * ---
629
+ * - ***Applicable only when:***
630
+ * - Parameter options `checkValidOnly` and `takeNumberOnly`
631
+ * are both **`false`**, *(Ignored if either of those options is `true`)*.
632
+ * - ***DefaultValue:*** `"INTERNATIONAL"`.
633
+ * - ***Supported values (from {@link NumberFormat | `NumberFormat`}):***
634
+ * - `"NATIONAL"` Local/national format, e.g. `0812 3456 7890`.
635
+ * - `"INTERNATIONAL"` – International format with leading plus, e.g. `+62 812 3456 7890`.
636
+ * - `"E.164"` – Compact E.164 format, e.g. `+6281234567890`.
637
+ * - `"RFC3966"` – RFC 3966 URI format, e.g. `tel:+62-812-3456-7890`.
522
638
  *
523
- * @default "INTERNATIONAL"
524
- * @example
639
+ * ---
640
+ * @default
525
641
  * ```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"
642
+ * "INTERNATIONAL"
533
643
  * ```
644
+ *
645
+ * @example
646
+ * 1. #### Returns a national-format string:
647
+ * ```ts
648
+ * formatPhoneNumber("+62 81234567890", { outputFormat: "NATIONAL" });
649
+ * // ➔ "0812 3456 7890"
650
+ * ```
651
+ * ---
652
+ * 2. #### Returns an E.164-format string:
653
+ * ```ts
654
+ * formatPhoneNumber("+62 81234567890", { outputFormat: "E.164" });
655
+ * // ➔ "+6281234567890"
656
+ * ```
534
657
  */
535
658
  outputFormat?: OutputFormat;
536
659
  /** -------------------------------------------------------
537
660
  * * ***Prepend a plus sign and country calling code.***
538
- * -------------------------------------------------------
661
+ * --------------------------------------------------------
539
662
  * **Forces the returned phone number to start with a leading `+`
540
663
  * 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
664
  *
564
- * formatPhoneNumber("09171234567", {
565
- * country: "PH",
566
- * prependPlusCountryCode: false
567
- * });
568
- * // "63 917 123 4567"
665
+ * ---
666
+ * - ***Behavior:***
667
+ * - When `true`, the formatter ensures the output begins with
668
+ * a `+` and the correct country code.
669
+ * - When `false`, the output follows the chosen `outputFormat`
670
+ * without forcing a `+` prefix.
671
+ * - ***DefaultValue:*** `true`.
672
+ * - ***Executed only when:***
673
+ * - Parameter options `outputFormat` is set
674
+ * to `"INTERNATIONAL"`, *(This option is ignored for `"NATIONAL"`, `"E.164"` or `"RFC3966"` formats.)*.
675
+ * - ***Applicable when:***
676
+ * - You want to guarantee that the result
677
+ * always contains a plus sign and country code, regardless of
678
+ * the selected `outputFormat`.
569
679
  *
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"
680
+ * ---
681
+ * @default
682
+ * ```ts
683
+ * true
577
684
  * ```
685
+ *
686
+ * @example
687
+ * 1. #### Automatically adds +63 (default: `true`) even if input is local format:
688
+ * ```ts
689
+ * formatPhoneNumber("09171234567", {
690
+ * country: "PH",
691
+ * prependPlusCountryCode: true
692
+ * });
693
+ * // ➔ "+63 917 123 4567"
694
+ *
695
+ * formatPhoneNumber("09171234567", {
696
+ * country: "PH",
697
+ * prependPlusCountryCode: false
698
+ * });
699
+ * // ➔ "63 917 123 4567"
700
+ * ```
701
+ * ---
702
+ * 2. #### Leaves number in national format (no plus sign):
703
+ * ```ts
704
+ * formatPhoneNumber("+63 9171234567", {
705
+ * country: "PH",
706
+ * prependPlusCountryCode: false,
707
+ * outputFormat: "NATIONAL"
708
+ * });
709
+ * // ➔ "0917 123 4567"
710
+ * ```
578
711
  */
579
712
  prependPlusCountryCode?: boolean;
580
713
  /** -------------------------------------------------------
581
714
  * * ***Characters before the country code (e.g. `"("`).***
582
- * -------------------------------------------------------
715
+ * --------------------------------------------------------
583
716
  * **Adds a custom string that appears **immediately before** the
584
717
  * 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`.
718
+ *
719
+ * - ***Behavior:***
720
+ * - **Active only when:**
721
+ * - `checkValidOnly` is **false**,
722
+ * - `takeNumberOnly` is **false**, and
723
+ * - `outputFormat` is `"INTERNATIONAL"`.
724
+ * - **Ignored if:**
725
+ * - The value is an empty string *(after trimming)*,
726
+ * - `checkValidOnly` or `takeNumberOnly` is `true`,
727
+ * - `outputFormat` is not `"INTERNATIONAL"`,
728
+ * - `closingNumberCountry` is `undefined` or an empty string *(after trimming)*.
729
+ * - ***DefaultValue:*** `""` *(empty string)*.
730
+ * - ***Invalid input:***
731
+ * - Returns no effect if the phone number is invalid or not compatible
732
+ * with the selected `defaultCountry`.
733
+ *
599
734
  * @default ""
735
+ *
600
736
  * @example
601
737
  * ```ts
602
738
  * formatPhoneNumber("+63 9171234567", {
@@ -610,24 +746,33 @@ type FormatPhoneNumberMain = {
610
746
  openingNumberCountry?: string;
611
747
  /** -------------------------------------------------------
612
748
  * * ***Characters after the country code (e.g. `")"`).***
613
- * -------------------------------------------------------
749
+ * --------------------------------------------------------
614
750
  * **Adds a custom string that appears **immediately after** the
615
751
  * 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).
752
+ *
753
+ * ---
754
+ * - ***Behavior:***
755
+ * - **Active only when:**
756
+ * - `checkValidOnly` is **false**,
757
+ * - `takeNumberOnly` is **false**, and
758
+ * - `outputFormat` is `"INTERNATIONAL"`.
759
+ * - **Ignored if:**
760
+ * - The value is an empty string *(after trimming)*,
761
+ * - `checkValidOnly` or `takeNumberOnly` is `true`,
762
+ * - `outputFormat` is not `"INTERNATIONAL"`,
763
+ * - `openingNumberCountry` is `undefined` or an empty string *(after trimming)*.
764
+ * - ***DefaultValue:*** `""` *(empty string)*.
627
765
  * - **Invalid input:**
628
- * Returns no effect if the phone number is invalid or not compatible
629
- * with the selected `defaultCountry`.
630
- * @default ""
766
+ * Returns no effect if the phone number is invalid or not compatible
767
+ * with the selected `defaultCountry`.
768
+ *
769
+ * ---
770
+ * @default
771
+ * ```ts
772
+ * ""
773
+ * ```
774
+ *
775
+ * ---
631
776
  * @example
632
777
  * ```ts
633
778
  * formatPhoneNumber("+63 9171234567", {
@@ -641,28 +786,37 @@ type FormatPhoneNumberMain = {
641
786
  closingNumberCountry?: string;
642
787
  /** -------------------------------------------------------
643
788
  * * ***Return only a boolean validity flag.***
644
- * -------------------------------------------------------
789
+ * --------------------------------------------------------
790
+ *
791
+ * ---
645
792
  * - ***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
793
+ * - **Exclusive mode:**
794
+ * - ⚠️ When `true`, all formatting options and `takeNumberOnly` must be omitted or are ignored.
795
+ * - Conflicts with `takeNumberOnly`:
796
+ * - ⚠️ When `checkValidOnly` is `true` and all formatting options and `takeNumberOnly` must be
797
+ * omitted or are ignored.
798
+ * - But if mistake passing props:
799
+ * - ⚠️ When `checkValidOnly` is `true` and other of formatting options was passing:
800
+ * - If `takeNumberOnly` is `true` or `false`:
801
+ * - Will return a `boolean` because `checkValidOnly` is prioritize first.
802
+ * - Output:
803
+ * - Boolean ➔ (`true` or `false`).
804
+ * - ***DefaultValue:*** `false`.
805
+ *
806
+ * ---
807
+ * @default
808
+ * ```ts
809
+ * false
810
+ * ```
811
+ *
812
+ * ---
659
813
  * @example
660
814
  * ```ts
661
- * // Returns `true` if valid number and number with country code (no need `defaultCountry`)
815
+ * // Returns `true` if valid number and number with country code (no need `defaultCountry`).
662
816
  * formatPhoneNumber("+63 912-123-4567", { checkValidOnly: true });
663
817
  * // ➔ true
664
818
  *
665
- * // Returns `true` if valid number and number without country code but with `defaultCountry`
819
+ * // Returns `true` if valid number and number without country code but with `defaultCountry`.
666
820
  * formatPhoneNumber("213-373-4253", { defaultCountry: "US", checkValidOnly: true });
667
821
  * // ➔ true
668
822
  *
@@ -678,37 +832,46 @@ type FormatPhoneNumberMain = {
678
832
  checkValidOnly?: boolean;
679
833
  /** -------------------------------------------------------
680
834
  * * ***Return only the digits of the phone number (local number only).***
681
- * -------------------------------------------------------
835
+ * --------------------------------------------------------
682
836
  * **Returns a string containing only numeric characters** from the **local number**,
683
837
  * 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
838
+ *
839
+ * ---
840
+ * - ***Behavior:***
841
+ * - **Exclusive mode:**
842
+ * - ⚠️ When set to `true`, all formatting options
843
+ * (`outputFormat`, `prependPlusCountryCode`, etc.)
844
+ * and `checkValidOnly` **must be omitted** or will be **ignored**.
845
+ * - **Conflict handling with `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
+ * - **Invalid input:**
853
+ * - If the input is invalid or cannot be parsed
854
+ * (e.g. not matching the `defaultCountry`),
855
+ * the function returns an **empty string** (`""`).
856
+ * - ***DefaultValue:*** `false`.
857
+ * - ***Output example:***
858
+ * - Valid input ➔ `"81234567890"` *(country code removed)*.
859
+ * - Invalid input ➔ `""`.
860
+ *
861
+ * ---
862
+ * @default
863
+ * ```ts
864
+ * false
865
+ * ```
866
+ *
867
+ * ---
705
868
  * @example
706
869
  * ```ts
707
- * // Returns only digits of the local number with country code (no need `defaultCountry`)
870
+ * // Returns only digits of the local number with country code (no need `defaultCountry`).
708
871
  * formatPhoneNumber("+63 912-123-4567", { takeNumberOnly: true });
709
872
  * // ➔ "09121234567"
710
873
  *
711
- * // Returns only digits of the local number without country code but with `defaultCountry`
874
+ * // Returns only digits of the local number without country code but with `defaultCountry`.
712
875
  * formatPhoneNumber("213-373-4253", { defaultCountry: "US", takeNumberOnly: true });
713
876
  * // ➔ "2133734253"
714
877
  *
@@ -724,80 +887,106 @@ type FormatPhoneNumberMain = {
724
887
  takeNumberOnly?: boolean;
725
888
  /** -------------------------------------------------------
726
889
  * * ***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
- * -------------------------------------------------------
890
+ * --------------------------------------------------------
728
891
  * **Used to interpret numbers without an explicit `+<countryCode>`.**
892
+ *
893
+ * ---
729
894
  * - ***Behavior:***
730
- * - Required if the input without country code (`+`).
731
- * - Ignored if the input already starts with `+`.
895
+ * - Required if the input without country code (`+`).
896
+ * - Ignored if the input already starts with `+`.
732
897
  * - ***Examples:***
733
898
  * - `"ID"` ➔ Indonesian.
734
899
  * - `"US"` ➔ United States.
735
900
  * - `"GB"` ➔ United Kingdom.
736
901
  * - ***DefaultValue: `undefined`***.
902
+ *
903
+ * ---
904
+ * @default
905
+ * ```ts
906
+ * undefined
907
+ * ```
908
+ *
909
+ * ---
737
910
  * @example
738
911
  * formatPhoneNumber("081234567890", { defaultCountry: "ID" });
739
- * @default undefined
740
912
  */
741
913
  defaultCountry?: CountryCode;
742
914
  };
743
915
  /** -------------------------------------------------------
744
- * * ***Specialized options for the `transformPhoneNumber` variant of {@link formatPhoneNumber|`formatPhoneNumber`}.***
745
- * -------------------------------------------------------
916
+ * * ***Specialized options for the `transformPhoneNumber` variant of {@link formatPhoneNumber | `formatPhoneNumber`}.***
917
+ * --------------------------------------------------------
746
918
  * **Ensures that `checkValidOnly` and `takeNumberOnly` are both
747
919
  * forced to `false` when transforming/formatting.**
748
920
  *
921
+ * ---
749
922
  * This type is intended for scenarios where you **must** receive a formatted
750
923
  * string as output and never a `boolean` or digit-only result.
751
924
  *
752
- * **Example Output:** `+62 812 3456 7890`
925
+ * ---
926
+ * **Example Output:** `+62 812 3456 7890`.
753
927
  */
754
928
  type FormatPhoneNumberTransform = OverrideTypes<FormatPhoneNumberMain, {
755
929
  /** -------------------------------------------------------
756
930
  * * ***Return only a boolean validity flag.***
757
- * -------------------------------------------------------
931
+ * --------------------------------------------------------
758
932
  * - ***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
933
+ * - **Exclusive mode:**
934
+ * - ⚠️ When `true`, all formatting options and `takeNumberOnly` must be omitted or are ignored.
935
+ * - Conflicts with `takeNumberOnly`:
936
+ * - ⚠️ When `checkValidOnly` is `true` and all formatting options and `takeNumberOnly` must be
937
+ * omitted or are ignored.
938
+ * - But if mistake passing props:
939
+ * - ⚠️ When `checkValidOnly` is `true` and other of formatting options was passing:
940
+ * - If `takeNumberOnly` is `true` or `false`:
941
+ * - Will return a `boolean` because `checkValidOnly` is prioritize first.
942
+ * - Output:
943
+ * - Boolean ➔ (`true` or `false`).
944
+ * - ***DefaultValue:*** `false`.
945
+ *
946
+ * ---
947
+ * @default
948
+ * ```ts
949
+ * false
950
+ *
951
+ * ```
772
952
  * @requires `false` or `undefined`
773
953
  */
774
954
  checkValidOnly?: never;
775
955
  /** -------------------------------------------------------
776
956
  * * ***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
957
+ * --------------------------------------------------------
958
+ * **`Returns a string containing only numeric characters` from the `local number`,
959
+ * ignoring any `country code`, `spaces`, `plus signs`, or `separators`.**
960
+ *
961
+ * ---
962
+ * - ***Behavior:***
963
+ * - **Exclusive mode:**
964
+ * - ⚠️ When set to `true`, all formatting options
965
+ * (`outputFormat`, `prependPlusCountryCode`, etc.)
966
+ * and `checkValidOnly` **must be omitted** or will be **ignored**.
967
+ * - **Conflict handling with `checkValidOnly`:**
968
+ * - If both `takeNumberOnly` and `checkValidOnly` are `true`,
969
+ * `checkValidOnly` takes priority and the function
970
+ * returns a `boolean`.
971
+ * - If `checkValidOnly` is `false` (or not provided),
972
+ * and `takeNumberOnly` is `true`,
973
+ * the function returns a **numeric string of the local number**.
974
+ * - **Invalid input:**
975
+ * - If the input is invalid or cannot be parsed
976
+ * (e.g. not matching the `defaultCountry`),
977
+ * the function returns an **empty string** (`""`).
978
+ * - ***DefaultValue:*** `false`.
979
+ * - ***Output example:***
980
+ * - Valid input ➔ `"81234567890"` *(country code removed)*.
981
+ * - Invalid input ➔ `""`.
982
+ *
983
+ * ---
984
+ * @default
985
+ * ```ts
986
+ * false
987
+ * ```
988
+ *
989
+ * ---
801
990
  * @requires `false` or `undefined`
802
991
  */
803
992
  takeNumberOnly?: never;
@@ -805,34 +994,37 @@ type FormatPhoneNumberTransform = OverrideTypes<FormatPhoneNumberMain, {
805
994
  type NeverForRestFormatPhoneNumberTransform = {
806
995
  /** -------------------------------------------------------
807
996
  * * ***Not used in this mode **`(Never allowed in this mode)`**.***
808
- * -------------------------------------------------------
997
+ * --------------------------------------------------------
809
998
  * - ***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**.
999
+ * - **Exclusive mode:**
1000
+ * - ⚠️ When `true`, all formatting options must be omitted or are ignored.
1001
+ * - Conflicts with `takeNumberOnly` and `checkValidOnly`:
1002
+ * - If both `takeNumberOnly` and `checkValidOnly` are `true`,
1003
+ * `checkValidOnly` takes priority and the function
1004
+ * returns a `boolean`.
1005
+ * - If `checkValidOnly` is `false` (or not provided),
1006
+ * and `takeNumberOnly` is `true`,
1007
+ * the function returns a **numeric string of the local number**.
1008
+ *
1009
+ * ---
819
1010
  * @requires `undefined`
820
1011
  */
821
1012
  separator?: never;
822
1013
  /** -------------------------------------------------------
823
1014
  * * ***Not used in this mode **`(Never allowed in this mode)`**.***
824
- * -------------------------------------------------------
1015
+ * --------------------------------------------------------
825
1016
  * - ***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**.
1017
+ * - **Exclusive mode:**
1018
+ * - ⚠️ When `true`, all formatting options must be omitted or are ignored.
1019
+ * - Conflicts with `takeNumberOnly` and `checkValidOnly`:
1020
+ * - If both `takeNumberOnly` and `checkValidOnly` are `true`,
1021
+ * `checkValidOnly` takes priority and the function
1022
+ * returns a `boolean`.
1023
+ * - If `checkValidOnly` is `false` (or not provided),
1024
+ * and `takeNumberOnly` is `true`,
1025
+ * the function returns a **numeric string of the local number**.
835
1026
  *
1027
+ * ---
836
1028
  * @requires `undefined`
837
1029
  */
838
1030
  openingNumberCountry?: never;
@@ -840,368 +1032,428 @@ type NeverForRestFormatPhoneNumberTransform = {
840
1032
  * * ***Not used in this mode **`(Never allowed in this mode)`**.***
841
1033
  * -------------------------------------------------------
842
1034
  * - ***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**.
1035
+ * - **Exclusive mode:**
1036
+ * - ⚠️ When `true`, all formatting options must be omitted or are ignored.
1037
+ * - Conflicts with `takeNumberOnly` and `checkValidOnly`:
1038
+ * - If both `takeNumberOnly` and `checkValidOnly` are `true`,
1039
+ * `checkValidOnly` takes priority and the function
1040
+ * returns a `boolean`.
1041
+ * - If `checkValidOnly` is `false` (or not provided),
1042
+ * and `takeNumberOnly` is `true`,
1043
+ * the function returns a **numeric string of the local number**.
852
1044
  *
1045
+ * ---
853
1046
  * @requires `undefined`
854
1047
  */
855
1048
  closingNumberCountry?: never;
856
1049
  };
857
1050
  /** -------------------------------------------------------
858
1051
  * * ***Options subset for **validity-check mode** of
859
- * {@link formatPhoneNumber|`formatPhoneNumber`}.***
860
- * -------------------------------------------------------
1052
+ * {@link formatPhoneNumber | `formatPhoneNumber`}.***
1053
+ * --------------------------------------------------------
861
1054
  * Only `checkValidOnly` is allowed.
1055
+ *
1056
+ * ---
1057
+ * @description
862
1058
  * All formatting-related properties are **intentionally disallowed**
863
1059
  * to avoid mixing validation with formatting.
864
1060
  *
865
- * **Example Usage:**
866
- * ```ts
867
- * formatPhoneNumber("+6281234567890", { checkValidOnly: true }) // boolean
868
- * ```
1061
+ * ---
1062
+ * - **Example Usage:**
1063
+ * ```ts
1064
+ * formatPhoneNumber("+6281234567890", { checkValidOnly: true });
1065
+ * // ➔ boolean
1066
+ * ```
869
1067
  */
870
1068
  type FormatPhoneNumberCheckValidOnly = Prettify<OverrideTypes<FormatPhoneNumberMain, {
871
1069
  /** -------------------------------------------------------
872
1070
  * * ***Return only a boolean validity flag.***
873
- * -------------------------------------------------------
1071
+ * --------------------------------------------------------
874
1072
  * - ***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***
1073
+ * - **Exclusive mode:**
1074
+ * - ⚠️ When `true`, all formatting options and `takeNumberOnly` must be omitted or are ignored.
1075
+ * - Conflicts with `takeNumberOnly`:
1076
+ * - ⚠️ When `checkValidOnly` is `true` and all formatting options and `takeNumberOnly` must be
1077
+ * omitted or are ignored.
1078
+ * - But if mistake passing props:
1079
+ * - ⚠️ When `checkValidOnly` is `true` and other of formatting options was passing:
1080
+ * - If `takeNumberOnly` is `true` or `false`:
1081
+ * - Will return a `boolean` because `checkValidOnly` is prioritize first.
1082
+ * - Output:
1083
+ * - Boolean ➔ (`true` or `false`).
1084
+ * - ***DefaultValue:*** `false`.
1085
+ *
1086
+ * ---
887
1087
  * @default false
888
1088
  */
889
1089
  checkValidOnly: true;
890
1090
  /** -------------------------------------------------------
891
1091
  * * ***Return only the digits of the phone number (local number only).***
892
- * -------------------------------------------------------
1092
+ * --------------------------------------------------------
893
1093
  * **Returns a string containing only numeric characters** from the **local number**,
894
1094
  * 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
1095
+ *
1096
+ * - ***Behavior:***
1097
+ * - **Exclusive mode:**
1098
+ * - ⚠️ When set to `true`, all formatting options
1099
+ * (`outputFormat`, `prependPlusCountryCode`, etc.)
1100
+ * and `checkValidOnly` **must be omitted** or will be **ignored**.
1101
+ * - **Conflict handling with `checkValidOnly`:**
1102
+ * - If both `takeNumberOnly` and `checkValidOnly` are `true`,
1103
+ * `checkValidOnly` takes priority and the function
1104
+ * returns a `boolean`.
1105
+ * - If `checkValidOnly` is `false` (or not provided),
1106
+ * and `takeNumberOnly` is `true`,
1107
+ * the function returns a **numeric string of the local number**.
1108
+ * - **Invalid input:**
1109
+ * - If the input is invalid or cannot be parsed
1110
+ * (e.g. not matching the `defaultCountry`),
1111
+ * the function returns an **empty string** (`""`).
1112
+ * - ***DefaultValue:*** `false`.
1113
+ * - ***Output example:***
1114
+ * - Valid input ➔ `"81234567890"` *(country code removed)*.
1115
+ * - Invalid input ➔ `""`.
1116
+ *
1117
+ * ---
1118
+ * @default ```ts
1119
+ * false
1120
+ * ```
1121
+ * ---
916
1122
  * @requires `false` or `undefined`
917
1123
  */
918
1124
  takeNumberOnly?: false;
919
1125
  } & NeverForRestFormatPhoneNumberTransform>>;
920
1126
  /** -------------------------------------------------------
921
- * * ***Options subset for calling {@link formatPhoneNumber|`formatPhoneNumber`} in
1127
+ * * ***Options subset for calling {@link formatPhoneNumber | `formatPhoneNumber`} in
922
1128
  * **digits-only mode**.***
923
- * -------------------------------------------------------
1129
+ * --------------------------------------------------------
924
1130
  * **Only `takeNumberOnly` is allowed; all other formatting options are
925
1131
  * intentionally disallowed.**
926
1132
  *
1133
+ * ---
927
1134
  * Use this when you want a pure numeric string without any separators or country
928
1135
  * decorations, but still want the function to normalize the input.
929
1136
  *
930
- * **Example Output:** `"6281234567890"`
1137
+ * ---
1138
+ * **Example Output:** `"6281234567890"`.
931
1139
  */
932
1140
  type FormatPhoneNumberTakeNumberOnly = Prettify<OverrideTypes<FormatPhoneNumberMain, {
933
1141
  /** -------------------------------------------------------
934
1142
  * * ***Return only a boolean validity flag.***
935
- * -------------------------------------------------------
1143
+ * --------------------------------------------------------
1144
+ *
936
1145
  * - ***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
1146
+ * - **Exclusive mode:**
1147
+ * - ⚠️ When `true`, all formatting options and `takeNumberOnly` must be omitted or are ignored.
1148
+ * - Conflicts with `takeNumberOnly`:
1149
+ * - ⚠️ When `checkValidOnly` is `true` and all formatting options and `takeNumberOnly` must be
1150
+ * omitted or are ignored.
1151
+ * - But if mistake passing props:
1152
+ * - ⚠️ When `checkValidOnly` is `true` and other of formatting options was passing:
1153
+ * - If `takeNumberOnly` is `true` or `false`:
1154
+ * - Will return a `boolean` because `checkValidOnly` is prioritize first.
1155
+ * - Output:
1156
+ * - Boolean ➔ (`true` or `false`).
1157
+ * - ***DefaultValue:*** `false`.
1158
+ *
1159
+ * ---
1160
+ * @default
1161
+ * ```ts
1162
+ * false
1163
+ * ```
1164
+ * ---
950
1165
  * @requires `false` or `undefined`
951
1166
  */
952
1167
  checkValidOnly?: false;
953
1168
  /** -------------------------------------------------------
954
1169
  * * ***Return only the digits of the phone number (local number only).***
955
- * -------------------------------------------------------
1170
+ * --------------------------------------------------------
956
1171
  * **Returns a string containing only numeric characters** from the **local number**,
957
1172
  * 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 ➔ `""`
1173
+ *
1174
+ * ---
1175
+ * - ***Behavior:***
1176
+ * - **Exclusive mode:**
1177
+ * - ⚠️ When set to `true`, all formatting options
1178
+ * (`outputFormat`, `prependPlusCountryCode`, etc.)
1179
+ * and `checkValidOnly` **must be omitted** or will be **ignored**.
1180
+ * - **Conflict handling with `checkValidOnly`:**
1181
+ * - If both `takeNumberOnly` and `checkValidOnly` are `true`,
1182
+ * `checkValidOnly` takes priority and the function
1183
+ * returns a `boolean`.
1184
+ * - If `checkValidOnly` is `false` (or not provided),
1185
+ * and `takeNumberOnly` is `true`,
1186
+ * the function returns a **numeric string of the local number**.
1187
+ * - **Invalid input:**
1188
+ * - If the input is invalid or cannot be parsed
1189
+ * (e.g. not matching the `defaultCountry`),
1190
+ * the function returns an **empty string** (`""`).
1191
+ * - ***DefaultValue:*** `false`.
1192
+ * - ***Output example:***
1193
+ * - Valid input ➔ `"81234567890"` *(country code removed)*.
1194
+ * - Invalid input ➔ `""`.
1195
+ *
1196
+ * ---
978
1197
  * @default false
979
1198
  */
980
1199
  takeNumberOnly: true;
981
1200
  } & NeverForRestFormatPhoneNumberTransform>>;
982
1201
  /** -------------------------------------------------------
983
- * * ***Options subset for calling {@link formatPhoneNumber|`formatPhoneNumber`} force to **Validity-check Mode**.***
1202
+ * * ***Options subset for calling {@link formatPhoneNumber | `formatPhoneNumber`} force to **Validity-check Mode**.***
984
1203
  * -------------------------------------------------------
985
1204
  */
986
1205
  type FormatPhoneNumberAllPassing = OverrideTypes<FormatPhoneNumberMain, {
987
1206
  /** -------------------------------------------------------
988
1207
  * * ***Return only a boolean validity flag.***
989
- * -------------------------------------------------------
1208
+ * --------------------------------------------------------
1209
+ *
990
1210
  * - ***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***
1211
+ * - **Exclusive mode:**
1212
+ * - ⚠️ When `true`, all formatting options and `takeNumberOnly` must be omitted or are ignored.
1213
+ * - Conflicts with `takeNumberOnly`:
1214
+ * - ⚠️ When `checkValidOnly` is `true` and all formatting options and `takeNumberOnly` must be
1215
+ * omitted or are ignored.
1216
+ * - But if mistake passing props:
1217
+ * - ⚠️ When `checkValidOnly` is `true` and other of formatting options was passing:
1218
+ * - If `takeNumberOnly` is `true` or `false`:
1219
+ * - Will return a `boolean` because `checkValidOnly` is prioritize first.
1220
+ * - Output:
1221
+ * - Boolean ➔ (`true` or `false`).
1222
+ * - ***DefaultValue:*** `false`.
1223
+ *
1224
+ * ---
1003
1225
  * @default false
1004
1226
  */
1005
1227
  checkValidOnly: true;
1006
1228
  /** -------------------------------------------------------
1007
1229
  * * ***Return only the digits of the phone number (local number only).***
1008
- * -------------------------------------------------------
1230
+ * --------------------------------------------------------
1009
1231
  * **Returns a string containing only numeric characters** from the **local number**,
1010
1232
  * 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
1233
+ *
1234
+ * ---
1235
+ * - ***Behavior:***
1236
+ * - **Exclusive mode:**
1237
+ * - ⚠️ When set to `true`, all formatting options
1238
+ * (`outputFormat`, `prependPlusCountryCode`, etc.)
1239
+ * and `checkValidOnly` **must be omitted** or will be **ignored**.
1240
+ * - **Conflict handling with `checkValidOnly`:**
1241
+ * - If both `takeNumberOnly` and `checkValidOnly` are `true`,
1242
+ * `checkValidOnly` takes priority and the function
1243
+ * returns a `boolean`.
1244
+ * - If `checkValidOnly` is `false` (or not provided),
1245
+ * and `takeNumberOnly` is `true`,
1246
+ * the function returns a **numeric string of the local number**.
1247
+ * - **Invalid input:**
1248
+ * - If the input is invalid or cannot be parsed
1249
+ * (e.g. not matching the `defaultCountry`),
1250
+ * the function returns an **empty string** (`""`).
1251
+ * - ***DefaultValue:*** `false`.
1252
+ * - ***Output example:***
1253
+ * - Valid input ➔ `"81234567890"` *(country code removed)*.
1254
+ * - Invalid input ➔ `""`.
1255
+ *
1256
+ * ---
1257
+ * @default
1258
+ * ```ts
1259
+ * false
1260
+ * ```
1261
+ *
1262
+ * ---
1032
1263
  * @requires `false` or `undefined`
1033
1264
  */
1034
1265
  takeNumberOnly: true;
1035
1266
  }>;
1036
1267
  /** -------------------------------------------------------
1037
- * * ***Options subset for calling {@link formatPhoneNumber|`formatPhoneNumber`} force to **Validity-check Mode**.***
1038
- * -------------------------------------------------------
1268
+ * * ***Options subset for calling {@link formatPhoneNumber | `formatPhoneNumber`} force to **Validity-check Mode**.***
1269
+ * --------------------------------------------------------
1039
1270
  */
1040
1271
  type FormatPhoneNumberAllPassingValidOnly = OverrideTypes<FormatPhoneNumberMain, {
1041
1272
  /** -------------------------------------------------------
1042
1273
  * * ***Return only a boolean validity flag.***
1043
- * -------------------------------------------------------
1274
+ * --------------------------------------------------------
1275
+ *
1044
1276
  * - ***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***
1277
+ * - **Exclusive mode:**
1278
+ * - ⚠️ When `true`, all formatting options and `takeNumberOnly` must be omitted or are ignored.
1279
+ * - Conflicts with `takeNumberOnly`:
1280
+ * - ⚠️ When `checkValidOnly` is `true` and all formatting options and `takeNumberOnly` must be
1281
+ * omitted or are ignored.
1282
+ * - But if mistake passing props:
1283
+ * - ⚠️ When `checkValidOnly` is `true` and other of formatting options was passing:
1284
+ * - If `takeNumberOnly` is `true` or `false`:
1285
+ * - Will return a `boolean` because `checkValidOnly` is prioritize first.
1286
+ * - Output:
1287
+ * - Boolean ➔ (`true` or `false`).
1288
+ * - ***DefaultValue:*** `false`.
1289
+ *
1290
+ * ---
1057
1291
  * @default false
1058
1292
  */
1059
1293
  checkValidOnly: true;
1060
1294
  /** -------------------------------------------------------
1061
1295
  * * ***Return only the digits of the phone number (local number only).***
1062
- * -------------------------------------------------------
1296
+ * --------------------------------------------------------
1063
1297
  * **Returns a string containing only numeric characters** from the **local number**,
1064
1298
  * 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
1299
+ *
1300
+ * ---
1301
+ * - ***Behavior:***
1302
+ * - **Exclusive mode:**
1303
+ * - ⚠️ When set to `true`, all formatting options
1304
+ * (`outputFormat`, `prependPlusCountryCode`, etc.)
1305
+ * and `checkValidOnly` **must be omitted** or will be **ignored**.
1306
+ * - **Conflict handling with `checkValidOnly`:**
1307
+ * - If both `takeNumberOnly` and `checkValidOnly` are `true`,
1308
+ * `checkValidOnly` takes priority and the function
1309
+ * returns a `boolean`.
1310
+ * - If `checkValidOnly` is `false` (or not provided),
1311
+ * and `takeNumberOnly` is `true`,
1312
+ * the function returns a **numeric string of the local number**.
1313
+ * - **Invalid input:**
1314
+ * - If the input is invalid or cannot be parsed
1315
+ * (e.g. not matching the `defaultCountry`),
1316
+ * the function returns an **empty string** (`""`).
1317
+ * - ***DefaultValue:*** `false`.
1318
+ * - ***Output example:***
1319
+ * - Valid input ➔ `"81234567890"` *(country code removed)*.
1320
+ * - Invalid input ➔ `""`.
1321
+ *
1322
+ * ---
1323
+ * @default
1324
+ * ```ts
1325
+ * false
1326
+ * ```
1327
+ *
1328
+ * ---
1086
1329
  * @requires `false` or `undefined`
1087
1330
  */
1088
1331
  takeNumberOnly?: false;
1089
1332
  }>;
1090
1333
  /** -------------------------------------------------------
1091
- * * ***Options subset for calling {@link formatPhoneNumber|`formatPhoneNumber`} force to **Digits-only Mode**.***
1092
- * -------------------------------------------------------
1334
+ * * ***Options subset for calling {@link formatPhoneNumber | `formatPhoneNumber`} force to **Digits-only Mode**.***
1335
+ * --------------------------------------------------------
1093
1336
  */
1094
1337
  type FormatPhoneNumberAllPassingTakeOnly = OverrideTypes<FormatPhoneNumberMain, {
1095
1338
  /** -------------------------------------------------------
1096
1339
  * * ***Return only a boolean validity flag.***
1097
- * -------------------------------------------------------
1340
+ * --------------------------------------------------------
1341
+ *
1098
1342
  * - ***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
1343
+ * - **Exclusive mode:**
1344
+ * - ⚠️ When `true`, all formatting options and `takeNumberOnly` must be omitted or are ignored.
1345
+ * - Conflicts with `takeNumberOnly`:
1346
+ * - ⚠️ When `checkValidOnly` is `true` and all formatting options and `takeNumberOnly` must be
1347
+ * omitted or are ignored.
1348
+ * - But if mistake passing props:
1349
+ * - ⚠️ When `checkValidOnly` is `true` and other of formatting options was passing:
1350
+ * - If `takeNumberOnly` is `true` or `false`:
1351
+ * - Will return a `boolean` because `checkValidOnly` is prioritize first.
1352
+ * - Output:
1353
+ * - Boolean ➔ (`true` or `false`).
1354
+ * - ***DefaultValue:*** `false`.
1355
+ *
1356
+ * ---
1357
+ * @default
1358
+ * ```ts
1359
+ * false
1360
+ * ```
1361
+ *
1362
+ * ---
1112
1363
  * @requires `false` or `undefined`
1113
1364
  */
1114
1365
  checkValidOnly?: false;
1115
1366
  /** -------------------------------------------------------
1116
1367
  * * ***Return only the digits of the phone number (local number only).***
1117
- * -------------------------------------------------------
1368
+ * --------------------------------------------------------
1118
1369
  * **Returns a string containing only numeric characters** from the **local number**,
1119
1370
  * 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 ➔ `""`
1371
+ *
1372
+ * ---
1373
+ * - ***Behavior:***
1374
+ * - **Exclusive mode:**
1375
+ * - ⚠️ When set to `true`, all formatting options
1376
+ * (`outputFormat`, `prependPlusCountryCode`, etc.)
1377
+ * and `checkValidOnly` **must be omitted** or will be **ignored**.
1378
+ * - **Conflict handling with `checkValidOnly`:**
1379
+ * - If both `takeNumberOnly` and `checkValidOnly` are `true`,
1380
+ * `checkValidOnly` takes priority and the function
1381
+ * returns a `boolean`.
1382
+ * - If `checkValidOnly` is `false` (or not provided),
1383
+ * and `takeNumberOnly` is `true`,
1384
+ * the function returns a **numeric string of the local number**.
1385
+ * - **Invalid input:**
1386
+ * - If the input is invalid or cannot be parsed
1387
+ * (e.g. not matching the `defaultCountry`),
1388
+ * the function returns an **empty string** (`""`).
1389
+ * - ***DefaultValue:*** `false`.
1390
+ * - ***Output example:***
1391
+ * - Valid input ➔ `"81234567890"` *(country code removed)*.
1392
+ * - Invalid input ➔ `""`.
1393
+ *
1394
+ * ---
1140
1395
  * @default false
1141
1396
  */
1142
1397
  takeNumberOnly: true;
1143
1398
  }>;
1144
1399
  /** -------------------------------------------------------
1145
1400
  * * ***Utility: `formatPhoneNumber`.***
1146
- * -------------------------------------------------------
1401
+ * --------------------------------------------------------
1147
1402
  * **Formats a phone number into a customizable local or international style.**
1403
+ *
1404
+ * ---
1148
1405
  * - **Type:** ***`Formatting Number`.***
1149
1406
  * - **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`).
1407
+ * - Return only digits string when **digits-only mode** (`takeNumberOnly`):
1408
+ * - Return empty-string (""), if invalid number phone.
1409
+ * - Return boolean when **validity-check mode** (`checkValidOnly`):
1410
+ * - ***Return `true` if:***
1411
+ * - A phone number is "valid" when it has valid length, and the actual phone number digits match the
1412
+ * regular expressions for its country (parameter options `defaultCountry`).
1156
1413
  * - **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.
1414
+ * - Optional leading `+` is recommended but **not required**.
1415
+ * - If Without leading `+`, you must passing `defaultCountry`.
1416
+ *
1417
+ * ---
1161
1418
  * @param {ValueFormatPhoneNumber} value
1162
1419
  * ***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).
1420
+ * - `string` (recommended to preserve leading zeros).
1421
+ * - `number` (leading zeros will be lost).
1422
+ * - `null` or `undefined` (returns empty string).
1166
1423
  * @param {FormatPhoneNumberMain} [options]
1167
1424
  * ***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>`.
1425
+ * - `separator` (**string**): Group separator, default `" "`.
1426
+ * - `plusNumberCountry` (**string**): Country code with optional leading `+`.
1427
+ * - `openingNumberCountry` (**string**): Characters before the country code, e.g. `"("`.
1428
+ * - `closingNumberCountry` (**string**): Characters after the country code, e.g. `")"`.
1429
+ * - `checkValidOnly` (**boolean**): Return only validity.
1430
+ * - `takeNumberOnly` (**boolean**): Return digits only.
1431
+ * - `defaultCountry` (**string** - **`<ISO-3166-1 alpha-2>`**): Used to interpret numbers without an explicit `+<countryCode>`.
1432
+ *
1433
+ * ---
1434
+ * @throws **{@link TypeError | `TypeError`}** if `value` is not string, number, null or undefined.
1435
+ * @throws **{@link TypeError | `TypeError`}** if `options` is not an object or contains wrong types.
1436
+ *
1437
+ * ---
1175
1438
  * @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.
1439
+ *
1440
+ * ---
1191
1441
  * @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:***
1442
+ *
1443
+ * 1. #### *Formatting Phone Number String:*
1444
+ * ```ts
1445
+ * formatPhoneNumber("081234567890");
1446
+ * // "0812 3456 7890"
1447
+ * formatPhoneNumber("081234567890", {
1448
+ * separator: "-",
1449
+ * plusNumberCountry: "+44",
1450
+ * openingNumberCountry: "(",
1451
+ * closingNumberCountry: ")"
1452
+ * });
1453
+ * // ➔ "(+44) 8123-4567-890"
1454
+ * ```
1455
+ * ---
1456
+ * 2. #### *Digits-Only Mode:*
1205
1457
  * ```ts
1206
1458
  * formatPhoneNumber("(0812) 3456-7890", {
1207
1459
  * takeNumberOnly: true,
@@ -1230,7 +1482,8 @@ type FormatPhoneNumberAllPassingTakeOnly = OverrideTypes<FormatPhoneNumberMain,
1230
1482
  * formatPhoneNumber("49 (151) 2345 6789", { takeNumberOnly: true });
1231
1483
  * // ➔ ""
1232
1484
  * ```
1233
- * 3. ***Validity-Check Mode:***
1485
+ * ---
1486
+ * 3. #### *Validity-Check Mode:*
1234
1487
  * ```ts
1235
1488
  * formatPhoneNumber("+6281234567890", { checkValidOnly: true });
1236
1489
  * // ➔ true
@@ -1267,29 +1520,39 @@ type FormatPhoneNumberAllPassingTakeOnly = OverrideTypes<FormatPhoneNumberMain,
1267
1520
  declare function formatPhoneNumber(value: ValueFormatPhoneNumber, options?: FormatPhoneNumberTransform): string;
1268
1521
  /** -------------------------------------------------------
1269
1522
  * * ***Utility: `formatPhoneNumber`.***
1270
- * -------------------------------------------------------
1523
+ * --------------------------------------------------------
1271
1524
  * **Formats a phone number into a customizable local or international style.**
1525
+ *
1526
+ * ---
1272
1527
  * - **Type:** ***`Digits-only Mode`.***
1273
1528
  * - **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.
1529
+ * - Return only digits string when **digits-only mode** (`takeNumberOnly`).
1530
+ * - Return boolean when **validity-check mode** (`checkValidOnly`) using a
1531
+ * regex for international-style phone numbers:
1532
+ * - ***Valid if:***
1533
+ * - Only contains digits, optional leading `+`, spaces, parentheses `()`,
1534
+ * hyphens `-`, or dots `.`.
1535
+ * - Digits-only length < 16.
1281
1536
  * - **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.
1537
+ * - Optional leading `+` is recommended but **not required**.
1538
+ * - If Without leading `+`, you must passing `defaultCountry`.
1539
+ *
1540
+ * ---
1286
1541
  * @param {ValueFormatPhoneNumber} value
1287
1542
  * 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).
1543
+ * - `string` (recommended to preserve leading zeros).
1544
+ * - `number` (leading zeros will be lost).
1545
+ * - `null` or `undefined` (returns empty string).
1291
1546
  * @param {FormatPhoneNumberTakeNumberOnly} [options] Options to customize format output (country code, separator, etc).
1547
+ *
1548
+ * ---
1549
+ * @throws **{@link TypeError | `TypeError`}** if `value` is not string, number, null or undefined.
1550
+ * @throws **{@link TypeError | `TypeError`}** if `options` is not an object or contains wrong types.
1551
+ *
1552
+ * ---
1292
1553
  * @returns {string} Digits-only mode, return string a digits-only.
1554
+ *
1555
+ * ---
1293
1556
  * @example
1294
1557
  * ```ts
1295
1558
  * formatPhoneNumber("(0812) 3456-7890", {
@@ -1323,29 +1586,39 @@ declare function formatPhoneNumber(value: ValueFormatPhoneNumber, options?: Form
1323
1586
  declare function formatPhoneNumber(value: ValueFormatPhoneNumber, options?: FormatPhoneNumberTakeNumberOnly): string;
1324
1587
  /** -------------------------------------------------------
1325
1588
  * * ***Utility: `formatPhoneNumber`.***
1326
- * -------------------------------------------------------
1589
+ * --------------------------------------------------------
1327
1590
  * **Formats a phone number into a customizable local or international style.**
1591
+ *
1592
+ * ---
1328
1593
  * - **Type:** ***`Validity-check Mode`.***
1329
1594
  * - **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.
1595
+ * - Return only digits string when **digits-only mode** (`takeNumberOnly`).
1596
+ * - Return boolean when **validity-check mode** (`checkValidOnly`) using a
1597
+ * regex for international-style phone numbers:
1598
+ * - ***Valid if:***
1599
+ * - Only contains digits, optional leading `+`, spaces, parentheses `()`,
1600
+ * hyphens `-`, or dots `.`.
1601
+ * - Digits-only length < 16.
1337
1602
  * - **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.
1603
+ * - Optional leading `+` is recommended but **not required**.
1604
+ * - If Without leading `+`, you must passing `defaultCountry`.
1605
+ *
1606
+ * ---
1342
1607
  * @param {ValueFormatPhoneNumber} value
1343
1608
  * Phone number to format. Accepts:
1344
1609
  * - `string` (recommended to preserve leading zeros).
1345
1610
  * - `number` (leading zeros will be lost).
1346
1611
  * - `null` or `undefined` (returns empty string).
1347
1612
  * @param {FormatPhoneNumberTakeNumberOnly} [options] Options to customize format output (country code, separator, etc).
1613
+ *
1614
+ * ---
1615
+ * @throws **{@link TypeError | `TypeError`}** if `value` is not string, number, null or undefined.
1616
+ * @throws **{@link TypeError | `TypeError`}** if `options` is not an object or contains wrong types.
1617
+ *
1618
+ * ---
1348
1619
  * @returns {boolean} Validity-check mode, return a boolean.
1620
+ *
1621
+ * ---
1349
1622
  * @example
1350
1623
  * ```ts
1351
1624
  * formatPhoneNumber("+6281234567890", { checkValidOnly: true });
@@ -1383,29 +1656,39 @@ declare function formatPhoneNumber(value: ValueFormatPhoneNumber, options?: Form
1383
1656
  declare function formatPhoneNumber(value: ValueFormatPhoneNumber, options?: FormatPhoneNumberCheckValidOnly): boolean;
1384
1657
  /** -------------------------------------------------------
1385
1658
  * * ***Utility: `formatPhoneNumber`.***
1386
- * -------------------------------------------------------
1659
+ * --------------------------------------------------------
1387
1660
  * **Formats a phone number into a customizable local or international style.**
1661
+ *
1662
+ * ---
1388
1663
  * - **Type:** ***Forced to `Validity-check Mode`***, because `checkValidOnly` has set to `true`.
1389
1664
  * - **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.
1665
+ * - Return only digits string when **digits-only mode** (`takeNumberOnly`).
1666
+ * - Return boolean when **validity-check mode** (`checkValidOnly`) using a
1667
+ * regex for international-style phone numbers:
1668
+ * - ***Valid if:***
1669
+ * - Only contains digits, optional leading `+`, spaces, parentheses `()`,
1670
+ * hyphens `-`, or dots `.`.
1671
+ * - Digits-only length < 16.
1397
1672
  * - **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.
1673
+ * - Optional leading `+` is recommended but **not required**.
1674
+ * - If Without leading `+`, you must passing `defaultCountry`.
1675
+ *
1676
+ * ---
1402
1677
  * @param {ValueFormatPhoneNumber} value
1403
1678
  * Phone number to format. Accepts:
1404
1679
  * - `string` (recommended to preserve leading zeros).
1405
1680
  * - `number` (leading zeros will be lost).
1406
1681
  * - `null` or `undefined` (returns empty string).
1407
1682
  * @param {FormatPhoneNumberTakeNumberOnly} [options] Options to customize format output (country code, separator, etc).
1683
+ *
1684
+ * ---
1685
+ * @throws **{@link TypeError | `TypeError`}** if `value` is not string, number, null or undefined.
1686
+ * @throws **{@link TypeError | `TypeError`}** if `options` is not an object or contains wrong types.
1687
+ *
1688
+ * ---
1408
1689
  * @returns {boolean} Validity-check mode, return a boolean.
1690
+ *
1691
+ * ---
1409
1692
  * @example
1410
1693
  * ```ts
1411
1694
  * formatPhoneNumber("+6281234567890", {
@@ -1499,29 +1782,39 @@ declare function formatPhoneNumber(value: ValueFormatPhoneNumber, options?: Form
1499
1782
  declare function formatPhoneNumber(value: ValueFormatPhoneNumber, options?: FormatPhoneNumberAllPassingValidOnly): boolean;
1500
1783
  /** -------------------------------------------------------
1501
1784
  * * ***Utility: `formatPhoneNumber`.***
1502
- * -------------------------------------------------------
1785
+ * --------------------------------------------------------
1503
1786
  * **Formats a phone number into a customizable local or international style.**
1787
+ *
1788
+ * ---
1504
1789
  * - **Type:** ***Forced to `Digits-only Mode`***, because `takeNumberOnly` has set to `true`.
1505
1790
  * - **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.
1791
+ * - Return only digits string when **digits-only mode** (`takeNumberOnly`).
1792
+ * - Return boolean when **validity-check mode** (`checkValidOnly`) using a
1793
+ * regex for international-style phone numbers:
1794
+ * - ***Valid if:***
1795
+ * - Only contains digits, optional leading `+`, spaces, parentheses `()`,
1796
+ * hyphens `-`, or dots `.`.
1797
+ * - Digits-only length < 16.
1513
1798
  * - **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.
1799
+ * - Optional leading `+` is recommended but **not required**.
1800
+ * - If Without leading `+`, you must passing `defaultCountry`.
1801
+ *
1802
+ * ---
1518
1803
  * @param {ValueFormatPhoneNumber} value
1519
- * Phone number to format. Accepts:
1804
+ * Phone number to format. Accepts:
1520
1805
  * - `string` (recommended to preserve leading zeros)
1521
1806
  * - `number` (leading zeros will be lost)
1522
1807
  * - `null` or `undefined` (returns empty string).
1523
1808
  * @param {FormatPhoneNumberTakeNumberOnly} [options] Options to customize format output (country code, separator, etc).
1809
+ *
1810
+ * ---
1811
+ * @throws **{@link TypeError | `TypeError`}** if `value` is not string, number, null or undefined.
1812
+ * @throws **{@link TypeError | `TypeError`}** if `options` is not an object or contains wrong types.
1813
+ *
1814
+ * ---
1524
1815
  * @returns {string} Digits-only mode, return string a digits-only.
1816
+ *
1817
+ * ---
1525
1818
  * @example
1526
1819
  * ```ts
1527
1820
  * formatPhoneNumber("(0812) 3456-7890", {
@@ -1577,30 +1870,40 @@ declare function formatPhoneNumber(value: ValueFormatPhoneNumber, options?: Form
1577
1870
  declare function formatPhoneNumber(value: ValueFormatPhoneNumber, options?: FormatPhoneNumberAllPassingTakeOnly): string;
1578
1871
  /** -------------------------------------------------------
1579
1872
  * * ***Utility: `formatPhoneNumber`.***
1580
- * -------------------------------------------------------
1873
+ * --------------------------------------------------------
1581
1874
  * **Formats a phone number into a customizable local or international style.**
1875
+ *
1876
+ * ---
1582
1877
  * - **Type:** ***Forced to `Validity-check Mode`***, because `checkValidOnly` and `takeNumberOnly` has set to `true`,
1583
- * but `checkValidOnly` will prioritize one.
1878
+ * but `checkValidOnly` will prioritize one.
1584
1879
  * - **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.
1880
+ * - Return only digits string when **digits-only mode** (`takeNumberOnly`).
1881
+ * - Return boolean when **validity-check mode** (`checkValidOnly`) using a
1882
+ * regex for international-style phone numbers:
1883
+ * - ***Valid if:***
1884
+ * - Only contains digits, optional leading `+`, spaces, parentheses `()`,
1885
+ * hyphens `-`, or dots `.`.
1886
+ * - Digits-only length < 16.
1592
1887
  * - **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.
1888
+ * - Optional leading `+` is recommended but **not required**.
1889
+ * - If Without leading `+`, you must passing `defaultCountry`.
1890
+ *
1891
+ * ---
1597
1892
  * @param {ValueFormatPhoneNumber} value
1598
1893
  * Phone number to format. Accepts:
1599
1894
  * - `string` (recommended to preserve leading zeros).
1600
1895
  * - `number` (leading zeros will be lost).
1601
1896
  * - `null` or `undefined` (returns empty string).
1602
1897
  * @param {FormatPhoneNumberTakeNumberOnly} [options] Options to customize format output (country code, separator, etc).
1898
+ *
1899
+ * ---
1900
+ * @throws **{@link TypeError | `TypeError`}** if `value` is not string, number, null or undefined.
1901
+ * @throws **{@link TypeError | `TypeError`}** if `options` is not an object or contains wrong types.
1902
+ *
1903
+ * ---
1603
1904
  * @returns {boolean} Validity-check mode, return a boolean.
1905
+ *
1906
+ * ---
1604
1907
  * @example
1605
1908
  * ```ts
1606
1909
  * formatPhoneNumber("+6281234567890", {
@@ -1719,91 +2022,130 @@ declare function formatPhoneNumber(value: ValueFormatPhoneNumber, options?: Form
1719
2022
  type CensorEmailOptions = {
1720
2023
  /** ----------------------------------------------------------
1721
2024
  * * ***Censorship Mode.***
1722
- * ----------------------------------------------------------
2025
+ * -----------------------------------------------------------
1723
2026
  * - **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.
2027
+ * - `"random"` – Each character is randomly replaced every time the function is called.
2028
+ * - `"fixed"` ***(default)*** Deterministic censorship based on a hash of the email, same input always produces the same output.
2029
+ *
2030
+ * ---
2031
+ * @default "fixed"
1726
2032
  */
1727
2033
  mode?: "random" | "fixed";
1728
2034
  };
1729
2035
  /** ----------------------------------------------------------
1730
2036
  * * ***Utility: `censorEmail`.***
1731
- * ----------------------------------------------------------
2037
+ * -----------------------------------------------------------
1732
2038
  * **Censors an email by replacing characters with `"*"` while supporting random or fixed mode.**
2039
+ *
2040
+ * ---
1733
2041
  * - **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 (`""`).
2042
+ * - **Modes:**
2043
+ * - `"fixed"` **(default)** – Deterministic censorship based on a hash of the email, same input always produces the same output.
2044
+ * - `"random"` – Each character is randomly replaced every time the function is called.
2045
+ * - **Note:**
2046
+ * - Invalid emails or non-string input will return an empty-string (`""`).
2047
+ *
2048
+ * ---
1739
2049
  * @param {string | null | undefined} email - The email address to censor.
1740
2050
  * @param {CensorEmailOptions} [options={}] - Options object for mode.
1741
- * @returns {string} The censored email, or an empty string if input is invalid.
2051
+ *
2052
+ * ---
1742
2053
  * @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
2054
  *
1748
- * // Fixed mode explicitly
1749
- * censorEmail("john.doe@gmail.com", { mode: "fixed" });
1750
- * // ➔ "j**n.**e@g***l.com"
2055
+ * ---
2056
+ * @returns {string} The censored email, or an empty string if input is invalid.
1751
2057
  *
1752
- * // Random mode (output may vary each time)
1753
- * censorEmail("john.doe@gmail.com", { mode: "random" });
1754
- * // ➔ "j*hn.***e@g***l.com" (random)
2058
+ * ---
2059
+ * @example
1755
2060
  *
1756
- * // Invalid email returns empty string
1757
- * censorEmail("invalid-email");
1758
- * // ➔ ""
2061
+ * 1. #### Fixed mode (default, deterministic):
2062
+ * ```ts
2063
+ * censorEmail("john.doe@gmail.com");
2064
+ * // ➔ "j**n.**e@g***l.com"
2065
+ * ```
2066
+ * ---
2067
+ * 2. #### Fixed mode explicitly:
2068
+ * ```ts
2069
+ * censorEmail("john.doe@gmail.com", { mode: "fixed" });
2070
+ * // ➔ "j**n.**e@g***l.com"
2071
+ * ```
2072
+ * ---
2073
+ * 3. #### Random mode (output may vary each time):
2074
+ * ```ts
2075
+ * censorEmail("john.doe@gmail.com", { mode: "random" });
2076
+ * // ➔ "j*hn.***e@g***l.com" (random)
2077
+ * ```
2078
+ * ---
2079
+ * 4. #### Invalid email returns empty string:
2080
+ * ```ts
2081
+ * censorEmail("invalid-email");
2082
+ * // ➔ ""
2083
+ * ```
1759
2084
  */
1760
2085
  declare const censorEmail: (email: string | null | undefined, options?: CensorEmailOptions) => string;
1761
2086
  type ChunkStringOptions = {
1762
- /** ***The separator string to insert between characters or words.***
2087
+ /** ---------------------------------------------------------
2088
+ * * ***The separator string to insert between characters or words.***
2089
+ * ----------------------------------------------------------
1763
2090
  *
1764
- * - Used when inserting separators every `limiter` characters.
1765
- * - Default is a single space `" "`.
2091
+ * - #### *Behavior:*
2092
+ * - Used when inserting separators every `limiter` characters.
2093
+ * - Default is a single space `" "`.
1766
2094
  *
2095
+ * ---
1767
2096
  * @default " "
1768
2097
  */
1769
2098
  separator?: string;
1770
- /** ***Determines whether counting for `limiter` resets after each space.***
2099
+ /** ---------------------------------------------------------
2100
+ * * ***Determines whether counting for `limiter` resets after each space.***
2101
+ * ----------------------------------------------------------
1771
2102
  *
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.
2103
+ * - #### *Behavior:*
2104
+ * - If `true`, the string is treated as words separated by spaces,
2105
+ * and separators are applied within words, then words are grouped.
2106
+ * - If `false` ***(default)***, counting is continuous across the whole string,
2107
+ * treating spaces as normal characters.
1776
2108
  *
2109
+ * ---
1777
2110
  * @default false
1778
2111
  */
1779
2112
  reCountAfterSpace?: boolean;
1780
2113
  };
1781
- /** ----------------------------------------------
2114
+ /** ---------------------------------------------------------
1782
2115
  * * ***Utility: `chunkString`.***
1783
- * ----------------------------------------------
2116
+ * ----------------------------------------------------------
1784
2117
  * **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.
2118
+ *
2119
+ * - #### **This function handles two main behaviors based on `reCountAfterSpace`:**
2120
+ * 1. #### *If `reCountAfterSpace` is `false` (default):*
2121
+ * - The separator is inserted strictly every `limiter` characters throughout the entire string, regardless of spaces, spaces are
2122
+ * treated as regular characters in the count.
2123
+ * - Example: `chunkString("1234567890", 3, "-")` `"123-456-789-0"`.
2124
+ * - Example: `chunkString("Hello World", 3, "-")` `"Hel-lo -Wor-ld"`.
2125
+ * ---
2126
+ * 2. #### *If `reCountAfterSpace` is `true`:*
2127
+ * - The function first processes the input string to replace any multiple consecutive spaces with a
2128
+ * single space (e.g., `"A B"` becomes `"A B"`).
2129
+ * Then, it treats the string as a sequence of **"words"** (segments separated by single spaces).
2130
+ * - Each word is processed independently:
2131
+ * - if a word's length exceeds the `limiter`, separators are inserted internally within that word.
2132
+ * - Words are then grouped. Each group will contain `limiter` number of words.
2133
+ * - Words within the same group are joined by the specified `separator`.
2134
+ * - Finally, these groups are joined by a single space, preserving the original word separation
2135
+ * structure between groups.
2136
+ *
2137
+ * ---
1800
2138
  * @param {string} subject - ***The target string to chunk.****
1801
2139
  * @param {number} limiter
1802
2140
  * ***The interval (number of characters) for inserting separators, behavior:***
1803
2141
  * - If `reCountAfterSpace = false`, it counts characters.
1804
2142
  * - If `reCountAfterSpace = true`, it counts both characters within words and words per group.
1805
2143
  * @param {ChunkStringOptions} [options={}] - ***Optional settings for separator and counting behavior.***
2144
+ *
2145
+ * ---
1806
2146
  * @returns {string} Return the formatted string with separators.
2147
+ *
2148
+ * ---
1807
2149
  * @example
1808
2150
  * // Basic usage
1809
2151
  * chunkString("1234567890", 3);
@@ -1831,19 +2173,25 @@ type ChunkStringOptions = {
1831
2173
  */
1832
2174
  declare function chunkString(subject: string, limiter: number, options?: ChunkStringOptions): string;
1833
2175
  type TruncateStringOptions = {
1834
- /** ***Maximum length of the truncated string **(default: `10`)**.***
2176
+ /** ---------------------------------------------------------
2177
+ * * ***Maximum length of the truncated string **(default: `10`)**.***
2178
+ * ----------------------------------------------------------
1835
2179
  *
1836
2180
  * @default 10
1837
2181
  */
1838
2182
  length?: number;
1839
- /** ***String to append if truncation occurs.***
2183
+ /** ---------------------------------------------------------
2184
+ * * ***String to append if truncation occurs.***
2185
+ * ----------------------------------------------------------
1840
2186
  *
1841
2187
  * - Will be trimmed first; defaults to `"..."` if empty.
1842
2188
  *
1843
2189
  * @default "..."
1844
2190
  */
1845
2191
  ending?: string;
1846
- /** ***Whether to trim the input string before truncation ***(default: `true`)***.***
2192
+ /** ---------------------------------------------------------
2193
+ * * ***Whether to trim the input string before truncation ***(default: `true`)***.***
2194
+ * ----------------------------------------------------------
1847
2195
  *
1848
2196
  * @default true
1849
2197
  */
@@ -1851,22 +2199,30 @@ type TruncateStringOptions = {
1851
2199
  };
1852
2200
  /** ----------------------------------------------------------
1853
2201
  * * ***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 `"..."`.
2202
+ * -----------------------------------------------------------
2203
+ * - **Features:**
2204
+ * - Truncates a string to a specified length and optionally appends an ending.
2205
+ * - Supports trimming the input before truncation.
2206
+ * - If truncation occurs, trailing spaces before the ending are removed.
2207
+ * - The `ending` parameter is always trimmed first; if empty, it defaults to `"..."`.
2208
+ *
2209
+ * ---
1860
2210
  * @param {string|null|undefined} text
1861
2211
  * ***The input string to truncate, behavior:***
1862
2212
  * - If `null`, `undefined`, or empty after trim, returns `""`.
1863
2213
  * @param {TruncateStringOptions} [options]
1864
2214
  * ***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.
2215
+ * - `length` (number, default 10): Maximum length of the truncated string.
2216
+ * - `ending` (string, default `"..."`): String to append if truncation occurs.
2217
+ * - `trim` (boolean, default `true`): Whether to trim the input before truncation.
2218
+ *
2219
+ * ---
1869
2220
  * @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.
2221
+ *
2222
+ * ---
2223
+ * @returns {string} The truncated string with optional trimming and ending, returns `""` if input is empty or length < 1.
2224
+ *
2225
+ * ---
1870
2226
  * @example
1871
2227
  * truncateString("hello world", { length: 5 });
1872
2228
  * // ➔ "hello..."
@@ -1886,7 +2242,7 @@ type TruncateStringOptions = {
1886
2242
  declare const truncateString: (text: string | null | undefined, options?: TruncateStringOptions) => string;
1887
2243
  /** ----------------------------------------------------------------------
1888
2244
  * * ***Options for formatting dates with `date-fns/format`.***
1889
- * ----------------------------------------------------------------------
2245
+ * -----------------------------------------------------------------------
1890
2246
  *
1891
2247
  * Extends the base **{@link FormatOptions | *`FormatOptions`*}** (without **`locale`**) with extra options
1892
2248
  * for handling output formatting, localization, and parsing non-standard inputs.
@@ -1896,23 +2252,43 @@ type FormatDateFnsOptions = Prettify<OmitStrict<FormatOptions, "locale", {
1896
2252
  }> & {
1897
2253
  /** ------------------------------------------------------------
1898
2254
  * * ***Output format string passed to `date-fns/format`.***
1899
- * ------------------------------------------------------------
2255
+ * -------------------------------------------------------------
1900
2256
  * - **Behavior:**
1901
- * - Determines how the date will be rendered.
1902
- * - Uses the full power of `date-fns` tokens.
2257
+ * - Determines how the date will be rendered.
2258
+ * - Uses the full power of `date-fns` tokens.
2259
+ *
2260
+ * ---
1903
2261
  * - ***Default Value***: `"dd MMM yyyy - HH:mm:ss"`.
2262
+ *
2263
+ * ---
2264
+ * @default
2265
+ * ```ts
2266
+ * "dd MMM yyyy - HH:mm:ss"
2267
+ * ```
2268
+ *
2269
+ * ---
1904
2270
  * @example
1905
2271
  * "dd MMMM yyyy, HH:mm:ss" // ➔ "03 September 2025, 10:25:42"
1906
- * @default "dd MMM yyyy - HH:mm:ss"
1907
2272
  */
1908
2273
  format?: string;
1909
2274
  /** ------------------------------------------------------------
1910
2275
  * * ***Locale used for formatting.***
1911
- * ------------------------------------------------------------
2276
+ * -------------------------------------------------------------
1912
2277
  * - **Behavior:**
1913
- * - If `string`: only accepts `"id"` (Indonesian) or `"en"` (English) - **(default)**.
1914
- * - If `Locale`: accepts a locale object from `date-fns/locale`.
2278
+ * - If `string`: only accepts `"id"` (Indonesian) or `"en"` (English) - **(default)**.
2279
+ * - If `Locale`: accepts a locale object from `date-fns/locale`.
2280
+ *
2281
+ * ---
1915
2282
  * - ***Default Value***: `"en"`.
2283
+ *
2284
+ * ---
2285
+ * @default
2286
+ * ```ts
2287
+ * "en"
2288
+ * ```
2289
+ * ---
2290
+ * @example
2291
+ *
1916
2292
  * ```ts
1917
2293
  * import { ar } from "date-fns/locale";
1918
2294
  *
@@ -1922,17 +2298,27 @@ type FormatDateFnsOptions = Prettify<OmitStrict<FormatOptions, "locale", {
1922
2298
  * });
1923
2299
  * // ➔ "03 سبتمبر 2025"
1924
2300
  * ```
1925
- * @default "en"
1926
2301
  */
1927
2302
  locale?: "id" | "en" | AnyString | Locale;
1928
2303
  /** ------------------------------------------------------------
1929
2304
  * * ***Input locale used when parsing non-standard string dates.***
1930
- * ------------------------------------------------------------
2305
+ * -------------------------------------------------------------
1931
2306
  * - **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.
2307
+ * - Required if `date` is a **localized string**
2308
+ * (e.g. `"03 Mei 2025 10:25:42"` in Indonesian).
2309
+ * - Same accepted types as `locale` parameter.
2310
+ *
2311
+ * ---
1935
2312
  * - ***Default Value***: `"en"`.
2313
+ *
2314
+ * ---
2315
+ * @default
2316
+ * ```ts
2317
+ * "en"
2318
+ * ```
2319
+ *
2320
+ * ---
2321
+ * @example
1936
2322
  * ```ts
1937
2323
  * import { ar } from "date-fns/locale";
1938
2324
  *
@@ -1943,58 +2329,74 @@ type FormatDateFnsOptions = Prettify<OmitStrict<FormatOptions, "locale", {
1943
2329
  * });
1944
2330
  * // ➔ "May 3, 2025 at 10:25:42 AM"
1945
2331
  * ```
1946
- * @default "en"
1947
2332
  */
1948
2333
  inputLocale?: "id" | "en" | AnyString | Locale;
1949
2334
  /** ------------------------------------------------------------
1950
2335
  * * ***Input format string for parsing non-ISO string dates.***
1951
- * ------------------------------------------------------------
2336
+ * -------------------------------------------------------------
1952
2337
  * - **Behavior:**
1953
- * - Required if `date` is **not ISO-8601** and not a native `Date`.
1954
- * - Works together with `inputLocale` parameter.
2338
+ * - Required if `date` is **not ISO-8601** and not a native `Date`.
2339
+ * - Works together with `inputLocale` parameter.
2340
+ *
2341
+ * ---
1955
2342
  * - ***Default Value***: `undefined`.
1956
- * @default undefined
2343
+ *
2344
+ * ---
2345
+ * @default
2346
+ * ```ts
2347
+ * undefined
2348
+ * ```
2349
+ *
2350
+ * ---
1957
2351
  * @example
1958
2352
  * "dd MMMM yyyy HH:mm:ss" // ➔ "03 May 2025 10:25:42"
1959
2353
  */
1960
2354
  inputFormat?: string;
1961
2355
  }>;
1962
- /** ----------------------------------------------------------
2356
+ /** --------------------------------------------------------------------------------------------------
1963
2357
  * * ***Utility: `formatDateFns`.***
1964
- * ----------------------------------------------------------
2358
+ * ---------------------------------------------------------------------------------------------------
1965
2359
  * **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.
2360
+ *
2361
+ * ---
2362
+ * - **Features:**
2363
+ * - Supports custom output formats using `date-fns/format`.
2364
+ * - Can parse localized non-ISO strings via `inputFormat` & `inputLocale`.
2365
+ * - Supports `locale` as `"id"`, `"en"` or `date-fns` `Locale` objects (like `id` or `enUS`).
2366
+ * - Returns `null` if the date is invalid, not provided, or parsing fails.
2367
+ *
2368
+ * ---
1971
2369
  * @param {string | Date | null | undefined} date
1972
2370
  * ***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`).
2371
+ * - A `Date` object.
2372
+ * - An ISO string (e.g. `"2024-01-01T12:00:00Z"`).
2373
+ * - A localized string (requires `inputFormat` + `inputLocale`).
1976
2374
  * @param {FormatDateFnsOptions} [options] ***Options for formatting and parsing.***
1977
2375
  * @param {FormatDateFnsOptions["format"]} [options.format="dd MMM yyyy - HH:mm:ss"]
1978
2376
  * ***The output format string (passed to `date-fns/format`), e.g:***
1979
- * - `"dd MMMM yyyy, HH:mm:ss" ➔ "14 Juli 2025, 17:25:42"`.
2377
+ * - `"dd MMMM yyyy, HH:mm:ss" ➔ "14 Juli 2025, 17:25:42"`.
1980
2378
  * @param {FormatDateFnsOptions["locale"]} [options.locale="id"]
1981
2379
  * The output locale. If string, only `"id"` (Indonesian) or `"en"` (English)
1982
2380
  * is recognized. Or you can pass a `date-fns` `Locale` object.
1983
2381
  * - Example:
1984
- * ```ts
1985
- * import { ar } from "date-fns/locale";
1986
- * formatDateFns(new Date(), { locale: ar, format: "PPPppp" });
1987
- * ```
2382
+ * ```ts
2383
+ * import { ar } from "date-fns/locale";
2384
+ * formatDateFns(new Date(), { locale: ar, format: "PPPppp" });
2385
+ * ```
1988
2386
  * @param {FormatDateFnsOptions["inputLocale"]} [options.inputLocale]
1989
- * Required if `date` is a localized non-ISO string. Used with `inputFormat`.
2387
+ * Required if `date` is a localized non-ISO string. Used with `inputFormat`.
1990
2388
  * - Example for Indonesian string:
1991
- * ```ts
1992
- * formatDateFns("14 Juli 2025 10:25:42", { inputFormat: "dd MMMM yyyy HH:mm:ss", inputLocale: "id" });
1993
- * ```
2389
+ * ```ts
2390
+ * formatDateFns("14 Juli 2025 10:25:42", { inputFormat: "dd MMMM yyyy HH:mm:ss", inputLocale: "id" });
2391
+ * ```
1994
2392
  * @param {FormatDateFnsOptions["inputFormat"]} [options.inputFormat]
1995
2393
  * The format string to parse `date` if it is a non-ISO string.
1996
2394
  * Required together with `inputLocale`.
2395
+ *
2396
+ * ---
1997
2397
  * @returns {string | null} A formatted date string or `null` if input is invalid.
2398
+ *
2399
+ * ---
1998
2400
  * @example
1999
2401
  * formatDateFns(new Date());
2000
2402
  * // ➔ "14 Jul 2025 - 17:25:42"
@@ -2012,14 +2414,18 @@ type FormatDateFnsOptions = Prettify<OmitStrict<FormatOptions, "locale", {
2012
2414
  declare const formatDateFns: (date: string | Date | null | undefined, options?: FormatDateFnsOptions) => string | null;
2013
2415
  /** -------------------------------------------------------------
2014
2416
  * * ***Supported IETF BCP-47 locale codes for Intl API.***
2015
- * -------------------------------------------------------------
2417
+ * --------------------------------------------------------------
2016
2418
  * **This type ensures proper autocompletion & validation in TS
2017
2419
  * but does not restrict at runtime (must validate separately).**
2420
+ *
2421
+ * ---
2018
2422
  * - **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.
2423
+ * - Major global locales (`en-US`, `fr-FR`, `zh-CN`, `etc`).
2424
+ * - Regional & minor locales (`mi-NZ`, `rw-RW`, `bi-VU`, `etc`).
2425
+ * - Useful for `Intl.DateTimeFormat`, `Intl.NumberFormat`, `etc`.
2426
+ * - Still allows fallback via `({} & string)` for arbitrary locales.
2427
+ *
2428
+ * ---
2023
2429
  * @example
2024
2430
  * const locale: SupportedLocales = "fr-CA";
2025
2431
  * new Intl.DateTimeFormat(locale).format(new Date());
@@ -2027,7 +2433,7 @@ declare const formatDateFns: (date: string | Date | null | undefined, options?:
2027
2433
  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
2434
  /** ----------------------------------------------------------------
2029
2435
  * * ***Options for formatting dates with `Intl.DateTimeFormat`.***
2030
- * ----------------------------------------------------------------
2436
+ * -----------------------------------------------------------------
2031
2437
  * **Extends the native
2032
2438
  * **{@link Intl.DateTimeFormatOptions | `Intl.DateTimeFormatOptions`}** with
2033
2439
  * an additional `locale` property that is validated against **{@link SupportedLocales | `SupportedLocales`}**.**
@@ -2035,13 +2441,20 @@ type SupportedLocales = "en-US" | "en-GB" | "en-AU" | "en-CA" | "en-NZ" | "en-ZA
2035
2441
  type FormatDateIntlOptions = Prettify<Intl.DateTimeFormatOptions & {
2036
2442
  /** ------------------------------------------------------------
2037
2443
  * * ***Locale for date formatting.***
2038
- * ------------------------------------------------------------
2444
+ * -------------------------------------------------------------
2039
2445
  * - **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"
2446
+ * - Must be a valid [***BCP-47 locale***](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locales_argument),
2447
+ * validated against {@link SupportedLocales | **`SupportedLocales`**}.
2448
+ * - If `locale` is `undefined` or an empty string (after trimming),
2449
+ * it will **default to `"en-US"`**.
2450
+ *
2451
+ * ---
2452
+ * @default
2453
+ * ```ts
2454
+ * "en-US"
2455
+ * ```
2456
+ *
2457
+ * ---
2045
2458
  * @example
2046
2459
  * { year: "numeric", month: "long" }
2047
2460
  * // Unset locale, default locale ➔ "en-US"
@@ -2055,23 +2468,32 @@ type FormatDateIntlOptions = Prettify<Intl.DateTimeFormatOptions & {
2055
2468
  */
2056
2469
  locale?: SupportedLocales;
2057
2470
  }>;
2058
- /** ----------------------------------------------------------
2471
+ /** ------------------------------------------------------------------------------------------
2059
2472
  * * ***Utility: `formatDateIntl`.***
2060
- * ----------------------------------------------------------
2473
+ * -------------------------------------------------------------------------------------------
2061
2474
  * **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.
2475
+ *
2476
+ * ---
2477
+ * - **Features:**
2478
+ * - Supports custom locales (type-safe `SupportedLocales`).
2479
+ * - Accepts additional `Intl.DateTimeFormatOptions` like `timeZone`, `hour12`, etc.
2480
+ * - Defaults to `"en-US"` if `locale` is not provided or is an empty string.
2481
+ * - Returns `null` if the date is invalid, not provided, or options are invalid.
2482
+ *
2483
+ * ---
2067
2484
  * @param {string | Date | null | undefined} date
2068
2485
  * ***The date to format.***
2069
- * - Can be a `Date` object or an ISO string.
2070
- * - If invalid or not provided, returns `null`.
2486
+ * - Can be a `Date` object or an ISO string.
2487
+ * - If invalid or not provided, returns `null`.
2488
+ *
2071
2489
  * @param {FormatDateIntlOptions} [options] ***Optional formatting options for `Intl.DateTimeFormat`, use `locale` to specify the language & region format.***
2490
+ *
2491
+ * ---
2072
2492
  * @returns {string | null}
2073
2493
  * - Formatted date string.
2074
2494
  * - Returns `null` if date is invalid or options are of wrong type.
2495
+ *
2496
+ * ---
2075
2497
  * @example
2076
2498
  * formatDateIntl(new Date());
2077
2499
  * // ➔ "7/14/2025"
@@ -2083,18 +2505,26 @@ type FormatDateIntlOptions = Prettify<Intl.DateTimeFormatOptions & {
2083
2505
  * // ➔ "01:30 AM"
2084
2506
  */
2085
2507
  declare const formatDateIntl: (date: string | Date | null | undefined, options?: FormatDateIntlOptions) => string | null;
2086
- /** ----------------------------------------------------------
2508
+ /** -----------------------------------------------------------------------------------
2087
2509
  * * ***Utility: `formatDateTime`.***
2088
- * ----------------------------------------------------------
2510
+ * ------------------------------------------------------------------------------------
2089
2511
  * **Formats a date and time into a custom string format.**
2512
+ *
2513
+ * ---
2090
2514
  * - **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.
2515
+ * - Supports only `YYYY`, `MM`, `DD`, `hh`, `mm`, and `ss` as placeholders.
2516
+ * - Uses a simple string replace (no locale).
2517
+ * - Returns `null` if the date is invalid or not provided.
2518
+ * - Defaults to `"YYYY-MM-DD hh:mm:ss"` format if none is specified.
2519
+ *
2520
+ * ---
2095
2521
  * @param {string | Date | null| undefined} date - The date to format.
2096
2522
  * @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"`.
2523
+ *
2524
+ * ---
2097
2525
  * @returns {string | null} The formatted date string or `null` if invalid.
2526
+ *
2527
+ * ---
2098
2528
  * @example
2099
2529
  * formatDateTime(new Date());
2100
2530
  * // ➔ "2024-02-09 14:30:45" (example output with current time)
@@ -2124,24 +2554,32 @@ declare const formatDateIntl: (date: string | Date | null | undefined, options?:
2124
2554
  * // ➔ null
2125
2555
  */
2126
2556
  declare const formatDateTime: (date: string | Date | null | undefined, format?: string) => string | null;
2127
- /** ----------------------------------------------------------
2557
+ /** ----------------------------------------------------------------------------------------------
2128
2558
  * * ***Utility: `getGMTOffset`.***
2129
- * ----------------------------------------------------------
2559
+ * -----------------------------------------------------------------------------------------------
2130
2560
  * **Returns the formatted GMT offset (e.g., `+0700`, `-0500`) for a given date.**
2561
+ *
2562
+ * ---
2131
2563
  * - **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.
2564
+ * - If `date` is **not provided** or empty string, it defaults to the current date/time.
2565
+ * - If `date` is **invalid** or of wrong type (like object or number), it returns `"0"`.
2566
+ * - The returned string follows the **GMT offset format** (`±HHMM`), where:
2567
+ * - `±` is `+` if ahead of UTC, `-` if behind.
2568
+ * - `HH` is two-digit hours.
2569
+ * - `MM` is two-digit minutes.
2570
+ *
2571
+ * ---
2138
2572
  * @param {string | Date | null} [date]
2139
2573
  * ***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"`.
2574
+ * - Accepts `Date` object or ISO date string (e.g., `"2024-01-01T12:00:00Z"`).
2575
+ * - If `null`, `undefined`, or empty string, uses current system date.
2576
+ * - If invalid date or wrong type (like `123` or `{}`), returns `"0"`.
2577
+ *
2578
+ * ---
2143
2579
  * @returns {string} The GMT offset string in format `±HHMM`,
2144
2580
  * e.g. `"+0700"`, `"-0530"`, or `"0"` if invalid.
2581
+ *
2582
+ * ---
2145
2583
  * @example
2146
2584
  * getGMTOffset();
2147
2585
  * // ➔ "+0700" (depends on your system timezone)