@rzl-zone/utils-js 3.0.2-beta.2 → 3.1.1-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (164) hide show
  1. package/dist/NumberRangeUnion-DC-C3_Kq.d.ts +23 -23
  2. package/dist/any-BmdI8UbK.d.ts +56 -56
  3. package/dist/arrays-normalize-recursive-CnjYJ9xg.d.ts +66 -66
  4. package/dist/assertions/index.cjs +1 -1
  5. package/dist/assertions/index.d.ts +398 -418
  6. package/dist/assertions/index.js +1 -1
  7. package/dist/chunk-26W3VZIK.cjs +1 -0
  8. package/dist/chunk-2KRCHXFG.cjs +2 -0
  9. package/dist/chunk-33ZLH266.js +1 -0
  10. package/dist/{chunk-EXZ47NOW.js → chunk-4L4EJTNZ.js} +1 -1
  11. package/dist/chunk-5Q37AP7P.js +1 -0
  12. package/dist/chunk-7CHFAMS2.js +1 -0
  13. package/dist/chunk-7MMJZ6HS.js +1 -0
  14. package/dist/chunk-7TC6DE3J.cjs +1 -0
  15. package/dist/{chunk-XH6MCRLP.js → chunk-7VX33E3V.js} +1 -1
  16. package/dist/chunk-BEZPD44N.cjs +1 -0
  17. package/dist/chunk-BI263OHW.js +1 -0
  18. package/dist/chunk-CII6WWLO.cjs +1 -0
  19. package/dist/chunk-D5TYPCWU.cjs +1 -0
  20. package/dist/chunk-EEQY5QUG.js +1 -0
  21. package/dist/chunk-ESJYBIYH.js +1 -0
  22. package/dist/chunk-EWYPSKKM.js +1 -0
  23. package/dist/chunk-EXCOQLWX.cjs +1 -0
  24. package/dist/chunk-FWQVTMYA.cjs +1 -0
  25. package/dist/chunk-G4EWCRKS.js +1 -0
  26. package/dist/chunk-G7R5XZRM.cjs +1 -0
  27. package/dist/chunk-GGEV7LXX.cjs +1 -0
  28. package/dist/chunk-HJOZOENU.cjs +1 -0
  29. package/dist/{chunk-BYZAD3XN.cjs → chunk-IRDZVLNZ.cjs} +1 -1
  30. package/dist/chunk-IW73G523.cjs +1 -0
  31. package/dist/chunk-IY5OZAB3.cjs +1 -0
  32. package/dist/chunk-J4NCYYGS.js +1 -0
  33. package/dist/chunk-J7JAZAJD.js +1 -0
  34. package/dist/{chunk-FF76ISQ2.js → chunk-JYNSO7ZY.js} +1 -1
  35. package/dist/chunk-K3UVKYEU.js +1 -0
  36. package/dist/chunk-LQ76EDZG.js +1 -0
  37. package/dist/chunk-MROH35V3.cjs +1 -0
  38. package/dist/chunk-NJSAV73S.js +1 -0
  39. package/dist/chunk-NR44SNYE.js +1 -0
  40. package/dist/chunk-NXMTWY77.js +1 -0
  41. package/dist/chunk-OZCQZO2V.cjs +4 -0
  42. package/dist/chunk-Q3NTKN5I.cjs +1 -0
  43. package/dist/chunk-QDNSC57Z.js +4 -0
  44. package/dist/chunk-QGXTL5ZH.js +2 -0
  45. package/dist/{chunk-JWHM3WZQ.cjs → chunk-QSQDP7L2.cjs} +1 -1
  46. package/dist/{chunk-RN3TP3S3.js → chunk-S5M33A4O.js} +1 -1
  47. package/dist/chunk-SGTHOQQ2.js +1 -0
  48. package/dist/chunk-SL3RQOWA.js +1 -0
  49. package/dist/chunk-SZPWZZYG.cjs +1 -0
  50. package/dist/chunk-UA4B7JBO.cjs +1 -0
  51. package/dist/chunk-UQDJF5RR.cjs +1 -0
  52. package/dist/chunk-UTQUYABU.cjs +1 -0
  53. package/dist/chunk-VPW3DRV5.js +1 -0
  54. package/dist/chunk-W32WALNU.js +1 -0
  55. package/dist/chunk-XGZ6K753.cjs +1 -0
  56. package/dist/chunk-YFTR64N5.cjs +1 -0
  57. package/dist/chunk-ZFDS7W6B.cjs +1 -0
  58. package/dist/chunk-ZQOLZE6Z.cjs +1 -0
  59. package/dist/conversions/index.cjs +1 -1
  60. package/dist/conversions/index.d.ts +1307 -1504
  61. package/dist/conversions/index.js +1 -1
  62. package/dist/env/index.d.ts +14 -17
  63. package/dist/events/index.cjs +1 -1
  64. package/dist/events/index.d.ts +111 -108
  65. package/dist/events/index.js +1 -1
  66. package/dist/extends-Bk_SBGdT.d.ts +367 -0
  67. package/dist/formatting/index.cjs +1 -1
  68. package/dist/formatting/index.d.ts +878 -840
  69. package/dist/formatting/index.js +1 -1
  70. package/dist/generator/index.cjs +1 -1
  71. package/dist/generator/index.d.ts +173 -150
  72. package/dist/generator/index.js +1 -1
  73. package/dist/if-CvT4R7Kh.d.ts +16 -16
  74. package/dist/index.cjs +1 -1
  75. package/dist/index.d.ts +1 -1
  76. package/dist/index.js +1 -1
  77. package/dist/is-array--YjXV-Wx.d.ts +1207 -0
  78. package/dist/isPlainObject-BVhBAPHX.d.ts +169 -0
  79. package/dist/never-BfayMBF9.d.ts +64 -64
  80. package/dist/next/index.cjs +6 -6
  81. package/dist/next/index.d.ts +196 -176
  82. package/dist/next/index.js +5 -5
  83. package/dist/next/server/index.cjs +1 -1
  84. package/dist/next/server/index.d.ts +26 -40
  85. package/dist/next/server/index.js +1 -1
  86. package/dist/nils-DMz3kU7M.d.ts +155 -155
  87. package/dist/omit-VvmIsZmX.d.ts +25 -25
  88. package/dist/operations/index.cjs +1 -1
  89. package/dist/operations/index.d.ts +121 -176
  90. package/dist/operations/index.js +1 -1
  91. package/dist/parsers/index.cjs +1 -1
  92. package/dist/parsers/index.d.ts +35 -36
  93. package/dist/parsers/index.js +1 -1
  94. package/dist/predicates/index.cjs +1 -1
  95. package/dist/predicates/index.d.ts +1701 -1675
  96. package/dist/predicates/index.js +1 -1
  97. package/dist/prettify-C4xLcYOP.d.ts +328 -328
  98. package/dist/promise/index.cjs +1 -1
  99. package/dist/promise/index.d.ts +29 -38
  100. package/dist/promise/index.js +1 -1
  101. package/dist/rzl-utils.global.js +3 -3
  102. package/dist/string-XA-til3C.d.ts +351 -0
  103. package/dist/strings/index.cjs +1 -1
  104. package/dist/strings/index.d.ts +712 -787
  105. package/dist/strings/index.js +1 -1
  106. package/dist/stylings/index.cjs +1 -1
  107. package/dist/stylings/index.d.ts +37 -45
  108. package/dist/stylings/index.js +1 -1
  109. package/dist/type-data-DDs-u2kq.d.ts +241 -241
  110. package/dist/types/index.d.ts +3266 -3266
  111. package/dist/urls/index.cjs +1 -1
  112. package/dist/urls/index.d.ts +384 -409
  113. package/dist/urls/index.js +1 -1
  114. package/package.json +53 -11
  115. package/dist/array-CIZRbqTF.d.ts +0 -223
  116. package/dist/chunk-2TRAPBZ7.cjs +0 -1
  117. package/dist/chunk-3D74QO5D.cjs +0 -1
  118. package/dist/chunk-4DK3RCC4.js +0 -2
  119. package/dist/chunk-4JOQ45HL.js +0 -1
  120. package/dist/chunk-55CZALRS.js +0 -1
  121. package/dist/chunk-5JFV3GDE.cjs +0 -4
  122. package/dist/chunk-62HX5Z45.cjs +0 -1
  123. package/dist/chunk-7NA6DUHR.cjs +0 -2
  124. package/dist/chunk-BVPMMWDL.cjs +0 -1
  125. package/dist/chunk-CEFYHEM4.cjs +0 -1
  126. package/dist/chunk-CN53M4QZ.cjs +0 -1
  127. package/dist/chunk-D47MHBSD.cjs +0 -1
  128. package/dist/chunk-DGH75GJD.js +0 -1
  129. package/dist/chunk-E5NUI7PN.js +0 -1
  130. package/dist/chunk-FDITZ5C6.cjs +0 -1
  131. package/dist/chunk-FSSV24W7.cjs +0 -1
  132. package/dist/chunk-GCGU2WB7.js +0 -1
  133. package/dist/chunk-GECI2YBP.js +0 -1
  134. package/dist/chunk-GQE4OVHC.cjs +0 -1
  135. package/dist/chunk-GRVZXQXL.cjs +0 -1
  136. package/dist/chunk-I4AVNHPA.cjs +0 -1
  137. package/dist/chunk-JFRL7NKU.js +0 -4
  138. package/dist/chunk-KCQDDZJE.cjs +0 -1
  139. package/dist/chunk-L54ZPSYJ.js +0 -1
  140. package/dist/chunk-LVKAYEZ4.js +0 -1
  141. package/dist/chunk-MBDWTK54.cjs +0 -1
  142. package/dist/chunk-MNGGDB2G.js +0 -1
  143. package/dist/chunk-MY7BA4GI.cjs +0 -1
  144. package/dist/chunk-N2IJPIND.cjs +0 -1
  145. package/dist/chunk-NIMNTEGV.js +0 -1
  146. package/dist/chunk-PVJF2JHM.js +0 -1
  147. package/dist/chunk-QCFXEUKL.js +0 -1
  148. package/dist/chunk-QFCGBBSY.js +0 -1
  149. package/dist/chunk-QQYAUPSK.cjs +0 -1
  150. package/dist/chunk-TC4VBE4Y.cjs +0 -1
  151. package/dist/chunk-TUXDINHF.cjs +0 -1
  152. package/dist/chunk-U5Y2FXMN.cjs +0 -1
  153. package/dist/chunk-UUPQI6ND.cjs +0 -1
  154. package/dist/chunk-VYCGZ2S6.js +0 -1
  155. package/dist/chunk-W5EDKJK3.js +0 -1
  156. package/dist/chunk-WHAVUFEU.js +0 -1
  157. package/dist/chunk-XCFIOTCV.js +0 -1
  158. package/dist/chunk-XE27XPJR.js +0 -1
  159. package/dist/chunk-XVB3ZZEB.js +0 -1
  160. package/dist/chunk-ZBSIGJFO.cjs +0 -1
  161. package/dist/chunk-ZYAML74V.js +0 -1
  162. package/dist/extends-Mp81Hq9-.d.ts +0 -145
  163. package/dist/is-array-Ckm_47hw.d.ts +0 -1557
  164. package/dist/isPlainObject-BKYaI6a8.d.ts +0 -182
