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