@@ -1,4 +1,4 @@
1
- import{O as OmitStrict}from'../omit-VvmIsZmX.js';import{Locale}from'date-fns/locale';import{FormatOptions}from'date-fns';import'../prettify-C4xLcYOP.js';import'../if-CvT4R7Kh.js';import'../type-data-DDs-u2kq.js';import'../never-BfayMBF9.js';type ValueFormatPhoneNumber=string|number|null;type FormatPhoneNumberProps={
1
+ import{O as OmitStrict}from'../omit-VvmIsZmX.js';import{FormatOptions,Locale}from'date-fns';import{A as AnyString}from'../string-XA-til3C.js';import{P as Prettify}from'../prettify-C4xLcYOP.js';import'../if-CvT4R7Kh.js';import'../never-BfayMBF9.js';import'../type-data-DDs-u2kq.js';type ValueFormatPhoneNumber=string|number|null;type FormatPhoneNumberProps={
2
2
  /** @default " " */
3
3
  separator?:string;
4
4
  /** @default "" */
@@ -16,897 +16,935 @@ checkValidOnly?:false;
16
16
  /** @default false */
17
17
  takeNumberOnly?:false;};type FormatPhoneNumberPropsBoolean=OmitStrict<FormatPhoneNumberProps,"separator"|"plusNumberCountry"|"closingNumberCountry"|"openingNumberCountry"|"takeNumberOnly">;type FormatPhoneNumberPropsTransform=OmitStrict<FormatPhoneNumberProps,"separator"|"plusNumberCountry"|"closingNumberCountry"|"openingNumberCountry"|"checkValidOnly">;type NegativeFormatOptionCustom={
18
18
  /** Custom formatter function for the final formatted negative string.
19
- * If provided, it OVERRIDES style & space entirely. */
19
+ * If provided, it OVERRIDES style & space entirely. */
20
20
  custom:(formatted:string)=>string;style?:never;space?:never;};type NegativeFormatOptionUnCustom={custom?:never;
21
21
  /** Use style & optional spacing for negative numbers.
22
- *
23
- * @default "dash"
24
- */
22
+ *
23
+ * @default "dash"
24
+ */
25
25
  style?:"dash"|"brackets"|"abs";
26
26
  /** Whether to include space inside brackets or after dash.
27
- *
28
- * Default: false
29
- * @default false
30
- */
27
+ *
28
+ * Default: false
29
+ * @default false
30
+ */
31
31
  space?:boolean;};
32
32
  /** ---------------------------------------------------------------------------
33
- * * ***Type for negative number formatting options.***
34
- * ---------------------------------------------------------------------------
35
- */
33
+ * * ***Type for negative number formatting options.***
34
+ * ---------------------------------------------------------------------------
35
+ */
36
36
  type NegativeFormatOption="dash"|"brackets"|"abs"|NegativeFormatOptionCustom|NegativeFormatOptionUnCustom;
37
37
  /** ---------------------------------------------------------------------------
38
- * * ***Options for `formatCurrency()`***
39
- * ---------------------------------------------------------------------------
40
- */
38
+ * * ***Options for `formatCurrency()`***
39
+ * ---------------------------------------------------------------------------
40
+ */
41
41
  type FormatCurrencyOptions={
42
42
  /** ---------------------------------------------------------------------------
43
- * * ***Prefix currency string.***
44
- * ---------------------------------------------------------------------------
45
- *
46
- * Does not auto-keep input symbols.
47
- *
48
- * Example: `"Rp "` ➔ `Rp 1.000`.
49
- *
50
- * *DefaultValue: `""`.*
51
- *
52
- * @default ""
53
- */
43
+ * * ***Prefix currency string.***
44
+ * ---------------------------------------------------------------------------
45
+ *
46
+ * Does not auto-keep input symbols.
47
+ *
48
+ * Example: `"Rp "` ➔ `Rp 1.000`.
49
+ *
50
+ * *DefaultValue: `""`.*
51
+ *
52
+ * @default ""
53
+ */
54
54
  suffixCurrency?:string;
55
55
  /** ---------------------------------------------------------------------------
56
- * * ***Thousands separator.***
57
- * ---------------------------------------------------------------------------
58
- *
59
- * Example: `"."` ➔ `1.000.000`.
60
- *
61
- * *DefaultValue: `"."`.*
62
- *
63
- * @default "."
64
- */
56
+ * * ***Thousands separator.***
57
+ * ---------------------------------------------------------------------------
58
+ *
59
+ * Example: `"."` ➔ `1.000.000`.
60
+ *
61
+ * *DefaultValue: `"."`.*
62
+ *
63
+ * @default "."
64
+ */
65
65
  separator?:string;
66
66
  /** ---------------------------------------------------------------------------
67
- * * ***Prefix currency string.***
68
- * ---------------------------------------------------------------------------
69
- *
70
- * If `false`, rounds to integer.
71
- *
72
- * *DefaultValue: `false`.*
73
- *
74
- * @default false
75
- */
67
+ * * ***Prefix currency string.***
68
+ * ---------------------------------------------------------------------------
69
+ * Whether to show decimals. If `false`, decimals are truncated.
70
+ *
71
+ * *DefaultValue: `false`.*
72
+ *
73
+ * @default false
74
+ */
76
75
  decimal?:boolean;
77
76
  /** ---------------------------------------------------------------------------
78
- * * ***Total decimal digits.***
79
- * ---------------------------------------------------------------------------
80
- *
81
- * If `decimal: true` & `roundedDecimal: false`, simply cuts.
82
- *
83
- * *DefaultValue: `2`.*
84
- *
85
- * @default 2
86
- */
77
+ * * ***Total decimal digits.***
78
+ * ---------------------------------------------------------------------------
79
+ *
80
+ * If `decimal: true` & `roundedDecimal: false`, simply cuts.
81
+ *
82
+ * *DefaultValue: `2`.*
83
+ *
84
+ * @default 2
85
+ */
87
86
  totalDecimal?:number;
88
87
  /** ---------------------------------------------------------------------------
89
- * * ***Actually append `suffixDecimal`.***
90
- * ---------------------------------------------------------------------------
91
- *
92
- * *DefaultValue: `true`.*
93
- *
94
- * @default true
95
- */
88
+ * * ***Actually append `suffixDecimal`.***
89
+ * ---------------------------------------------------------------------------
90
+ *
91
+ * *DefaultValue: `true`.*
92
+ *
93
+ * @default true
94
+ */
96
95
  endDecimal?:boolean;
97
96
  /** ---------------------------------------------------------------------------
98
- * * ***Text appended after decimals.***
99
- * ---------------------------------------------------------------------------
100
- *
101
- * E.g: (`".-"`, `" USD"`).
102
- *
103
- * *Example 1: `".-"` ➔ `1.000,00.-`.*
104
- *
105
- * *Example 2: `" USD"` ➔ `1.000,00 USD`.*
106
- *
107
- * *DefaultValue: `""`.*
108
- *
109
- * @default ""
110
- */
97
+ * * ***Text appended after decimals.***
98
+ * ---------------------------------------------------------------------------
99
+ *
100
+ * E.g: (`".-"`, `" USD"`).
101
+ *
102
+ * *Example 1: `".-"` ➔ `1.000,00.-`.*
103
+ *
104
+ * *Example 2: `" USD"` ➔ `1.000,00 USD`.*
105
+ *
106
+ * *DefaultValue: `""`.*
107
+ *
108
+ * @default ""
109
+ */
111
110
  suffixDecimal?:string;
112
111
  /** ---------------------------------------------------------------------------
113
- * * ***Rounding mode for decimals.***
114
- * ---------------------------------------------------------------------------
115
- *
116
- * - `"round"` ➔ nearest
117
- * - `"ceil"` ➔ always up
118
- * - `"floor"` ➔ always down
119
- * - `false` ➔ truncate
120
- *
121
- * *DefaultValue: `"round"`.*
122
- *
123
- * @default "round"
124
- */
112
+ * * ***Rounding mode for decimals.***
113
+ * ---------------------------------------------------------------------------
114
+ *
115
+ * - `"round"` ➔ nearest
116
+ * - `"ceil"` ➔ always up
117
+ * - `"floor"` ➔ always down
118
+ * - `false` ➔ truncate
119
+ *
120
+ * *DefaultValue: `"round"`.*
121
+ *
122
+ * @default "round"
123
+ */
125
124
  roundedDecimal?:"round"|"ceil"|"floor"|false;
126
125
  /** ---------------------------------------------------------------------------
127
- * * ***Decimal separator.***
128
- * ---------------------------------------------------------------------------
129
- *
130
- * Example: `","` ➔ `1.000,10`
131
- *
132
- * *DefaultValue: `","`.*
133
- *
134
- * @default ","
135
- */
126
+ * * ***Decimal separator.***
127
+ * ---------------------------------------------------------------------------
128
+ *
129
+ * Example: `","` ➔ `1.000,10`
130
+ *
131
+ * *DefaultValue: `","`.*
132
+ *
133
+ * @default ","
134
+ */
136
135
  separatorDecimals?:string;
137
136
  /** ---------------------------------------------------------------------------
138
- * * ***Negative formatting option.***
139
- * ---------------------------------------------------------------------------
140
- *
141
- * Can be string ("dash" | "brackets" | "abs") or object with custom formatter.
142
- *
143
- * - `"dash"` ➔ `-15.000`
144
- * - `"brackets"` ➔ `(15.000)`
145
- * - `"abs"` ➔ `15.000` (always positive)
146
- * - Or object:
147
- * `{
148
- * style: "dash"|"brackets"|"abs",
149
- * space: true|false,
150
- * custom: (formatted) => string
151
- * }`.
152
- *
153
- * *DefaultValue: `"dash"`.*
154
- *
155
- * @default "dash"
156
- */
137
+ * * ***Negative formatting option.***
138
+ * ---------------------------------------------------------------------------
139
+ *
140
+ * Can be string ("dash" | "brackets" | "abs") or object with custom formatter.
141
+ *
142
+ * - `"dash"` ➔ `-15.000`
143
+ * - `"brackets"` ➔ `(15.000)`
144
+ * - `"abs"` ➔ `15.000` (always positive)
145
+ * - Or object:
146
+ * `{
147
+ * style: "dash"|"brackets"|"abs",
148
+ * space: true|false,
149
+ * custom: (formatted) => string
150
+ * }`.
151
+ *
152
+ * *DefaultValue: `"dash"`.*
153
+ *
154
+ * @default "dash"
155
+ */
157
156
  negativeFormat?:NegativeFormatOption;
158
157
  /** ---------------------------------------------------------------------------
159
- * * ***Applies Indian Format.***
160
- * ---------------------------------------------------------------------------
161
- *
162
- * If `true`, formats as Indian: `12,34,567`.
163
- *
164
- * Also forces `separator: ","`, `separatorDecimals: "."`.
165
- *
166
- * *DefaultValue: `false`.*
167
- *
168
- * @default false
169
- */
158
+ * * ***Applies Indian Format.***
159
+ * ---------------------------------------------------------------------------
160
+ *
161
+ * If `true`, formats as Indian: `12,34,567`.
162
+ *
163
+ * Also forces `separator: ","`, `separatorDecimals: "."`.
164
+ *
165
+ * *DefaultValue: `false`.*
166
+ *
167
+ * @default false
168
+ */
170
169
  indianFormat?:boolean;};
171
170
  /** -------------------------------------------------------
172
- * * ***Formats a number or messy currency string into a
173
- * beautifully formatted currency string, with highly
174
- * customizable separators, decimal control, rounding,
175
- * currency symbols, and negative styling.***
176
- * -------------------------------------------------------
177
- *
178
- * Highlights:
179
- * - Accepts:
180
- * - Pure numbers: `15300.95`
181
- * - Messy currency strings from **any locale**:
182
- * - `"Rp 15.000,21"` (Indonesian / Euro)
183
- * - `"$12,345.60"` (US)
184
- * - `"CHF 12'345.60"` (Swiss)
185
- * - `"1,23,456.78"` (Indian)
186
- * - Auto extracts numeric value with smart multi-locale parsing
187
- * via `parseCurrencyString`.
188
- * - Handles:
189
- * - Thousands separators: `.`, `,`, `'`, ` `
190
- * - Decimal separators: `,`, `.`
191
- * - Decimal suffix (eg. `".-"`, `" USD"`)
192
- * - Currency prefix (eg. `"Rp "`, `"$ "`)
193
- * - Rounding: `"round"`, `"ceil"`, `"floor"`, or truncate
194
- * - Negative styling: dash `-`, brackets `( )`, absolute, or custom
195
- * - Strong type checks & clear errors for misconfigured options.
196
- *
197
- * How input is parsed:
198
- * - Removes all non-digit except `.`, `,`, `'` and spaces.
199
- * - Detects bracket negatives: `"(15.000,10)"` `-15000.10`
200
- * - Uses last `,` or `.` as decimal separator (others are thousands).
201
- * - Ignores currency symbols like `Rp`, `$` (must re-apply with `suffixCurrency`).
202
- *
203
- * Options:
204
- * @param {string|number} value The input value to format, examples:
205
- * - `"Rp 15.000,21"`
206
- * - `"$12,345.60"`
207
- * - `"CHF 12'345.60"`
208
- * - `15300.95`
209
- *
210
- * @param {FormatCurrencyOptions} [options] Optional configuration object.
211
- *
212
- * @param {string} [options.separator] Thousands separator:
213
- * - `{ separator: "." }` ➔ `1.000.000`.
214
- * - ***DefaultValue: `"."`***.
215
- *
216
- * @param {string} [options.separatorDecimals] Decimal separator:
217
- * - `{ separatorDecimals: "," }` `1.000,10`.
218
- * - ***DefaultValue: `","`***.
219
- *
220
- * @param {string} [options.suffixCurrency] Prefix currency string:
221
- * - Does **not auto-keep input symbols**.
222
- * - Must set manually e.g: `{ suffixCurrency: "Rp " }`.
223
- * - `{ suffixCurrency: "Rp " }` `Rp 1.000`.
224
- * - ***DefaultValue: `""`***.
225
- *
226
- * @param {boolean} [options.decimal] Show decimals:
227
- * - If `false`, rounds to integer.
228
- * - ***DefaultValue: `false`***.
229
- *
230
- * @param {number} [options.totalDecimal] Total decimal digits:
231
- * - If `decimal: true` & `roundedDecimal: false`, simply cuts.
232
- * - ***DefaultValue: `2`***.
233
- *
234
- * @param {string} [options.suffixDecimal] Text appended after decimals:
235
- * - E.g: (`".-"`, `" USD"`).
236
- * - Example 1: `".-"` ➔ `1.000,00.-`.
237
- * - Example 2: `" USD"` ➔ `1.000,00 USD`.
238
- * - ***DefaultValue: `""`***.
239
- *
240
- * @param {boolean} [options.endDecimal] Actually append `suffixDecimal`:
241
- * - ***DefaultValue: `true`***.
242
- *
243
- * @param {"round"|"ceil"|"floor"|false} [options.roundedDecimal] Rounding mode:
244
- * - `"round"` ➔ nearest
245
- * - `"ceil"` ➔ always up
246
- * - `"floor"` always down
247
- * - `false` ➔ truncate
248
- * - ***DefaultValue: `"round"`***.
249
- *
250
- * @param {"dash"|"brackets"|"abs"|{style?, space?, custom?}} [options.negativeFormat] How to format negatives:
251
- * - `"dash"` `-15.000`
252
- * - `"brackets"` ➔ `(15.000)`
253
- * - `"abs"` ➔ `15.000` (always positive)
254
- * - Or object:
255
- * `{
256
- * style: "dash"|"brackets"|"abs",
257
- * space: true|false,
258
- * custom: (formatted) => string
259
- * }`.
260
- * - ***DefaultValue: `"dash"`.***
261
- *
262
- * @param {boolean} [options.indianFormat] Applies Indian Format:
263
- * - If `true`, formats as Indian: `12,34,567`.
264
- * - Also forces `separator: ","`, `separatorDecimals: "."`.
265
- *
266
- * @returns {string} Nicely formatted currency string, examples:
267
- * - `"15.000,10"`
268
- * - `"Rp 15.000,10.-"`
269
- * - `"15'000.10 USD"`
270
- * - `"12,34,567.89"`
271
- *
272
- * @throws {TypeError} Will throw TypeError If:
273
- * - `value` is not string or number
274
- * - cannot parse to valid number
275
- * - options have invalid types
276
- *
277
- * ---
278
- *
279
- * ***✅ Notes:***
280
- * - Always re-apply symbols via `suffixCurrency`.
281
- * - `parseCurrencyString` smartly detects last decimal,
282
- * so `"1.121.234,56"` and `"1,121,234.56"` both parsed correctly.
283
- */
171
+ * * ***Utility: `formatCurrency`.***
172
+ * -------------------------------------------------------
173
+ * **Formats a number or messy currency string into a
174
+ * beautifully formatted currency string, with highly
175
+ * customizable separators, decimal control, rounding,
176
+ * currency symbols, and negative styling.**
177
+ * - **✅ Highlights:**
178
+ * - ***Accepts:***
179
+ * - Pure numbers: `15300.95`.
180
+ * - Messy currency strings from **any locale**:
181
+ * - `"Rp 15.000,21"` ***(Indonesian / Euro)***.
182
+ * - `"$12,345.60"` ***(US)***.
183
+ * - `"CHF 12'345.60"` ***(Swiss)***.
184
+ * - `"1,23,456.78"` ***(Indian)***.
185
+ * - Auto extracts numeric value with smart multi-locale parsing
186
+ * via ***{@link parseCurrencyString | `parseCurrencyString`}***.
187
+ * - **Handles:**
188
+ * - Thousands separators: `.`, `,`, `'`, ` `.
189
+ * - Decimal separators: `,`, `.`.
190
+ * - Decimal suffix (eg. `".-"`, `" USD"`).
191
+ * - Currency prefix (eg. `"Rp "`, `"$ "`).
192
+ * - Rounding: `"round"`, `"ceil"`, `"floor"`, or truncate.
193
+ * - Negative styling: dash `-`, brackets `( )`, absolute, or custom.
194
+ * - Strong type checks & clear errors for misconfigured options.
195
+ * - **✅ How input is parsed:**
196
+ * - Removes all non-digit except `.`, `,`, `'` and spaces.
197
+ * - Detects bracket negatives: `"(15.000,10)"` `-15000.10`.
198
+ * - Uses last `,` or `.` as decimal separator (others are thousands).
199
+ * - Ignores currency symbols like `Rp`, `$` (must re-apply with `suffixCurrency`).
200
+ * - **ℹ️ Note:**
201
+ * - Always re-apply symbols via `suffixCurrency`.
202
+ * - `parseCurrencyString` smartly detects last decimal,
203
+ * so `"1.121.234,56"` and `"1,121,234.56"` both parsed correctly.
204
+ * @param {string|number} value The input value to format, examples:
205
+ * - `"Rp 15.000,21"`.
206
+ * - `"$12,345.60"`.
207
+ * - `"CHF 12'345.60"`.
208
+ * - `15300.95`.
209
+ * @param {FormatCurrencyOptions} [options] Optional configuration object.
210
+ * @param {FormatCurrencyOptions["separator"]} [options.separator] Thousands separator:
211
+ * - `{ separator: "." }` ➔ `1.000.000`.
212
+ * - ***DefaultValue: `"."`***.
213
+ * @param {FormatCurrencyOptions["separatorDecimals"]} [options.separatorDecimals] Decimal separator:
214
+ * - `{ separatorDecimals: "," }` ➔ `1.000,10`.
215
+ * - ***DefaultValue: `","`***.
216
+ * @param {FormatCurrencyOptions["suffixCurrency"]} [options.suffixCurrency] Prefix currency string:
217
+ * - Does **not auto-keep input symbols**.
218
+ * - Must set manually e.g: `{ suffixCurrency: "Rp " }`.
219
+ * - `{ suffixCurrency: "Rp " }` ➔ `Rp 1.000`.
220
+ * - ***DefaultValue: `""`***.
221
+ * @param {FormatCurrencyOptions["decimal"]} [options.decimal] Whether to show decimals. If `false`, decimals are truncated:
222
+ * - If `false`, cut the decimal.
223
+ * - ***DefaultValue: `false`***.
224
+ * @param {FormatCurrencyOptions["totalDecimal"]} [options.totalDecimal] Total decimal digits:
225
+ * - If `decimal: true` & `roundedDecimal: false`, simply cuts.
226
+ * - ***DefaultValue: `2`***.
227
+ * @param {FormatCurrencyOptions["separatorDecimals"]} [options.suffixDecimal] Text appended after decimals:
228
+ * - E.g: (`".-"`, `" USD"`).
229
+ * - Example 1: `".-"` `1.000,00.-`.
230
+ * - Example 2: `" USD"` `1.000,00 USD`.
231
+ * - ***DefaultValue: `""`***.
232
+ * @param {FormatCurrencyOptions["endDecimal"]} [options.endDecimal] Actually append `suffixDecimal`:
233
+ * - ***DefaultValue: `true`***.
234
+ * @param {FormatCurrencyOptions["roundedDecimal"]} [options.roundedDecimal] Rounding mode:
235
+ * - `"round"` ➔ nearest.
236
+ * - `"ceil"` ➔ always up.
237
+ * - `"floor"` ➔ always down.
238
+ * - `false` ➔ truncate.
239
+ * - ***DefaultValue: `"round"`***.
240
+ * @param {FormatCurrencyOptions["negativeFormat"]} [options.negativeFormat]
241
+ * - How to format negatives:
242
+ * - `"dash"` ➔ `-15.000`.
243
+ * - `"brackets"` ➔ `(15.000)`.
244
+ * - `"abs"` ➔ `15.000` (always positive).
245
+ * - Or object: `{ style: "dash"|"brackets"|"abs", space: true|false, custom: (formatted) => string }`.
246
+ * - ***DefaultValue: `"dash"`.***
247
+ * @param {FormatCurrencyOptions["indianFormat"]} [options.indianFormat] Applies Indian Format:
248
+ * - If `true`, formats as Indian: `12,34,567`.
249
+ * - Also forces `separator: ","`, `separatorDecimals: "."`.
250
+ * @returns {string} Nicely formatted currency string, examples:
251
+ * - `"15.000,10"`.
252
+ * - `"Rp 15.000,10.-"`.
253
+ * - `"15'000.10 USD"`.
254
+ * - `"12,34,567.89"`.
255
+ * @throws {TypeError} Will throw TypeError If:
256
+ * - `value` is not string or number.
257
+ * - cannot parse to valid number.
258
+ * - options have invalid types.
259
+ * @example
260
+ * // --- Number input (default, decimals off) ---
261
+ * formatCurrency(1234567.89);
262
+ * // "1.234.567"
263
+ *
264
+ * // --- Decimals enabled ---
265
+ * formatCurrency(1234567.89, { decimal: true });
266
+ * // ➔ "1.234.567,89"
267
+ *
268
+ * // --- Indian format ---
269
+ * formatCurrency(1234567.89, { decimal: true, indianFormat: true });
270
+ * // ➔ "12,34,567.89"
271
+ *
272
+ * // --- String input (Indonesian style) ---
273
+ * formatCurrency("Rp 15.000,21", { decimal: true });
274
+ * // "15.000,21"
275
+ *
276
+ * // --- String input (US style) ---
277
+ * formatCurrency("$12,345.60", { decimal: true });
278
+ * // ➔ "12.345,60"
279
+ *
280
+ * // --- String input (Swiss style) ---
281
+ * formatCurrency("CHF 12'345.60", { decimal: true });
282
+ * // ➔ "12'345,60"
283
+ *
284
+ * // --- String input (Indian style) ---
285
+ * formatCurrency("1,23,456.78", { decimal: true, indianFormat: true });
286
+ * // ➔ "12,34,567.78"
287
+ *
288
+ * // --- Negative numbers (dash) ---
289
+ * formatCurrency(-1234.56, { decimal: true });
290
+ * // ➔ "-1.234,56"
291
+ *
292
+ * // --- Negative numbers (brackets) ---
293
+ * formatCurrency(-1234.56, {
294
+ * decimal: true,
295
+ * negativeFormat: "brackets"
296
+ * });
297
+ * // ➔ "(1.234,56)"
298
+ *
299
+ * // --- Negative numbers (custom object style) ---
300
+ * formatCurrency(-1234.56, {
301
+ * decimal: true,
302
+ * negativeFormat: { style: "brackets", space: true }
303
+ * });
304
+ * // ➔ "( 1.234,56 )"
305
+ *
306
+ * // --- Negative numbers (custom function) ---
307
+ * formatCurrency(-1234.56, {
308
+ * decimal: true,
309
+ * negativeFormat: { custom: (val) => `NEGATIVE[${val}]` }
310
+ * });
311
+ * // ➔ "NEGATIVE[1.234,56]"
312
+ *
313
+ * // --- With prefix currency ---
314
+ * formatCurrency(1234.56, {
315
+ * decimal: true,
316
+ * suffixCurrency: "Rp "
317
+ * });
318
+ * // ➔ "Rp 1.234,56"
319
+ *
320
+ * // --- With suffix decimal ---
321
+ * formatCurrency(1234.56, {
322
+ * decimal: true,
323
+ * suffixDecimal: ".-"
324
+ * });
325
+ * // ➔ "1.234,56.-"
326
+ *
327
+ * // --- With suffix currency + suffix decimal ---
328
+ * formatCurrency(1234.56, {
329
+ * decimal: true,
330
+ * suffixCurrency: "Rp ",
331
+ * suffixDecimal: ".-"
332
+ * });
333
+ * // ➔ "Rp 1.234,56.-"
334
+ *
335
+ * // --- Custom separators ---
336
+ * formatCurrency(1234567.89, {
337
+ * decimal: true,
338
+ * separator: "'",
339
+ * separatorDecimals: "."
340
+ * });
341
+ * // ➔ "1'234'567.89"
342
+ *
343
+ * // --- Rounding: ceil ---
344
+ * formatCurrency(1234.561, {
345
+ * decimal: true,
346
+ * roundedDecimal: "ceil"
347
+ * });
348
+ * // ➔ "1.234,57"
349
+ *
350
+ * // --- Rounding: floor ---
351
+ * formatCurrency(1234.569, {
352
+ * decimal: true,
353
+ * roundedDecimal: "floor"
354
+ * });
355
+ * // ➔ "1.234,56"
356
+ *
357
+ * // --- Rounding: truncate (false) ---
358
+ * formatCurrency(1234.569, {
359
+ * decimal: true,
360
+ * roundedDecimal: false
361
+ * });
362
+ * // ➔ "1.234,56"
363
+ *
364
+ * // --- Force no decimals (decimal: false) ---
365
+ * formatCurrency(1234.567, { decimal: false });
366
+ * // ➔ "1.235"
367
+ *
368
+ * // --- Edge case: messy input with dots & commas ---
369
+ * formatCurrency("1.121.234,561", {
370
+ * decimal: true,
371
+ * totalDecimal: 2,
372
+ * roundedDecimal: "ceil",
373
+ * suffixCurrency: "Rp ",
374
+ * negativeFormat: { style: "brackets" }
375
+ * });
376
+ * // ➔ "(Rp 1.121.234,57)"
377
+ *
378
+ * // --- Edge case: integer string input ---
379
+ * formatCurrency("1.121.234", {
380
+ * decimal: true,
381
+ * suffixCurrency: "Rp ",
382
+ * roundedDecimal: "ceil"
383
+ * });
384
+ * // ➔ "Rp 1.121.234,00"
385
+ */
284
386
  declare const formatCurrency:(value:string|number,options?:FormatCurrencyOptions)=>string;
285
387
  /** ----------------------------------------------------------
286
- * * ***Formats a number or numeric string by adding a custom separator
287
- * every three digits (thousands separator), and intelligently
288
- * flips the decimal separator according to the chosen separator.***
289
- * ----------------------------------------------------------
290
- *
291
- * - Converts a number to string before formatting.
292
- * - Defaults to using `,` as the thousands separator.
293
- * - If `.` is used as the separator, the decimal will automatically become `,`, and vice versa.
294
- * - Handles input with existing formatting (e.g. "1,234,567.89") and normalizes it.
295
- * - Supports custom separators, including spaces.
296
- * - Preserves decimals even if more than 2 digits.
297
- *
298
- * @param {string | number} value - The numeric value or string to format.
299
- * Can be plain numbers, or already formatted strings like "1,234,567.89".
300
- * @param {string} [separator=","] - The thousands separator to use.
301
- * Examples: "," (default), ".", " ", etc.
302
- *
303
- * @returns {string} The formatted string with thousands separators and
304
- * appropriate decimal separator.
305
- *
306
- * @throws {TypeError} If `value` is not a string or number,
307
- * or `separator` is not a string.
308
- *
309
- * @example
310
- * formatNumber(1000000);
311
- * // "1,000,000"
312
- *
313
- * formatNumber("987654321");
314
- * // → "987,654,321"
315
- *
316
- * formatNumber(1234567.89);
317
- * // "1,234,567.89"
318
- *
319
- * formatNumber("1234567,89");
320
- * // "1,234,567.89"
321
- *
322
- * formatNumber("1234567.892");
323
- * // "1,234,567.892"
324
- *
325
- * formatNumber("1234567.89", ".");
326
- * // → "1.234.567,89"
327
- *
328
- * formatNumber("1234567,89", ",");
329
- * // "1,234,567.89"
330
- *
331
- * formatNumber("987654321", " ");
332
- * // → "987 654 321"
333
- *
334
- * formatNumber("1,234,567.89");
335
- * // → "1,234,567.89"
336
- *
337
- * formatNumber("1.234.567,89", ",");
338
- * // → "1,234,567.89"
339
- *
340
- * formatNumber("1.234.567,893", ".");
341
- * // → "1.234.567,893"
342
- *
343
- * formatNumber("1234.56", ".");
344
- * // → "1.234,56"
345
- *
346
- * formatNumber("1234,56", ",");
347
- * // → "1,234.56"
348
- *
349
- */
388
+ * * ***Utility: `formatNumber`.***
389
+ * ----------------------------------------------------------
390
+ * **Formats a number or numeric string by adding a custom separator
391
+ * every three digits (thousands separator), and intelligently flips
392
+ * the decimal separator according to the chosen separator.**
393
+ * - **Features:**
394
+ * - Converts a number to string before formatting.
395
+ * - Defaults to using `,` as the thousands separator.
396
+ * - If `.` is used as the separator, the decimal will automatically
397
+ * become `,`, and vice versa.
398
+ * - Handles input with existing formatting (e.g. "1,234,567.89") and normalizes it.
399
+ * - Supports custom separators, including spaces.
400
+ * - Preserves decimals even if more than 2 digits.
401
+ * @param {string | number} value - The numeric value or string to format, can be plain numbers, or already formatted strings like `"1,234,567.89"`.
402
+ * @param {string} [separator=","] - The thousands separator to use, examples: `","` ***(default)***, `"."`, `" "`, etc.
403
+ * @returns {string} The formatted string with thousands separators and
404
+ * appropriate decimal separator.
405
+ * @throws {TypeError} If `value` is not a string or number,
406
+ * or `separator` is not a string.
407
+ * @example
408
+ * formatNumber(1000000);
409
+ * // "1,000,000"
410
+ * formatNumber("987654321");
411
+ * // ➔ "987,654,321"
412
+ * formatNumber(1234567.89);
413
+ * // "1,234,567.89"
414
+ * formatNumber("1234567,89");
415
+ * // ➔ "1,234,567.89"
416
+ * formatNumber("1234567.892");
417
+ * // ➔ "1,234,567.892"
418
+ * formatNumber("1234567.89", ".");
419
+ * // "1.234.567,89"
420
+ * formatNumber("1234567,89", ",");
421
+ * // ➔ "1,234,567.89"
422
+ * formatNumber("987654321", " ");
423
+ * // ➔ "987 654 321"
424
+ * formatNumber("1,234,567.89");
425
+ * // "1,234,567.89"
426
+ * formatNumber("1.234.567,89", ",");
427
+ * // ➔ "1,234,567.89"
428
+ * formatNumber("1.234.567,893", ".");
429
+ * // ➔ "1.234.567,893"
430
+ * formatNumber("1234.56", ".");
431
+ * // "1.234,56"
432
+ * formatNumber("1234,56", ",");
433
+ * // ➔ "1,234.56"
434
+ */
350
435
  declare const formatNumber:(value:string|number,separator?:string)=>string;
351
436
  /** -------------------------------------------------------
352
- * * ***Formats a phone number into a customizable local or international style.***
353
- * -------------------------------------------------------
354
- *
355
- * Can also:
356
- * - Return only digits (`takeNumberOnly`).
357
- * - Check validity (`checkValidOnly`) using a regex for international-style phone numbers.
358
- *
359
- * Validation (`checkValidOnly: true`)
360
- * Valid if:
361
- * - Only contains digits, optional leading `+`, spaces, parentheses `()`, hyphens `-`, or dots `.`.
362
- * - Digits-only length < 24.
363
- *
364
- * Example:
365
- * ```js
366
- * formatPhoneNumber("081234567890")
367
- * // => "0812 3456 7890"
368
- * ```
369
- *
370
- * Example:
371
- * ```js
372
- * formatPhoneNumber("(0812) 3456-7890", { takeNumberOnly: true })
373
- * // => "081234567890"
374
- * ```
375
- *
376
- * Example:
377
- * ```js
378
- * formatPhoneNumber("(0812) 3456-7890", { checkValidOnly: true })
379
- * // => true
380
- * ```
381
- *
382
- * Example:
383
- * ```js
384
- * formatPhoneNumber("+6281234567890", { checkValidOnly: true })
385
- * // => true
386
- * ```
387
- *
388
- * Example:
389
- * ```js
390
- * formatPhoneNumber("+1 (800) 123-4567", { checkValidOnly: true })
391
- * // => true
392
- * formatPhoneNumber("+44 20 7946 0958", { checkValidOnly: true })
393
- * // => true
394
- * ```
395
- *
396
- * Example:
397
- * ```js
398
- * formatPhoneNumber("0812-3456-7890", { checkValidOnly: true })
399
- * // => true
400
- * formatPhoneNumber("(0812) 3456 7890", { checkValidOnly: true })
401
- * // => true
402
- * formatPhoneNumber("0812 3456 7890", { checkValidOnly: true })
403
- * // => true
404
- * ```
405
- *
406
- * Example:
407
- * ```js
408
- * formatPhoneNumber("+62abc123", { checkValidOnly: true })
409
- * // => false
410
- * formatPhoneNumber("0812-3456-hello", { checkValidOnly: true })
411
- * // => false
412
- * formatPhoneNumber("+62 123456789012345678901234", { checkValidOnly: true })
413
- * // => false
414
- * formatPhoneNumber("++6281234567890", { checkValidOnly: true })
415
- * // => false
416
- * formatPhoneNumber("invalid@@@", { checkValidOnly: true })
417
- * // => false
418
- * ```
419
- *
420
- * Example:
421
- * ```js
422
- * formatPhoneNumber("+62.812.3456.7890", { checkValidOnly: true })
423
- * // => true
424
- * formatPhoneNumber("+62(812)3456-7890", { checkValidOnly: true })
425
- * // => true
426
- * ```
427
- *
428
- * Example:
429
- * ```js
430
- * formatPhoneNumber("081234567890", {
431
- * separator: "-",
432
- * plusNumberCountry: "+44",
433
- * openingNumberCountry: "(",
434
- * closingNumberCountry: ")",
435
- * })
436
- * // => "(+44) 8123-4567-890"
437
- * ```
438
- *
439
- * @throws {TypeError} If `value` is not string, number, null or undefined.
440
- * @throws {TypeError} If `options` is not an object or contains wrong types.
441
- *
442
- * @overload
443
- * @param value The phone number input (string or number).
444
- * @param options With `checkValidOnly: true`.
445
- * @returns A boolean indicating whether the input is a valid phone number.
446
- *
447
- * @overload
448
- * @param value The phone number input (string or number).
449
- * @param options With `takeNumberOnly: true`.
450
- * @returns A string of digits only.
451
- *
452
- * @overload
453
- * @param value The phone number input (string or number).
454
- * @param options Options to customize format output (country code, separator, etc).
455
- * @returns A formatted phone number string.
456
- */
437
+ * * ***Utility: `formatPhoneNumber`.***
438
+ * -------------------------------------------------------
439
+ * **Formats a phone number into a customizable local or international style.**
440
+ * - **Can also:**
441
+ * - Return only digits (`takeNumberOnly`).
442
+ * - Check validity (`checkValidOnly`) using a regex for international-style phone numbers.
443
+ * - **Validation (`checkValidOnly: true`):**
444
+ * - ***Valid if:***
445
+ * - Only contains digits, optional leading `+`, spaces, parentheses `()`,
446
+ * hyphens `-`, or dots `.`.
447
+ * - Digits-only length < 24.
448
+ * @example
449
+ * ```js
450
+ * formatPhoneNumber("081234567890")
451
+ * // ➔ "0812 3456 7890"
452
+ * formatPhoneNumber("(0812) 3456-7890", { takeNumberOnly: true })
453
+ * // ➔ "081234567890"
454
+ * formatPhoneNumber("(0812) 3456-7890", { checkValidOnly: true })
455
+ * // ➔ true
456
+ * formatPhoneNumber("+6281234567890", { checkValidOnly: true })
457
+ * // true
458
+ * formatPhoneNumber("+1 (800) 123-4567", { checkValidOnly: true })
459
+ * // ➔ true
460
+ * formatPhoneNumber("+44 20 7946 0958", { checkValidOnly: true })
461
+ * // ➔ true
462
+ * formatPhoneNumber("0812-3456-7890", { checkValidOnly: true })
463
+ * // true
464
+ * formatPhoneNumber("(0812) 3456 7890", { checkValidOnly: true })
465
+ * // ➔ true
466
+ * formatPhoneNumber("0812 3456 7890", { checkValidOnly: true })
467
+ * // ➔ true
468
+ * formatPhoneNumber("+62abc123", { checkValidOnly: true })
469
+ * // false
470
+ * formatPhoneNumber("0812-3456-hello", { checkValidOnly: true })
471
+ * // ➔ false
472
+ * formatPhoneNumber("+62 123456789012345678901234", { checkValidOnly: true })
473
+ * // ➔ false
474
+ * formatPhoneNumber("++6281234567890", { checkValidOnly: true })
475
+ * // false
476
+ * formatPhoneNumber("invalid@@@", { checkValidOnly: true })
477
+ * // false
478
+ * formatPhoneNumber("+62.812.3456.7890", { checkValidOnly: true })
479
+ * // ➔ true
480
+ * formatPhoneNumber("+62(812)3456-7890", { checkValidOnly: true })
481
+ * // ➔ true
482
+ * ```
483
+ * ```js
484
+ * formatPhoneNumber("081234567890", {
485
+ * separator: "-",
486
+ * plusNumberCountry: "+44",
487
+ * openingNumberCountry: "(",
488
+ * closingNumberCountry: ")",
489
+ * })
490
+ * // ➔ "(+44) 8123-4567-890"
491
+ * ```
492
+ * @throws {TypeError} If `value` is not string, number, null or undefined.
493
+ * @throws {TypeError} If `options` is not an object or contains wrong types.
494
+ *
495
+ * @overload Return a boolean if options With `checkValidOnly: true`.
496
+ * @param {ValueFormatPhoneNumber} [value] The phone number input (string or number).
497
+ * @param {FormatPhoneNumberPropsBoolean} [options] With `checkValidOnly: true`.
498
+ * @returns {boolean} A boolean indicating whether the input is a valid phone number.
499
+ *
500
+ * @overload Return a string of digits only, if options With `takeNumberOnly: true`.
501
+ * @param {ValueFormatPhoneNumber} [value] The phone number input (string or number).
502
+ * @param {FormatPhoneNumberPropsTransform} [options] With `takeNumberOnly: true`.
503
+ * @returns {string} A string of digits only.
504
+ *
505
+ * @overload Return a formatted phone number string, if options Options to customize format output (country code, separator, etc).
506
+ * @param {ValueFormatPhoneNumber} [value] The phone number input (string or number).
507
+ * @param {FormatPhoneNumberPropsString} [options] Options to customize format output (country code, separator, etc).
508
+ * @returns {string} A formatted phone number string.
509
+ */
457
510
  declare function formatPhoneNumber(value?:ValueFormatPhoneNumber,options?:FormatPhoneNumberPropsString):string;declare function formatPhoneNumber(value?:ValueFormatPhoneNumber,options?:FormatPhoneNumberPropsBoolean):boolean;declare function formatPhoneNumber(value?:ValueFormatPhoneNumber,options?:FormatPhoneNumberPropsTransform):string;
458
- /**
459
- * -------------------------------------------------------------
460
- * * ***Supported IETF BCP-47 locale codes for Intl API.***
461
- * -------------------------------------------------------------
462
- *
463
- * Includes:
464
- * - Major global locales (en-US, fr-FR, zh-CN, etc)
465
- * - Regional & minor locales (mi-NZ, rw-RW, bi-VU, etc)
466
- * - Useful for `Intl.DateTimeFormat`, `Intl.NumberFormat`, etc.
467
- * - Still allows fallback via `({} & string)` for arbitrary locales.
468
- *
469
- * This type ensures proper autocompletion & validation in TS
470
- * but does not restrict at runtime (must validate separately).
471
- *
472
- * @example
473
- * const locale: SupportedLocales = "fr-CA";
474
- * new Intl.DateTimeFormat(locale).format(new Date());
475
- */
511
+ /** -------------------------------------------------------------
512
+ * * ***Supported IETF BCP-47 locale codes for Intl API.***
513
+ * -------------------------------------------------------------
514
+ *
515
+ * Includes:
516
+ * - Major global locales (en-US, fr-FR, zh-CN, etc)
517
+ * - Regional & minor locales (mi-NZ, rw-RW, bi-VU, etc)
518
+ * - Useful for `Intl.DateTimeFormat`, `Intl.NumberFormat`, etc.
519
+ * - Still allows fallback via `({} & string)` for arbitrary locales.
520
+ *
521
+ * This type ensures proper autocompletion & validation in TS
522
+ * but does not restrict at runtime (must validate separately).
523
+ *
524
+ * @example
525
+ * const locale: SupportedLocales = "fr-CA";
526
+ * new Intl.DateTimeFormat(locale).format(new Date());
527
+ */
476
528
  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);
529
+ /** ----------------------------------------------------------------
530
+ * * ***Options for formatting dates with `Intl.DateTimeFormat`.***
531
+ * ----------------------------------------------------------------
532
+ *
533
+ * Extends the native
534
+ * **{@link Intl.DateTimeFormatOptions | `Intl.DateTimeFormatOptions`}** with
535
+ * an additional `locale` property that is validated against **{@link SupportedLocales | `SupportedLocales`}**.
536
+ *
537
+ */
538
+ type FormatDateIntlOptions=Intl.DateTimeFormatOptions &{
539
+ /** ------------------------------------------------------------
540
+ * * Locale for date formatting.
541
+ * ------------------------------------------------------------
542
+ *
543
+ * - Must be a valid [***BCP-47 locale***](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locales_argument),
544
+ * validated against {@link SupportedLocales | **`SupportedLocales`**}.
545
+ * - If `locale` is `undefined` or an empty string (after trimming),
546
+ * it will **default to `"en-US"`**.
547
+ *
548
+ * @default "en-US"
549
+ * @example
550
+ * { year: "numeric", month: "long" }
551
+ * // Unset locale, default locale ➔ "en-US"
552
+ * { locale: "fr-FR", ...}
553
+ * // Explicit locale
554
+ * { locale: " ", ...}
555
+ * // Empty string locale ➔ defaults to "en-US"
556
+ * { locale: " en-GB ", ...}
557
+ * // Value will trimming ➔ "en-GB"
558
+ *
559
+ */
560
+ locale?:SupportedLocales;};
561
+ /** ----------------------------------------------------------------------
562
+ * * ***Options for formatting dates with `date-fns/format`.***
563
+ * ----------------------------------------------------------------------
564
+ *
565
+ * Extends the base **{@link FormatOptions | *`FormatOptions`*}** (without **`locale`**) with extra options
566
+ * for handling output formatting, localization, and parsing non-standard inputs.
567
+ *
568
+ */
569
+ type FormatDateFnsOptions=Prettify<OmitStrict<FormatOptions,"locale",true,false>&{
570
+ /** ------------------------------------------------------------
571
+ * * Output format string passed to `date-fns/format`.
572
+ * ------------------------------------------------------------
573
+ *
574
+ * - Determines how the date will be rendered.
575
+ * - Uses the full power of `date-fns` tokens.
576
+ *
577
+ * ***Default Value***: `"dd MMM yyyy - HH:mm:ss"`.
578
+ * @example
579
+ * "dd MMMM yyyy, HH:mm:ss" // ➔ "03 September 2025, 10:25:42"
580
+ * @default "dd MMM yyyy - HH:mm:ss"
581
+ */
582
+ format?:string;
583
+ /** ------------------------------------------------------------
584
+ * * Locale used for formatting.
585
+ * ------------------------------------------------------------
586
+ *
587
+ * - If `string`: only accepts `"id"` (Indonesian) or `"en"` (English) - **(default)**.
588
+ * - If `Locale`: accepts a locale object from `date-fns/locale`.
589
+ *
590
+ * ***Default Value***: `"en"`.
591
+ * ```ts
592
+ * import { ar } from "date-fns/locale";
593
+ *
594
+ * formatDateFns(new Date(), {
595
+ * locale: ar,
596
+ * format: "dd MMMM yyyy"
597
+ * });
598
+ * // ➔ "03 سبتمبر 2025"
599
+ * ```
600
+ * @default "en"
601
+ */
602
+ locale?:"id"|"en"|AnyString|Locale;
603
+ /** ------------------------------------------------------------
604
+ * * Input locale used when parsing non-standard string dates.
605
+ * ------------------------------------------------------------
606
+ *
607
+ * - Required if `date` is a **localized string**
608
+ * (e.g. `"03 Mei 2025 10:25:42"` in Indonesian).
609
+ * - Same accepted types as `locale` parameter.
610
+ *
611
+ * ***Default Value***: `"en"`.
612
+ * ```ts
613
+ * import { ar } from "date-fns/locale";
614
+ *
615
+ * formatDateFns("03 مايو 2025 10:25:42", {
616
+ * inputFormat: "dd MMMM yyyy HH:mm:ss",
617
+ * inputLocale: ar,
618
+ * format: "PPpp"
619
+ * });
620
+ * // ➔ "May 3, 2025 at 10:25:42 AM"
621
+ * ```
622
+ * @default "en"
623
+ */
624
+ inputLocale?:"id"|"en"|AnyString|Locale;
625
+ /** ------------------------------------------------------------
626
+ * * Input format string for parsing non-ISO string dates.
627
+ * ------------------------------------------------------------
628
+ *
629
+ * - Required if `date` is **not ISO-8601** and not a native `Date`.
630
+ * - Works together with `inputLocale` parameter.
631
+ *
632
+ * ***Default Value***: `undefined`.
633
+ * @default undefined
634
+ * @example
635
+ * "dd MMMM yyyy HH:mm:ss" // ➔ "03 May 2025 10:25:42"
636
+ */
637
+ inputFormat?:string;}>;
477
638
  /** ----------------------------------------------------------
478
- * * ***Formats a date and time into a custom string format.***
479
- * ----------------------------------------------------------
480
- *
481
- * - Supports only `YYYY`, `MM`, `DD`, `hh`, `mm`, and `ss` as placeholders.
482
- * - Uses a simple string replace (no locale).
483
- * - Returns `null` if the date is invalid or not provided.
484
- * - Defaults to `"YYYY-MM-DD hh:mm:ss"` format if none is specified.
485
- *
486
- * @param {string | Date | null} [date] - The date to format.
487
- * @param {string} [format="YYYY-MM-DD hh:mm:ss"] - The desired date format.
488
- * @returns {string | null} The formatted date string or `null` if invalid.
489
- *
490
- * @example
491
- * formatDateTime(new Date());
492
- * // => "2024-02-09 14:30:45" (example output with current time)
493
- *
494
- * formatDateTime("2023-07-01T14:30:45");
495
- * // => "2023-07-01 14:30:45"
496
- *
497
- * formatDateTime("2023-07-01T14:30:45", "DD/MM/YYYY");
498
- * // => "01/07/2023"
499
- *
500
- * formatDateTime("2023-07-01T14:30:45", "YYYY/MM/DD hh-mm-ss");
501
- * // => "2023/07/01 14-30-45"
502
- *
503
- * formatDateTime("2023-07-01T14:30:45", "hh:mm");
504
- * // => "14:30"
505
- *
506
- * formatDateTime("2023-07-01T14:30:45", "DATE: YYYY.MM.DD");
507
- * // => "DATE: 2023.07.01"
508
- *
509
- * formatDateTime("2023-07-01T14:30:45", "Year: YYYY, Time: hh:mm:ss");
510
- * // => "Year: 2023, Time: 14:30:45"
511
- *
512
- * formatDateTime("2023-07-01T14:30:45", "YYYY-MM");
513
- * // => "2023-07"
514
- *
515
- * formatDateTime("2023-07-01T14:30:45", "YYYYYYYY");
516
- * // => "20232023"
517
- *
518
- * formatDateTime("2023-07-01T14:30:45", "hh:mm:ss:ss");
519
- * // => "14:30:45:45"
520
- *
521
- * formatDateTime("invalid-date");
522
- * // => null
523
- *
524
- * formatDateTime(null);
525
- * // => null
526
- *
527
- * formatDateTime(undefined);
528
- * // => null
529
- */
530
- declare const formatDateTime:(date?:string|Date|null,
531
- /** @default "YYYY-MM-DD hh:mm:ss" */
532
- format?:string)=>string|null;
639
+ * * ***Utility: `formatDateTime`.***
640
+ * ----------------------------------------------------------
641
+ * **Formats a date and time into a custom string format.**
642
+ * - **Features:**
643
+ * - Supports only `YYYY`, `MM`, `DD`, `hh`, `mm`, and `ss` as placeholders.
644
+ * - Uses a simple string replace (no locale).
645
+ * - Returns `null` if the date is invalid or not provided.
646
+ * - Defaults to `"YYYY-MM-DD hh:mm:ss"` format if none is specified.
647
+ * @param {string | Date | null| undefined} date - The date to format.
648
+ * @param {string} [format="YYYY-MM-DD hh:mm:ss"] - The desired date format, if format is `null` or `undefined` will force to defaultValue, defaultValue: `"YYYY-MM-DD hh:mm:ss"`.
649
+ * @returns {string | null} The formatted date string or `null` if invalid.
650
+ * @example
651
+ * formatDateTime(new Date());
652
+ * // ➔ "2024-02-09 14:30:45" (example output with current time)
653
+ * formatDateTime("2023-07-01T14:30:45");
654
+ * // ➔ "2023-07-01 14:30:45"
655
+ * formatDateTime("2023-07-01T14:30:45", "DD/MM/YYYY");
656
+ * // "01/07/2023"
657
+ * formatDateTime("2023-07-01T14:30:45", "YYYY/MM/DD hh-mm-ss");
658
+ * // ➔ "2023/07/01 14-30-45"
659
+ * formatDateTime("2023-07-01T14:30:45", "hh:mm");
660
+ * // ➔ "14:30"
661
+ * formatDateTime("2023-07-01T14:30:45", "DATE: YYYY.MM.DD");
662
+ * // "DATE: 2023.07.01"
663
+ * formatDateTime("2023-07-01T14:30:45", "Year: YYYY, Time: hh:mm:ss");
664
+ * // ➔ "Year: 2023, Time: 14:30:45"
665
+ * formatDateTime("2023-07-01T14:30:45", "YYYY-MM");
666
+ * // ➔ "2023-07"
667
+ * formatDateTime("2023-07-01T14:30:45", "YYYYYYYY");
668
+ * // "20232023"
669
+ * formatDateTime("2023-07-01T14:30:45", "hh:mm:ss:ss");
670
+ * // ➔ "14:30:45:45"
671
+ * formatDateTime("invalid-date");
672
+ * // ➔ null
673
+ * formatDateTime(null);
674
+ * // null
675
+ * formatDateTime(undefined);
676
+ * // ➔ null
677
+ */
678
+ declare const formatDateTime:(date:string|Date|null|undefined,format?:string)=>string|null;
533
679
  /** ----------------------------------------------------------
534
- * * ***Formats a date using the `Intl.DateTimeFormat` API.***
535
- * ----------------------------------------------------------
536
- *
537
- * - Supports custom locales (type-safe `SupportedLocales`).
538
- * - Accepts additional `Intl.DateTimeFormatOptions` like `timeZone`, `hour12`, etc.
539
- * - Defaults to `"en-US"` if `locale` is not provided or is an empty string.
540
- * - Returns `null` if the date is invalid, not provided, or options are invalid.
541
- *
542
- * @param {string | Date | null | undefined} [date] - The date to format.
543
- * Can be a `Date` object or an ISO string. If invalid or not provided, returns `null`.
544
- *
545
- * @param {Intl.DateTimeFormatOptions & { locale?: SupportedLocales | SupportedLocales[] }} [options]
546
- * - Optional formatting options for `Intl.DateTimeFormat`.
547
- * - Use `locale` to specify the language & region format.
548
- *
549
- * @returns {string | null}
550
- * - Formatted date string.
551
- * - Returns `null` if date is invalid or options are of wrong type.
552
- *
553
- * @example
554
- * formatDateIntl(new Date());
555
- * // => "7/14/2025"
556
- *
557
- * formatDateIntl("2025-07-14T00:00:00Z", { locale: "fr-FR", dateStyle: "long" });
558
- * // => "14 juillet 2025"
559
- *
560
- * formatDateIntl(null);
561
- * // => null
562
- *
563
- * formatDateIntl(new Date(), { timeZone: "UTC", hour: "2-digit", minute: "2-digit" });
564
- * // => "01:30 AM"
565
- */
566
- declare const formatDateIntl:(date?:string|Date|null,options?:Intl.DateTimeFormatOptions &{locale?:SupportedLocales|SupportedLocales[];})=>string|null;
680
+ * * ***Utility: `formatDateIntl`.***
681
+ * ----------------------------------------------------------
682
+ * **Formats a date using the `Intl.DateTimeFormat` API.**
683
+ * - **Features:**
684
+ * - Supports custom locales (type-safe `SupportedLocales`).
685
+ * - Accepts additional `Intl.DateTimeFormatOptions` like `timeZone`, `hour12`, etc.
686
+ * - Defaults to `"en-US"` if `locale` is not provided or is an empty string.
687
+ * - Returns `null` if the date is invalid, not provided, or options are invalid.
688
+ * @param {string | Date | null | undefined} date The date to format.
689
+ * - Can be a `Date` object or an ISO string.
690
+ * - If invalid or not provided, returns `null`.
691
+ * @param {FormatDateIntlOptions} [options]
692
+ * - Optional formatting options for `Intl.DateTimeFormat`.
693
+ * - Use `locale` to specify the language & region format.
694
+ * @returns {string | null}
695
+ * - Formatted date string.
696
+ * - Returns `null` if date is invalid or options are of wrong type.
697
+ * @example
698
+ * formatDateIntl(new Date());
699
+ * // ➔ "7/14/2025"
700
+ * formatDateIntl("2025-07-14T00:00:00Z", { locale: "fr-FR", dateStyle: "long" });
701
+ * // "14 juillet 2025"
702
+ * formatDateIntl(null);
703
+ * // null
704
+ * formatDateIntl(new Date(), { timeZone: "UTC", hour: "2-digit", minute: "2-digit" });
705
+ * // ➔ "01:30 AM"
706
+ */
707
+ declare const formatDateIntl:(date:string|Date|null|undefined,options?:FormatDateIntlOptions)=>string|null;
567
708
  /** ----------------------------------------------------------
568
- * * ***Formats a date into a human-readable string using `date-fns`.***
569
- * ----------------------------------------------------------
570
- *
571
- * - Supports custom output formats using `date-fns/format`.
572
- * - Can parse localized non-ISO strings via `inputFormat` & `inputLocale`.
573
- * - Supports `locale` as `"id"`, `"en"` or `date-fns` `Locale` objects (like `id` or `enUS`).
574
- * - Returns `null` if the date is invalid, not provided, or parsing fails.
575
- *
576
- * @param {string | Date | null} [date] - The date input to format. Can be:
577
- * - A `Date` object
578
- * - An ISO string (e.g. `"2024-01-01T12:00:00Z"`)
579
- * - A localized string (requires `inputFormat` + `inputLocale`)
580
- *
581
- * @param {object} [options] - Options for formatting and parsing.
582
- *
583
- * @param {string} [options.format="dd MMM yyyy - HH:mm:ss"]
584
- * The output format string (passed to `date-fns/format`).
585
- * E.g. `"dd MMMM yyyy, HH:mm:ss" => "14 Juli 2025, 17:25:42"`
586
- *
587
- * @param {"id" | "en" | (string & {}) | Locale} [options.locale="id"]
588
- * The output locale. If string, only `"id"` (Indonesian) or `"en"` (English)
589
- * is recognized. Or you can pass a `date-fns` `Locale` object.
590
- * Example:
591
- * ```ts
592
- * import { ar } from "date-fns/locale";
593
- * formatDateFns(new Date(), { locale: ar, format: "PPPppp" });
594
- * ```
595
- *
596
- * @param {"id" | "en" | (string & {}) | Locale} [options.inputLocale]
597
- * Required if `date` is a localized non-ISO string. Used with `inputFormat`.
598
- * Example for Indonesian string:
599
- * ```ts
600
- * formatDateFns("14 Juli 2025 10:25:42", {
601
- * inputFormat: "dd MMMM yyyy HH:mm:ss",
602
- * inputLocale: "id",
603
- * });
604
- * ```
605
- *
606
- * @param {string} [options.inputFormat]
607
- * The format string to parse `date` if it is a non-ISO string.
608
- * Required together with `inputLocale`.
609
- *
610
- * @returns {string | null} A formatted date string or `null` if input is invalid.
611
- *
612
- * @example
613
- * formatDateFns(new Date());
614
- * // "14 Jul 2025 - 17:25:42"
615
- *
616
- * formatDateFns("2025-07-14T10:25:42Z", { format: "dd/MM/yyyy", locale: "en" });
617
- * // "14/07/2025"
618
- *
619
- * formatDateFns("14 Juli 2025 10:25:42", {
620
- * inputFormat: "dd MMMM yyyy HH:mm:ss",
621
- * inputLocale: "id",
622
- * format: "yyyy-MM-dd"
623
- * });
624
- * // "2025-07-14"
625
- *
626
- * formatDateFns(null);
627
- * // null
628
- */
629
- declare const formatDateFns:(date?:string|Date|null,
630
- /**
631
- * Options for formatting and parsing a date using `date-fns`.
632
- */
633
- options?:OmitStrict<FormatOptions,"locale",true,false>&{
634
- /**
635
- * Output format string using `date-fns/format`.
636
- * @default "dd MMM yyyy - HH:mm:ss"
637
- * @example "dd MMMM yyyy, HH:mm:ss"
638
- */
639
- format?:string;
640
- /**
641
- * The locale to be used for formatting.
642
- * If `string` Only Accepts "id" for Indonesian or "en" for English.
643
- * Or you can put props `Locale` from `date-fns/locale`, e.g :
644
- *
645
- * ```ts
646
- * import { ar } from "date-fns/locale";
647
- *
648
- * // then passing `ar` to this props.
649
- * formatDateFns(
650
- * // your date input...,
651
- * {
652
- * locale: ar,
653
- * //.... other options.
654
- * });
655
- *
656
- * ```
657
- * @default "id"
658
- */
659
- locale?:"id"|"en"|(string &{})|Locale;
660
- /**
661
- * The Input locale to be used for parsing `inputFormat`.
662
- * If `string` Only Accepts "id" for Indonesian or "en" for English.
663
- * Required if `date` is a non-standard string like "03 Mei 2025 10:25:42").
664
- *
665
- * Or you can put props `Locale` from `date-fns/locale`, e.g :
666
- *
667
- * ```ts
668
- * import { ar } from "date-fns/locale";
669
- *
670
- * // then passing `ar` to this props.
671
- * formatDateFns(
672
- * // your date input...,
673
- * {
674
- * inputLocale: ar,
675
- * //.... other options.
676
- * });
677
- *```
678
-
679
- * @default undefined
680
- */
681
- inputLocale?:"id"|"en"|(string &{})|Locale;
682
- /**
683
- * Input format string for parsing non-ISO string dates
684
- * (e.g., localized strings like "03 Mei 2025 10:25:42").
685
- * Required if `date` is a non-standard string.
686
- * @example "dd MMMM yyyy HH:mm:ss"
687
- */
688
- inputFormat?:string;})=>string|null;
709
+ * * ***Utility: `formatDateFns`.***
710
+ * ----------------------------------------------------------
711
+ * Formats a date into a human-readable string using `date-fns`.
712
+ * - **Features:**
713
+ * - Supports custom output formats using `date-fns/format`.
714
+ * - Can parse localized non-ISO strings via `inputFormat` & `inputLocale`.
715
+ * - Supports `locale` as `"id"`, `"en"` or `date-fns` `Locale` objects (like `id` or `enUS`).
716
+ * - Returns `null` if the date is invalid, not provided, or parsing fails.
717
+ * @param {string | Date | null | undefined} date - The date input to format. Can be:
718
+ * - A `Date` object
719
+ * - An ISO string (e.g. `"2024-01-01T12:00:00Z"`)
720
+ * - A localized string (requires `inputFormat` + `inputLocale`)
721
+ * @param {FormatDateFnsOptions} [options] - Options for formatting and parsing.
722
+ * @param {FormatDateFnsOptions["format"]} [options.format="dd MMM yyyy - HH:mm:ss"]
723
+ * The output format string (passed to `date-fns/format`).
724
+ * E.g. `"dd MMMM yyyy, HH:mm:ss" ➔ "14 Juli 2025, 17:25:42"`
725
+ * @param {FormatDateFnsOptions["locale"]} [options.locale="id"]
726
+ * The output locale. If string, only `"id"` (Indonesian) or `"en"` (English)
727
+ * is recognized. Or you can pass a `date-fns` `Locale` object.
728
+ * - Example:
729
+ * ```ts
730
+ * import { ar } from "date-fns/locale";
731
+ * formatDateFns(new Date(), { locale: ar, format: "PPPppp" });
732
+ * ```
733
+ * @param {FormatDateFnsOptions["inputLocale"]} [options.inputLocale]
734
+ * Required if `date` is a localized non-ISO string. Used with `inputFormat`.
735
+ * - Example for Indonesian string:
736
+ * ```ts
737
+ * formatDateFns("14 Juli 2025 10:25:42", { inputFormat: "dd MMMM yyyy HH:mm:ss", inputLocale: "id" });
738
+ * ```
739
+ * @param {FormatDateFnsOptions["inputFormat"]} [options.inputFormat]
740
+ * The format string to parse `date` if it is a non-ISO string.
741
+ * Required together with `inputLocale`.
742
+ * @returns {string | null} A formatted date string or `null` if input is invalid.
743
+ * @example
744
+ * formatDateFns(new Date());
745
+ * // ➔ "14 Jul 2025 - 17:25:42"
746
+ * formatDateFns("2025-07-14T10:25:42Z", { format: "dd/MM/yyyy", locale: "en" });
747
+ * // "14/07/2025"
748
+ * formatDateFns("14 Juli 2025 10:25:42", {
749
+ * inputFormat: "dd MMMM yyyy HH:mm:ss",
750
+ * inputLocale: "id",
751
+ * format: "yyyy-MM-dd"
752
+ * });
753
+ * // ➔ "2025-07-14"
754
+ * formatDateFns(null);
755
+ * // null
756
+ */
757
+ declare const formatDateFns:(date:string|Date|null|undefined,options?:FormatDateFnsOptions)=>string|null;
689
758
  /** ----------------------------------------------------------
690
- * * ***Returns the formatted GMT offset (e.g., `+0700`, `-0500`) for a given date.***
691
- * ----------------------------------------------------------
692
- *
693
- * - If `date` is **not provided** or empty string, it defaults to the current date/time.
694
- * - If `date` is **invalid** or of wrong type (like object or number), it returns `"0"`.
695
- * - The returned string follows the **GMT offset format** (`±HHMM`), where:
696
- * - `±` is `+` if ahead of UTC, `-` if behind.
697
- * - `HH` is two-digit hours.
698
- * - `MM` is two-digit minutes.
699
- *
700
- * @param {string | Date | null} [date] - The date to get the GMT offset from.
701
- * - Accepts `Date` object or ISO date string (e.g., `"2024-01-01T12:00:00Z"`).
702
- * - If `null`, `undefined`, or empty string, uses current system date.
703
- * - If invalid date or wrong type (like `123` or `{}`), returns `"0"`.
704
- *
705
- * @returns {string} The GMT offset string in format `±HHMM`,
706
- * e.g. `"+0700"`, `"-0530"`, or `"0"` if invalid.
707
- *
708
- * @example
709
- * getGMTOffset();
710
- * // => "+0700" (depends on system timezone)
711
- *
712
- * getGMTOffset(new Date("2024-02-09T12:00:00Z"));
713
- * // => "+0000"
714
- *
715
- * getGMTOffset("2024-02-09");
716
- * // => "+0700" (depends on your timezone)
717
- *
718
- * getGMTOffset("invalid-date");
719
- * // => "0"
720
- *
721
- * getGMTOffset(123);
722
- * // => "0"
723
- */
759
+ * * ***Utility: `getGMTOffset`.***
760
+ * ----------------------------------------------------------
761
+ * Returns the formatted GMT offset (e.g., `+0700`, `-0500`) for a given date.
762
+ * - **Features:**
763
+ * - If `date` is **not provided** or empty string, it defaults to the current date/time.
764
+ * - If `date` is **invalid** or of wrong type (like object or number), it returns `"0"`.
765
+ * - The returned string follows the **GMT offset format** (`±HHMM`), where:
766
+ * - `±` is `+` if ahead of UTC, `-` if behind.
767
+ * - `HH` is two-digit hours.
768
+ * - `MM` is two-digit minutes.
769
+ * @param {string | Date | null} [date] - The date to get the GMT offset from.
770
+ * - Accepts `Date` object or ISO date string (e.g., `"2024-01-01T12:00:00Z"`).
771
+ * - If `null`, `undefined`, or empty string, uses current system date.
772
+ * - If invalid date or wrong type (like `123` or `{}`), returns `"0"`.
773
+ * @returns {string} The GMT offset string in format `±HHMM`,
774
+ * e.g. `"+0700"`, `"-0530"`, or `"0"` if invalid.
775
+ * @example
776
+ * getGMTOffset();
777
+ * // ➔ "+0700" (depends on your system timezone)
778
+ * getGMTOffset(new Date("2024-02-09T12:00:00Z"));
779
+ * // "+0000"
780
+ * getGMTOffset("2024-02-09");
781
+ * // "+0700" (depends on your system timezone)
782
+ * getGMTOffset("invalid-date");
783
+ * // ➔ "0"
784
+ * getGMTOffset(123);
785
+ * // "0"
786
+ */
724
787
  declare const getGMTOffset:(date?:string|Date|null)=>string;type CensorEmailOptions={
725
788
  /** ----------------------------------------------------------
726
- * * ***Censorship Mode.***
727
- * ----------------------------------------------------------
728
- *
729
- * **Valid value:**
730
- * - `"fixed"` (default) Deterministic censorship based on a hash of the email.
731
- * The same input always produces the same output.
732
- * - `"random"` – Each character is randomly replaced every time the function is called.
733
- */
789
+ * * ***Censorship Mode.***
790
+ * ----------------------------------------------------------
791
+ * **Valid value:**
792
+ * - `"fixed"` (default) – Deterministic censorship based on a hash of the email.
793
+ * The same input always produces the same output.
794
+ * - `"random"` Each character is randomly replaced every time the function is called.
795
+ */
734
796
  mode?:"random"|"fixed";};
735
797
  /** ----------------------------------------------------------
736
- * * ***Censors an email by replacing characters with "\*" while supporting random or fixed mode.***
737
- * ----------------------------------------------------------
738
- *
739
- * This function replaces parts of an email with asterisks to protect privacy.
740
- *
741
- * **Modes:**
742
- * - `"fixed"` (default) Deterministic censorship based on a hash of the email. Same input always produces the same output.
743
- * - `"random"` – Each character is randomly replaced every time the function is called.
744
- *
745
- * Invalid emails or non-string input will return an empty string.
746
- *
747
- * @param {string | null | undefined} [email] - The email address to censor.
748
- * @param {CensorEmailOptions} [options={}] - Options object for mode.
749
- *
750
- * @returns {string} The censored email, or an empty string if input is invalid.
751
- *
752
- * @throws {TypeError} If `options` is not a plain object or `mode` is invalid.
753
- *
754
- * @example
755
- * // Fixed mode (default, deterministic)
756
- * censorEmail("john.doe@gmail.com");
757
- * // ➔ "j**n.**e@g***l.com"
758
- *
759
- * // Fixed mode explicitly
760
- * censorEmail("john.doe@gmail.com", { mode: "fixed" });
761
- * // ➔ "j**n.**e@g***l.com"
762
- *
763
- * // Random mode (output may vary each time)
764
- * censorEmail("john.doe@gmail.com", { mode: "random" });
765
- * // ➔ "j*hn.***e@g***l.com" (random)
766
- *
767
- * // Invalid email returns empty string
768
- * censorEmail("invalid-email");
769
- * // ""
770
- */
771
- declare const censorEmail:(email?:string|null,options?:CensorEmailOptions)=>string;type ChunkStringOptions={
772
- /**
773
- * The separator string to insert between characters or words.
774
- *
775
- * - Used when inserting separators every `limiter` characters.
776
- * - Default is a single space `" "`.
777
- *
778
- * @default " "
779
- */
798
+ * * ***Utility: `censorEmail`.***
799
+ * ----------------------------------------------------------
800
+ * **Censors an email by replacing characters with "\*" while supporting random or fixed mode.**
801
+ * - **This function replaces parts of an email with asterisks to protect privacy.**
802
+ * - **Modes:**
803
+ * - `"fixed"` (default) – Deterministic censorship based on a hash of the email, same input always produces the same output.
804
+ * - `"random"` – Each character is randomly replaced every time the function is called.
805
+ * - **ℹ️ Note:**
806
+ * - Invalid emails or non-string input will return an empty string.
807
+ * @param {string | null | undefined} email - The email address to censor.
808
+ * @param {CensorEmailOptions} [options={}] - Options object for mode.
809
+ * @returns {string} The censored email, or an empty string if input is invalid.
810
+ * @throws {TypeError} If `options` is not a plain object or `mode` is invalid.
811
+ * @example
812
+ * // Fixed mode (default, deterministic)
813
+ * censorEmail("john.doe@gmail.com");
814
+ * // "j**n.**e@g***l.com"
815
+ *
816
+ * // Fixed mode explicitly
817
+ * censorEmail("john.doe@gmail.com", { mode: "fixed" });
818
+ * // ➔ "j**n.**e@g***l.com"
819
+ *
820
+ * // Random mode (output may vary each time)
821
+ * censorEmail("john.doe@gmail.com", { mode: "random" });
822
+ * // ➔ "j*hn.***e@g***l.com" (random)
823
+ *
824
+ * // Invalid email returns empty string
825
+ * censorEmail("invalid-email");
826
+ * // ""
827
+ */
828
+ declare const censorEmail:(email:string|null|undefined,options?:CensorEmailOptions)=>string;type ChunkStringOptions={
829
+ /** The separator string to insert between characters or words.
830
+ *
831
+ * - Used when inserting separators every `limiter` characters.
832
+ * - Default is a single space `" "`.
833
+ *
834
+ * @default " "
835
+ */
780
836
  separator?:string;
781
- /**
782
- * Determines whether counting for `limiter` resets after each space.
783
- *
784
- * - If `true`, the string is treated as words separated by spaces,
785
- * and separators are applied within words, then words are grouped.
786
- * - If `false`, counting is continuous across the whole string,
787
- * treating spaces as normal characters.
788
- *
789
- * @default false
790
- */
837
+ /** Determines whether counting for `limiter` resets after each space.
838
+ *
839
+ * - If `true`, the string is treated as words separated by spaces,
840
+ * and separators are applied within words, then words are grouped.
841
+ * - If `false` ***(default)***, counting is continuous across the whole string,
842
+ * treating spaces as normal characters.
843
+ *
844
+ * @default false
845
+ */
791
846
  reCountAfterSpace?:boolean;};
792
847
  /** ----------------------------------------------
793
- * * ***Chunks a string by inserting a separator every `limiter` characters.***
794
- * ----------------------------------------------
795
- *
796
- * This function handles two main behaviors based on `reCountAfterSpace`:
797
- *
798
- * 1. If `reCountAfterSpace` is `false` (default):
799
- * The separator is inserted strictly every `limiter` characters throughout the entire string,
800
- * regardless of spaces. Spaces are treated as regular characters in the count.
801
- * Example: `chunkString("1234567890", 3, "-")` returns `"123-456-789-0"`.
802
- * Example: `chunkString("Hello World", 3, "-")` returns `"Hel-lo -Wor-ld"`.
803
- *
804
- * 2. If `reCountAfterSpace` is `true`:
805
- * The function first processes the input string to replace any multiple consecutive spaces
806
- * with a single space (e.g., "A B" becomes "A B").
807
- * Then, it treats the string as a sequence of "words" (segments separated by single spaces).
808
- * - Each word is processed independently: if a word's length exceeds the `limiter`,
809
- * separators are inserted internally within that word.
810
- * - Words are then grouped. Each group will contain `limiter` number of words.
811
- * Words within the same group are joined by the specified `separator`.
812
- * - Finally, these groups are joined by a single space, preserving the original word separation structure
813
- * between groups.
814
- *
815
- * @param {string} subject - The target string to chunk.
816
- * @param {number} limiter - The interval (number of characters) for inserting separators.
817
- * - If `reCountAfterSpace = false`, it counts characters.
818
- * - If `reCountAfterSpace = true`, it counts both characters within words and words per group.
819
- * @param {ChunkStringOptions} [options={}] - Optional settings for separator and counting behavior.
820
- * @returns {string} - The formatted string with separators.
821
- *
822
- * @example
823
- * // Basic usage
824
- * chunkString("1234567890", 3);
825
- * // "123 456 789 0"
826
- *
827
- * @example
828
- * // Basic usage `reCountAfterSpace = false` (default)
829
- * chunkString("1234567890", 3, { separator: "-");
830
- * // "123-456-789-0"
831
- * chunkString("HelloWorld", 2, { separator: "_", reCountAfterSpace: false });
832
- * // "He_ll_oW_or_ld"
833
- *
834
- * @example
835
- * // Usage with reCountAfterSpace = true:
836
- * // Multiple spaces are normalized to single spaces before processing.
837
- * chunkString("AB CD EF GH", 2, { separator: "-", reCountAfterSpace: true });
838
- * // "AB-CD EF-GH" (after normalization to "AB CD EF GH")
839
- * // Words "AB" and "CD" form a group and are joined by "-", "EF" and "GH" form another group.
840
- * // The groups "AB-CD" and "EF-GH" are then joined by a space.
841
- *
842
- * @example
843
- * // Another usage with reCountAfterSpace = true:
844
- * chunkString("ABC DEF GHI JKL", 3, { separator: "-", reCountAfterSpace: true });
845
- * // ➔ "ABC-DEF-GHI JKL"
846
- * // Words "ABC", "DEF", "GHI" form a group and are joined by "-".
847
- * // The word "JKL" forms its own group (as it's the last word and completes no other group).
848
- * // The groups "ABC-DEF-GHI" and "JKL" are then joined by a space.
849
- */
848
+ * * ***Utility: `chunkString`.***
849
+ * ----------------------------------------------
850
+ * **Chunks a string by inserting a separator every `limiter` characters.**
851
+ * - **This function handles two main behaviors based on `reCountAfterSpace`:**
852
+ * 1. ***If `reCountAfterSpace` is `false` (default):***
853
+ * - The separator is inserted strictly every `limiter` characters throughout the entire string, regardless of spaces, spaces are treated as regular characters in the count.
854
+ * - Example: `chunkString("1234567890", 3, "-")` `"123-456-789-0"`.
855
+ * - Example: `chunkString("Hello World", 3, "-")` `"Hel-lo -Wor-ld"`.
856
+ * 2. ***If `reCountAfterSpace` is `true`:***
857
+ * - The function first processes the input string to replace any multiple consecutive spaces with a
858
+ * single space (e.g., "A B" becomes "A B").
859
+ * Then, it treats the string as a sequence of "words" (segments separated by single spaces).
860
+ * - Each word is processed independently:
861
+ * - if a word's length exceeds the `limiter`, separators are inserted internally within that word.
862
+ * - Words are then grouped. Each group will contain `limiter` number of words.
863
+ * - Words within the same group are joined by the specified `separator`.
864
+ * - Finally, these groups are joined by a single space, preserving the original word separation
865
+ * structure between groups.
866
+ * @param {string} subject - The target string to chunk.
867
+ * @param {number} limiter - The interval (number of characters) for inserting separators.
868
+ * - If `reCountAfterSpace = false`, it counts characters.
869
+ * - If `reCountAfterSpace = true`, it counts both characters within words and words per group.
870
+ * @param {ChunkStringOptions} [options={}] - Optional settings for separator and counting behavior.
871
+ * @returns {string} Return the formatted string with separators.
872
+ * @example
873
+ * // Basic usage
874
+ * chunkString("1234567890", 3);
875
+ * // "123 456 789 0"
876
+ *
877
+ * // Basic usage `reCountAfterSpace = false` (default)
878
+ * chunkString("1234567890", 3, { separator: "-");
879
+ * // ➔ "123-456-789-0"
880
+ * chunkString("HelloWorld", 2, { separator: "_", reCountAfterSpace: false });
881
+ * // ➔ "He_ll_oW_or_ld"
882
+ *
883
+ * // Usage with reCountAfterSpace = true:
884
+ * // Multiple spaces are normalized to single spaces before processing.
885
+ * chunkString("AB CD EF GH", 2, { separator: "-", reCountAfterSpace: true });
886
+ * // ➔ "AB-CD EF-GH" (after normalization to "AB CD EF GH")
887
+ * // Words "AB" and "CD" form a group and are joined by "-", "EF" and "GH" form another group.
888
+ * // The groups "AB-CD" and "EF-GH" are then joined by a space.
889
+ *
890
+ * // Another usage with reCountAfterSpace = true:
891
+ * chunkString("ABC DEF GHI JKL", 3, { separator: "-", reCountAfterSpace: true });
892
+ * // "ABC-DEF-GHI JKL"
893
+ * // Words "ABC", "DEF", "GHI" form a group and are joined by "-".
894
+ * // The word "JKL" forms its own group (as it's the last word and completes no other group).
895
+ * // The groups "ABC-DEF-GHI" and "JKL" are then joined by a space.
896
+ */
850
897
  declare function chunkString(subject:string,limiter:number,options?:ChunkStringOptions):string;type TruncateStringOptions={
851
898
  /** **Maximum length of the truncated string **(default: `10`)**.**
852
- *
853
- * @default 10
854
- */
899
+ *
900
+ * @default 10
901
+ */
855
902
  length?:number;
856
903
  /** **String to append if truncation occurs.**
857
- *
858
- * - Will be trimmed first; defaults to `"..."` if empty.
859
- *
860
- * @default "..."
861
- */
904
+ *
905
+ * - Will be trimmed first; defaults to `"..."` if empty.
906
+ *
907
+ * @default "..."
908
+ */
862
909
  ending?:string;
863
910
  /** **Whether to trim the input string before truncation ***(default: `true`)***.**
864
- *
865
- * @default true
866
- */
911
+ *
912
+ * @default true
913
+ */
867
914
  trim?:boolean;};
868
915
  /** ----------------------------------------------------------
869
- * * ***Truncates a string to a specified length and optionally appends an ending.***
870
- * * ***Supports trimming the input before truncation.***
871
- * * ***If truncation occurs, trailing spaces before the ending are removed.***
872
- * * ***The `ending` parameter is always trimmed first; if empty, it defaults to `"..."`.***
873
- * ----------------------------------------------------------
874
- *
875
- * @param {string|null|undefined} text - The input string to truncate.
876
- * If `null`, `undefined`, or empty after trim, returns `""`.
877
- * @param {TruncateStringOptions} [options] - Optional settings:
878
- * - `length` (number, default 10): Maximum length of the truncated string.
879
- * - `ending` (string, default `"..."`): String to append if truncation occurs.
880
- * - `trim` (boolean, default true): Whether to trim the input before truncation.
881
- *
882
- * @returns {string} The truncated string with optional trimming and ending.
883
- * Returns `""` if input is empty or length < 1.
884
- *
885
- * @throws {TypeError} If `options.length` is not a finite number,
886
- * or if `options.ending` is not a string,
887
- * or if `options.trim` is not a boolean.
888
- *
889
- * @example
890
- * truncateString("hello world", { length: 5 });
891
- * // ➔ "hello..."
892
- *
893
- * truncateString("hello world", { length: 5, ending: "---" });
894
- * // "hello---"
895
- *
896
- * truncateString("hello world", { length: 5, ending: " " });
897
- * // ➔ "hello..." (ending trimmed to default)
898
- *
899
- * truncateString("hello world", { length: 5, ending: " !!! " });
900
- * // "hello!!!" (ending trimmed)
901
- *
902
- * truncateString(" long data string ", { length: 8, ending: "...", trim: true });
903
- * // ➔ "long dat..."
904
- *
905
- * truncateString(" long data string ", { length: 8, ending: "...", trim: false });
906
- * // ➔ " long ..."
907
- *
908
- * truncateString(null, { length: 5 });
909
- * // ➔ ""
910
- *
911
- */
912
- declare const truncateString:(text?:string|null,options?:TruncateStringOptions)=>string;export{censorEmail,chunkString,formatCurrency,formatDateFns,formatDateIntl,formatDateTime,formatNumber,formatPhoneNumber,getGMTOffset,truncateString};
916
+ * * ***Utility: `truncateString`.***
917
+ * ----------------------------------------------------------
918
+ * **Features:**
919
+ * - Truncates a string to a specified length and optionally appends an ending.
920
+ * - Supports trimming the input before truncation.
921
+ * - If truncation occurs, trailing spaces before the ending are removed.
922
+ * - The `ending` parameter is always trimmed first; if empty, it defaults to `"..."`.
923
+ * @param {string|null|undefined} text - The input string to truncate.
924
+ * If `null`, `undefined`, or empty after trim, returns `""`.
925
+ * @param {TruncateStringOptions} [options] - Optional settings:
926
+ * - `length` (number, default 10): Maximum length of the truncated string.
927
+ * - `ending` (string, default `"..."`): String to append if truncation occurs.
928
+ * - `trim` (boolean, default `true`): Whether to trim the input before truncation.
929
+ * @returns {string} The truncated string with optional trimming and ending.
930
+ * Returns `""` if input is empty or length < 1.
931
+ * @throws {TypeError} If `options.length` is not a finite number,
932
+ * or if `options.ending` is not a string,
933
+ * or if `options.trim` is not a boolean.
934
+ * @example
935
+ * truncateString("hello world", { length: 5 });
936
+ * // ➔ "hello..."
937
+ * truncateString("hello world", { length: 5, ending: "---" });
938
+ * // ➔ "hello---"
939
+ * truncateString("hello world", { length: 5, ending: " " });
940
+ * // ➔ "hello..." (ending trimmed to default)
941
+ * truncateString("hello world", { length: 5, ending: " !!! " });
942
+ * // ➔ "hello!!!" (ending trimmed)
943
+ * truncateString(" long data string ", { length: 8, ending: "...", trim: true });
944
+ * // ➔ "long dat..."
945
+ * truncateString(" long data string ", { length: 8, ending: "...", trim: false });
946
+ * // " long ..."
947
+ * truncateString(null, { length: 5 });
948
+ * // ➔ ""
949
+ */
950
+ declare const truncateString:(text:string|null|undefined,options?:TruncateStringOptions)=>string;export{censorEmail,chunkString,formatCurrency,formatDateFns,formatDateIntl,formatDateTime,formatNumber,formatPhoneNumber,getGMTOffset,truncateString};