@rzl-zone/utils-js 3.10.0 → 3.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. package/README.md +131 -129
  2. package/dist/assertions/index.cjs +11 -11
  3. package/dist/assertions/index.d.ts +487 -215
  4. package/dist/assertions/index.js +5 -5
  5. package/dist/{chunk-SN5HAK3Y.js → chunk-22V4WP3H.js} +4 -4
  6. package/dist/{chunk-EJV5AF4L.js → chunk-2XSZ2ANI.js} +2 -2
  7. package/dist/{chunk-OSSFLQDD.js → chunk-3T6VSWYX.js} +2 -2
  8. package/dist/{chunk-3LE6NX57.js → chunk-5WIEDF2J.js} +4 -4
  9. package/dist/{chunk-WLEZ2KSG.cjs → chunk-6EDFZJZ5.cjs} +126 -126
  10. package/dist/{chunk-GHU356XQ.js → chunk-6LXWT2I5.js} +3 -3
  11. package/dist/{chunk-GKDSBOYE.js → chunk-6YGBRENU.js} +3 -3
  12. package/dist/{chunk-NAOVH4OH.cjs → chunk-7FGNVDEV.cjs} +7 -7
  13. package/dist/{chunk-X6ULJZ3X.js → chunk-AXDYWO67.js} +2 -2
  14. package/dist/{chunk-UV5BKAYW.cjs → chunk-B6PMNZ4M.cjs} +7 -7
  15. package/dist/chunk-BAV5T2E3.cjs +1 -1
  16. package/dist/{chunk-YHFRCVTN.js → chunk-BLF7SD66.js} +3 -3
  17. package/dist/{chunk-QZI5PVCI.cjs → chunk-BMZZXZJ2.cjs} +4 -4
  18. package/dist/{chunk-DXPM4NOU.js → chunk-BOYP3ARU.js} +4 -4
  19. package/dist/{chunk-UXT4XSUK.js → chunk-BPYW5YL7.js} +2 -2
  20. package/dist/{chunk-QGTFQ7RO.cjs → chunk-C2PV3VWC.cjs} +6 -6
  21. package/dist/{chunk-MZ3T6L7Z.js → chunk-CCJ2MSN7.js} +2 -2
  22. package/dist/{chunk-H44QVAZL.cjs → chunk-DAPAK2W3.cjs} +31 -31
  23. package/dist/{chunk-OYFUBKEG.cjs → chunk-DLS3G6WQ.cjs} +4 -4
  24. package/dist/{chunk-MS2KSKD7.js → chunk-DNMCR5JH.js} +9 -9
  25. package/dist/chunk-DVMHRLKP.cjs +1 -1
  26. package/dist/{chunk-IX6PF5ZP.cjs → chunk-EBYFYZW4.cjs} +4 -4
  27. package/dist/{chunk-5Y6JL47L.js → chunk-ENMRZ4BE.js} +3 -3
  28. package/dist/{chunk-7EIFPHV3.js → chunk-FJ4BQFVO.js} +8 -8
  29. package/dist/{chunk-TJ5OY6MC.cjs → chunk-GIKL4PUF.cjs} +10 -10
  30. package/dist/{chunk-M5QB2GM5.js → chunk-GOFINGT6.js} +2 -2
  31. package/dist/{chunk-J6VLFVIL.js → chunk-GXKQ3LHF.js} +3 -3
  32. package/dist/{chunk-5KDVIEVO.js → chunk-HNBRGN4R.js} +2 -2
  33. package/dist/{chunk-OCTHWEZK.cjs → chunk-HYN6FC5A.cjs} +34 -34
  34. package/dist/{chunk-MBFVTGYS.js → chunk-IZGVBYFN.js} +4 -4
  35. package/dist/{chunk-QXTJVDWE.js → chunk-JIE447J5.js} +3 -3
  36. package/dist/{chunk-UFYMRRJH.cjs → chunk-JXEIJM5M.cjs} +61 -61
  37. package/dist/{chunk-WB3FT62A.js → chunk-K47GZDBH.js} +3 -3
  38. package/dist/{chunk-KUVRZ2JW.cjs → chunk-K5536YHG.cjs} +50 -50
  39. package/dist/chunk-KHO2SBNA.cjs +1 -1
  40. package/dist/{chunk-NJ24M6ZH.cjs → chunk-KXJ7X325.cjs} +37 -37
  41. package/dist/chunk-L5RDAVVH.js +1 -1
  42. package/dist/{chunk-SRWL4YCP.js → chunk-LJHPTLWB.js} +7 -7
  43. package/dist/{chunk-6AMDHVS2.cjs → chunk-M7ELWZXM.cjs} +9 -9
  44. package/dist/chunk-MSUW5VHZ.js +1590 -0
  45. package/dist/{chunk-2XGQQZ6A.cjs → chunk-MUHRPRR7.cjs} +3 -3
  46. package/dist/{chunk-XYWC4EQ3.cjs → chunk-MV3TSQSH.cjs} +71 -71
  47. package/dist/{chunk-VCYXNIZ2.cjs → chunk-NLZLXWAU.cjs} +9 -9
  48. package/dist/{chunk-76ATVDCR.cjs → chunk-NVRZPF5M.cjs} +3 -3
  49. package/dist/chunk-ONZFBJVW.js +1 -1
  50. package/dist/{chunk-62FS7WMB.cjs → chunk-PGNL7JXO.cjs} +31 -31
  51. package/dist/{chunk-JI57K7D4.cjs → chunk-Q4GEQS7X.cjs} +161 -161
  52. package/dist/chunk-QNKGP5DY.js +1 -1
  53. package/dist/{chunk-ZTHJQJ5F.cjs → chunk-QYI2VJLS.cjs} +9 -9
  54. package/dist/{chunk-C7GC2PFX.js → chunk-RBWZII5I.js} +3 -3
  55. package/dist/{chunk-MMRHKYT6.cjs → chunk-RMP7VMPB.cjs} +12 -12
  56. package/dist/{chunk-TXOVQZPU.js → chunk-RZOGBYIS.js} +2 -2
  57. package/dist/{chunk-ALRISPTL.cjs → chunk-SU3UELUB.cjs} +3 -3
  58. package/dist/chunk-SYHPSOUU.cjs +1626 -0
  59. package/dist/{chunk-R2DR7SPJ.js → chunk-SZUNAEMR.js} +6 -6
  60. package/dist/{chunk-YVRUY4EW.cjs → chunk-TER22LO4.cjs} +8 -8
  61. package/dist/{chunk-WRGN6UBK.js → chunk-TJHGRQ4P.js} +2 -2
  62. package/dist/{chunk-I33PB44Q.cjs → chunk-U23I7JPB.cjs} +15 -15
  63. package/dist/{chunk-VBSLIIDB.js → chunk-U7HHN47R.js} +10 -10
  64. package/dist/chunk-UDA26MCU.cjs +1 -1
  65. package/dist/{chunk-44X74C26.js → chunk-UIAWUZ4H.js} +4 -4
  66. package/dist/{chunk-5O66AUEC.js → chunk-ULQPCIA2.js} +2 -2
  67. package/dist/chunk-VJDDGRIK.cjs +1 -1
  68. package/dist/{chunk-6WVOUVWD.js → chunk-WETQI6HM.js} +9 -9
  69. package/dist/{chunk-FWWPEL7J.cjs → chunk-WLOQQFDS.cjs} +3 -3
  70. package/dist/chunk-WVSPXFTY.js +1 -1
  71. package/dist/{chunk-WKM6UVMG.cjs → chunk-WXFTVXBF.cjs} +4 -4
  72. package/dist/{chunk-YQHJB7KR.cjs → chunk-XPVTIGU2.cjs} +26 -26
  73. package/dist/{chunk-PWKOFPAH.cjs → chunk-XX6RUGTM.cjs} +3 -3
  74. package/dist/chunk-YWHHVDT4.js +1 -1
  75. package/dist/{chunk-7NXFGJJE.cjs → chunk-ZPDMWDGZ.cjs} +14 -14
  76. package/dist/{chunk-JYOCB6OV.js → chunk-ZVWZEGQP.js} +2 -2
  77. package/dist/conversions/index.cjs +34 -34
  78. package/dist/conversions/index.d.ts +489 -333
  79. package/dist/conversions/index.js +15 -15
  80. package/dist/events/index.cjs +8 -8
  81. package/dist/events/index.d.ts +35 -29
  82. package/dist/events/index.js +4 -4
  83. package/dist/formatters/index.cjs +19 -19
  84. package/dist/formatters/index.d.ts +917 -873
  85. package/dist/formatters/index.js +9 -9
  86. package/dist/generators/index.cjs +9 -9
  87. package/dist/generators/index.d.ts +104 -86
  88. package/dist/generators/index.js +4 -4
  89. package/dist/index.d.ts +1 -1
  90. package/dist/isPlainObject-0p3VveWr.d.ts +534 -0
  91. package/dist/next/index.cjs +37 -37
  92. package/dist/next/index.d.ts +36 -21
  93. package/dist/next/index.js +9 -9
  94. package/dist/next/server/index.cjs +4 -4
  95. package/dist/next/server/index.d.ts +6 -3
  96. package/dist/next/server/index.js +2 -2
  97. package/dist/operations/index.cjs +11 -11
  98. package/dist/operations/index.d.ts +14 -5
  99. package/dist/operations/index.js +8 -8
  100. package/dist/parsers/index.cjs +6 -6
  101. package/dist/parsers/index.d.ts +68 -65
  102. package/dist/parsers/index.js +5 -5
  103. package/dist/predicates/index.cjs +77 -77
  104. package/dist/predicates/index.d.ts +442 -258
  105. package/dist/predicates/index.js +14 -14
  106. package/dist/promises/index.cjs +6 -6
  107. package/dist/promises/index.d.ts +28 -16
  108. package/dist/promises/index.js +4 -4
  109. package/dist/rzl-utils.global.js +2 -2
  110. package/dist/strings/index.cjs +23 -23
  111. package/dist/strings/index.d.ts +82 -54
  112. package/dist/strings/index.js +7 -7
  113. package/dist/tailwind/index.cjs +13 -13
  114. package/dist/tailwind/index.d.ts +186 -169
  115. package/dist/tailwind/index.js +5 -5
  116. package/dist/urls/index.cjs +23 -23
  117. package/dist/urls/index.d.ts +252 -229
  118. package/dist/urls/index.js +16 -16
  119. package/package.json +6 -4
  120. package/dist/chunk-7C7TQC5J.cjs +0 -620
  121. package/dist/chunk-J4TT33ZX.js +0 -584
  122. package/dist/isPlainObject-BTPjv6zB.d.ts +0 -178
@@ -2,136 +2,148 @@
2
2
  * ====================================================
3
3
  * Rzl Utils-JS.
4
4
  * ----------------------------------------------------
5
- * Version: 3.10.0.
5
+ * Version: 3.11.1.
6
6
  * Author: Rizalvin Dwiky.
7
7
  * Repository: https://github.com/rzl-zone/utils-js.
8
8
  * ====================================================
9
9
  */
10
- import{NumberFormat,CountryCode}from'libphonenumber-js';import{OverrideTypes,ExtractStrict,Prettify,OmitStrict,AnyString}from'@rzl-zone/ts-types-plus';import{FormatOptions,Locale}from'date-fns';type NegativeFormatOptionCustom={
11
- /** Custom formatter function for the final formatted negative string.
12
- * If provided, it ***OVERRIDES*** style & space entirely. */
13
- custom:(formatted:string)=>string;style?:never;space?:never;};type NegativeFormatOptionUnCustom={custom?:never;
14
- /** Use style & optional spacing for negative numbers.
15
- *
16
- * @default "dash"
17
- */
18
- style?:"dash"|"brackets"|"abs";
19
- /** Whether to include space inside brackets or after dash.
20
- *
21
- * Default: false
22
- * @default false
23
- */
24
- space?:boolean;};
10
+ import { NumberFormat, CountryCode } from 'libphonenumber-js';
11
+ import { OverrideTypes, ExtractStrict, Prettify, OmitStrict, AnyString } from '@rzl-zone/ts-types-plus';
12
+ import { FormatOptions, Locale } from 'date-fns';
13
+
14
+ type NegativeFormatOptionCustom = {
15
+ /** Custom formatter function for the final formatted negative string.
16
+ * If provided, it ***OVERRIDES*** style & space entirely. */
17
+ custom: (formatted: string) => string;
18
+ style?: never;
19
+ space?: never;
20
+ };
21
+ type NegativeFormatOptionUnCustom = {
22
+ custom?: never;
23
+ /** Use style & optional spacing for negative numbers.
24
+ *
25
+ * @default "dash"
26
+ */
27
+ style?: "dash" | "brackets" | "abs";
28
+ /** Whether to include space inside brackets or after dash.
29
+ *
30
+ * Default: false
31
+ * @default false
32
+ */
33
+ space?: boolean;
34
+ };
25
35
  /** ---------------------------------------------------------------------------
26
36
  * * ***Type for negative number formatting options.***
27
37
  * ---------------------------------------------------------------------------
28
38
  */
29
- type NegativeFormatOption="dash"|"brackets"|"abs"|NegativeFormatOptionCustom|NegativeFormatOptionUnCustom;
39
+ type NegativeFormatOption = "dash" | "brackets" | "abs" | NegativeFormatOptionCustom | NegativeFormatOptionUnCustom;
30
40
  /** ---------------------------------------------------------------------------
31
41
  * * ***Type Options for {@link formatCurrency|`formatCurrency`}.***
32
42
  * ---------------------------------------------------------------------------
33
43
  */
34
- type FormatCurrencyOptions={
35
- /** ---------------------------------------------------------------------------
36
- * * ***Prefix currency string.***
37
- * ---------------------------------------------------------------------------
38
- * **Does not auto-keep input symbols.**
39
- * - ***DefaultValue:** `""`.*
40
- * - **Example:** `"Rp "` ➔ `Rp 1.000`.
41
- *
42
- * @default ""
43
- */
44
- suffixCurrency?:string;
45
- /** ---------------------------------------------------------------------------
46
- * * ***Thousands separator.***
47
- * ---------------------------------------------------------------------------
48
- * - ***DefaultValue:** `"."`.*
49
- * - **Example:** `"."` ➔ `1.000.000`.
50
- * @default "."
51
- */
52
- separator?:string;
53
- /** ---------------------------------------------------------------------------
54
- * * ***Prefix currency string.***
55
- * ---------------------------------------------------------------------------
56
- * **Whether to show decimals, if `false`, decimals are truncated.**
57
- * - ***DefaultValue:** `false`.*
58
- * @default false
59
- */
60
- decimal?:boolean;
61
- /** ---------------------------------------------------------------------------
62
- * * ***Total decimal digits.***
63
- * ---------------------------------------------------------------------------
64
- * **If `decimal: true` & `roundedDecimal: false`, simply cuts.**
65
- * - ***DefaultValue:** `2`.*
66
- * @default 2
67
- */
68
- totalDecimal?:number;
69
- /** ---------------------------------------------------------------------------
70
- * * ***Actually append `suffixDecimal`.***
71
- * ---------------------------------------------------------------------------
72
- * - ***DefaultValue:** `true`.*
73
- * @default true
74
- */
75
- endDecimal?:boolean;
76
- /** ---------------------------------------------------------------------------
77
- * * ***Text appended after decimals.***
78
- * ---------------------------------------------------------------------------
79
- * - ***DefaultValue:** `""`.*
80
- * - **Example:**
81
- * - `".-"` ➔ `1.000,00.-`.
82
- * - `" USD"` ➔ `1.000,00 USD`.
83
- * @default ""
84
- */
85
- suffixDecimal?:string;
86
- /** ---------------------------------------------------------------------------
87
- * * ***Rounding mode for decimals.***
88
- * ---------------------------------------------------------------------------
89
- * - **Behavior:**
90
- * - `"round"` ➔ nearest.
91
- * - `"ceil"` ➔ always up.
92
- * - `"floor"` ➔ always down.
93
- * - `false` ➔ truncate.
94
- * - ***DefaultValue:** `"round"`.*
95
- * @default "round"
96
- */
97
- roundedDecimal?:"round"|"ceil"|"floor"|false;
98
- /** ---------------------------------------------------------------------------
99
- * * ***Decimal separator.***
100
- * ---------------------------------------------------------------------------
101
- * - ***DefaultValue:** `","`.*
102
- * - **Example:** `","` ➔ `1.000,10`.
103
- * @default ","
104
- */
105
- separatorDecimals?:string;
106
- /** ---------------------------------------------------------------------------
107
- * * ***Negative formatting option.***
108
- * ---------------------------------------------------------------------------
109
- * **Can be string ("dash" | "brackets" | "abs") or object with custom formatter.**
110
- * - **Behavior:**
111
- * - `"dash"` ➔ `-15.000`.
112
- * - `"brackets"` ➔ `(15.000)`.
113
- * - `"abs"` ➔ `15.000` (always positive).
114
- * - Or object:
115
- * `{
116
- * style: "dash"|"brackets"|"abs",
117
- * space: true|false,
118
- * custom: (formatted) => string
119
- * }`.
120
- * - ***DefaultValue:** `"dash"`.*
121
- *
122
- * @default "dash"
123
- */
124
- negativeFormat?:NegativeFormatOption;
125
- /** ---------------------------------------------------------------------------
126
- * * ***Applies Indian Format.***
127
- * ---------------------------------------------------------------------------
128
- * - **Behavior:**
129
- * - If `true`, formats as Indian: `12,34,567`.
130
- * - Also forces `separator: ","`, `separatorDecimals: "."`.
131
- * - ***DefaultValue:** `false`.*
132
- * @default false
133
- */
134
- indianFormat?:boolean;};
44
+ type FormatCurrencyOptions = {
45
+ /** ---------------------------------------------------------------------------
46
+ * * ***Prefix currency string.***
47
+ * ---------------------------------------------------------------------------
48
+ * **Does not auto-keep input symbols.**
49
+ * - ***DefaultValue:** `""`.*
50
+ * - **Example:** `"Rp "` ➔ `Rp 1.000`.
51
+ *
52
+ * @default ""
53
+ */
54
+ suffixCurrency?: string;
55
+ /** ---------------------------------------------------------------------------
56
+ * * ***Thousands separator.***
57
+ * ---------------------------------------------------------------------------
58
+ * - ***DefaultValue:** `"."`.*
59
+ * - **Example:** `"."` ➔ `1.000.000`.
60
+ * @default "."
61
+ */
62
+ separator?: string;
63
+ /** ---------------------------------------------------------------------------
64
+ * * ***Prefix currency string.***
65
+ * ---------------------------------------------------------------------------
66
+ * **Whether to show decimals, if `false`, decimals are truncated.**
67
+ * - ***DefaultValue:** `false`.*
68
+ * @default false
69
+ */
70
+ decimal?: boolean;
71
+ /** ---------------------------------------------------------------------------
72
+ * * ***Total decimal digits.***
73
+ * ---------------------------------------------------------------------------
74
+ * **If `decimal: true` & `roundedDecimal: false`, simply cuts.**
75
+ * - ***DefaultValue:** `2`.*
76
+ * @default 2
77
+ */
78
+ totalDecimal?: number;
79
+ /** ---------------------------------------------------------------------------
80
+ * * ***Actually append `suffixDecimal`.***
81
+ * ---------------------------------------------------------------------------
82
+ * - ***DefaultValue:** `true`.*
83
+ * @default true
84
+ */
85
+ endDecimal?: boolean;
86
+ /** ---------------------------------------------------------------------------
87
+ * * ***Text appended after decimals.***
88
+ * ---------------------------------------------------------------------------
89
+ * - ***DefaultValue:** `""`.*
90
+ * - **Example:**
91
+ * - `".-"` ➔ `1.000,00.-`.
92
+ * - `" USD"` ➔ `1.000,00 USD`.
93
+ * @default ""
94
+ */
95
+ suffixDecimal?: string;
96
+ /** ---------------------------------------------------------------------------
97
+ * * ***Rounding mode for decimals.***
98
+ * ---------------------------------------------------------------------------
99
+ * - **Behavior:**
100
+ * - `"round"` ➔ nearest.
101
+ * - `"ceil"` ➔ always up.
102
+ * - `"floor"` ➔ always down.
103
+ * - `false` ➔ truncate.
104
+ * - ***DefaultValue:** `"round"`.*
105
+ * @default "round"
106
+ */
107
+ roundedDecimal?: "round" | "ceil" | "floor" | false;
108
+ /** ---------------------------------------------------------------------------
109
+ * * ***Decimal separator.***
110
+ * ---------------------------------------------------------------------------
111
+ * - ***DefaultValue:** `","`.*
112
+ * - **Example:** `","` ➔ `1.000,10`.
113
+ * @default ","
114
+ */
115
+ separatorDecimals?: string;
116
+ /** ---------------------------------------------------------------------------
117
+ * * ***Negative formatting option.***
118
+ * ---------------------------------------------------------------------------
119
+ * **Can be string ("dash" | "brackets" | "abs") or object with custom formatter.**
120
+ * - **Behavior:**
121
+ * - `"dash"` ➔ `-15.000`.
122
+ * - `"brackets"` ➔ `(15.000)`.
123
+ * - `"abs"` ➔ `15.000` (always positive).
124
+ * - Or object:
125
+ * `{
126
+ * style: "dash"|"brackets"|"abs",
127
+ * space: true|false,
128
+ * custom: (formatted) => string
129
+ * }`.
130
+ * - ***DefaultValue:** `"dash"`.*
131
+ *
132
+ * @default "dash"
133
+ */
134
+ negativeFormat?: NegativeFormatOption;
135
+ /** ---------------------------------------------------------------------------
136
+ * * ***Applies Indian Format.***
137
+ * ---------------------------------------------------------------------------
138
+ * - **Behavior:**
139
+ * - If `true`, formats as Indian: `12,34,567`.
140
+ * - Also forces `separator: ","`, `separatorDecimals: "."`.
141
+ * - ***DefaultValue:** `false`.*
142
+ * @default false
143
+ */
144
+ indianFormat?: boolean;
145
+ };
146
+
135
147
  /** -------------------------------------------------------
136
148
  * * ***Utility: `formatCurrency`.***
137
149
  * -------------------------------------------------------
@@ -359,7 +371,8 @@ indianFormat?:boolean;};
359
371
  * });
360
372
  * // ➔ "Rp 1.121.234,00"
361
373
  */
362
- declare const formatCurrency:(value:string|number,options?:FormatCurrencyOptions)=>string;
374
+ declare const formatCurrency: (value: string | number, options?: FormatCurrencyOptions) => string;
375
+
363
376
  /** ----------------------------------------------------------
364
377
  * * ***Utility: `formatNumber`.***
365
378
  * ----------------------------------------------------------
@@ -407,7 +420,8 @@ declare const formatCurrency:(value:string|number,options?:FormatCurrencyOptions
407
420
  * formatNumber("1234,56", ",");
408
421
  * // ➔ "1,234.56"
409
422
  */
410
- declare const formatNumber:(value:string|number,separator?:string)=>string;
423
+ declare const formatNumber: (value: string | number, separator?: string) => string;
424
+
411
425
  /** -------------------------------------------------------
412
426
  * * ***Output format mode for {@link formatPhoneNumber|`formatPhoneNumber`}.***
413
427
  * -------------------------------------------------------
@@ -416,7 +430,7 @@ declare const formatNumber:(value:string|number,separator?:string)=>string;
416
430
  * - `'NATIONAL'` ➔ `0812 3456 7890`
417
431
  * - `'INTERNATIONAL'` ➔ `+62 812 3456 7890`
418
432
  */
419
- type OutputFormat=ExtractStrict<NumberFormat,"INTERNATIONAL"|"NATIONAL"|"RFC3966"|"E.164">;
433
+ type OutputFormat = ExtractStrict<NumberFormat, "INTERNATIONAL" | "NATIONAL" | "RFC3966" | "E.164">;
420
434
  /** -------------------------------------------------------
421
435
  * * ***Single input value for {@link formatPhoneNumber|`formatPhoneNumber`}.***
422
436
  * -------------------------------------------------------
@@ -431,7 +445,7 @@ type OutputFormat=ExtractStrict<NumberFormat,"INTERNATIONAL"|"NATIONAL"|"RFC3966
431
445
  * - Prefer using a `string` if the number may begin with `0`.
432
446
  * - E.164 international standard allows **up to 15 digits** (not counting `+`).
433
447
  */
434
- type ValueFormatPhoneNumber=string|number|null|undefined;
448
+ type ValueFormatPhoneNumber = string | number | null | undefined;
435
449
  /** -------------------------------------------------------
436
450
  * * ***Base option set for {@link formatPhoneNumber|`formatPhoneNumber`}.***
437
451
  * -------------------------------------------------------
@@ -446,268 +460,269 @@ type ValueFormatPhoneNumber=string|number|null|undefined;
446
460
  * the regex will still validate numbers without `+`
447
461
  * as long as the digit count ≤ **15**.
448
462
  */
449
- type FormatPhoneNumberMain={
450
- /** -------------------------------------------------------
451
- * * ***Separator for formatted output.***
452
- * -------------------------------------------------------
453
- * **Defines the string used to separate groups of digits**
454
- * in the formatted phone number.
455
- * - **Default:** `" "`.
456
- * - **Executed only when:**
457
- * - Parameter options `checkValidOnly` and `takeNumberOnly` are both `false`.
458
- * - (This option is ignored if either `checkValidOnly` or `takeNumberOnly` is `true`.)
459
- * - **Behavior:**
460
- * - The formatter inserts this separator between number blocks
461
- * according to the selected `outputFormat`.
462
- * @default " "
463
- * @example
464
- * ```ts
465
- * // Using dash as separator
466
- * formatPhoneNumber("081234567890", { defaultCountry: "ID", separator: "-" });
467
- * // ➔ "+62 812-3456-7890"
468
- *
469
- * // Using space as separator
470
- * formatPhoneNumber("(151) 2345-6789", { defaultCountry: "DE", separator: " " });
471
- * // ➔ "+49 1512 3456789"
472
- * ```
473
- */
474
- separator?:string;
475
- /** -------------------------------------------------------
476
- * * ***Output format style for the returned phone number.***
477
- * -------------------------------------------------------
478
- * **Determines how the formatted phone number string is returned.**
479
- *
480
- * - **Default:** `"INTERNATIONAL"`.
481
- * - **Applicable only when:**
482
- * - Parameter options `checkValidOnly` and `takeNumberOnly`
483
- * are both **`false`**.
484
- * - (Ignored if either of those options is `true`.)
485
- *
486
- * - **Supported values (from {@link NumberFormat}):**
487
- * - `"NATIONAL"` – Local/national format, e.g. `0812 3456 7890`.
488
- * - `"INTERNATIONAL"` – International format with leading plus, e.g. `+62 812 3456 7890`.
489
- * - `"E.164"` – Compact E.164 format, e.g. `+6281234567890`.
490
- * - `"RFC3966"` – RFC 3966 URI format, e.g. `tel:+62-812-3456-7890`.
491
- *
492
- * @default "INTERNATIONAL"
493
- * @example
494
- * ```ts
495
- * // Returns a national-format string
496
- * formatPhoneNumber("+62 81234567890", { outputFormat: "NATIONAL" });
497
- * // ➔ "0812 3456 7890"
498
- *
499
- * // Returns an E.164-format string
500
- * formatPhoneNumber("+62 81234567890", { outputFormat: "E.164" });
501
- * // ➔ "+6281234567890"
502
- * ```
503
- */
504
- outputFormat?:OutputFormat;
505
- /** -------------------------------------------------------
506
- * * ***Prepend a plus sign and country calling code.***
507
- * -------------------------------------------------------
508
- * **Forces the returned phone number to start with a leading `+`
509
- * followed by the detected country calling code (e.g. `+63`, `+1`).**
510
- * - **Default:** `true`.
511
- * - **Executed only when:**
512
- * - Parameter options `outputFormat` is set to `"INTERNATIONAL"`.
513
- * - (This option is ignored for `"NATIONAL"`, `"E.164"` or `"RFC3966"` formats.).
514
- * - **Applicable when:**
515
- * - You want to guarantee that the result
516
- * always contains a plus sign and country code, regardless of
517
- * the selected `outputFormat`.
518
- * - **Behavior:**
519
- * - When `true`, the formatter ensures the output begins with
520
- * a `+` and the correct country code.
521
- * - When `false`, the output follows the chosen `outputFormat`
522
- * without forcing a `+` prefix.
523
- * @default true
524
- * @example
525
- * ```ts
526
- * // Automatically adds +63 (default: `true`) even if input is local format
527
- * formatPhoneNumber("09171234567", {
528
- * country: "PH",
529
- * prependPlusCountryCode: true
530
- * });
531
- * // ➔ "+63 917 123 4567"
532
- *
533
- * formatPhoneNumber("09171234567", {
534
- * country: "PH",
535
- * prependPlusCountryCode: false
536
- * });
537
- * // ➔ "63 917 123 4567"
538
- *
539
- * // Leaves number in national format (no plus sign)
540
- * formatPhoneNumber("+63 9171234567", {
541
- * country: "PH",
542
- * prependPlusCountryCode: false,
543
- * outputFormat: "NATIONAL"
544
- * });
545
- * // ➔ "0917 123 4567"
546
- * ```
547
- */
548
- prependPlusCountryCode?:boolean;
549
- /** -------------------------------------------------------
550
- * * ***Characters before the country code (e.g. `"("`).***
551
- * -------------------------------------------------------
552
- * **Adds a custom string that appears **immediately before** the
553
- * international country calling code when formatting.**
554
- * - **Default:** `""` (empty string).
555
- * - **Behavior:**
556
- * - **Active only when:**
557
- * - `checkValidOnly` is **false**,
558
- * - `takeNumberOnly` is **false**, **and**
559
- * - `outputFormat` is `"INTERNATIONAL"`.
560
- * - **Ignored if:**
561
- * - The value is an empty string (after trimming),
562
- * - `checkValidOnly` or `takeNumberOnly` is `true`,
563
- * - `outputFormat` is not `"INTERNATIONAL"`,
564
- * - `closingNumberCountry` is `undefined` or an empty string (after trimming).
565
- * - **Invalid input:**
566
- * - Returns no effect if the phone number is invalid or not compatible
567
- * with the selected `defaultCountry`.
568
- * @default ""
569
- * @example
570
- * ```ts
571
- * formatPhoneNumber("+63 9171234567", {
572
- * outputFormat: "INTERNATIONAL",
573
- * openingNumberCountry: "(",
574
- * closingNumberCountry: ")"
575
- * });
576
- * // ➔ "(+63) 917 123 4567"
577
- * ```
578
- */
579
- openingNumberCountry?:string;
580
- /** -------------------------------------------------------
581
- * * ***Characters after the country code (e.g. `")"`).***
582
- * -------------------------------------------------------
583
- * **Adds a custom string that appears **immediately after** the
584
- * international country calling code when formatting.**
585
- * - **Default:** `""` (empty string).
586
- * - **Behavior:**
587
- * - **Active only when:**
588
- * - `checkValidOnly` is **false**,
589
- * - `takeNumberOnly` is **false**, **and**
590
- * - `outputFormat` is `"INTERNATIONAL"`.
591
- * - **Ignored if:**
592
- * - The value is an empty string (after trimming),
593
- * - `checkValidOnly` or `takeNumberOnly` is `true`,
594
- * - `outputFormat` is not `"INTERNATIONAL"`,
595
- * - `openingNumberCountry` is `undefined` or an empty string (after trimming).
596
- * - **Invalid input:**
597
- * Returns no effect if the phone number is invalid or not compatible
598
- * with the selected `defaultCountry`.
599
- * @default ""
600
- * @example
601
- * ```ts
602
- * formatPhoneNumber("+63 9171234567", {
603
- * outputFormat: "INTERNATIONAL",
604
- * openingNumberCountry: "(",
605
- * closingNumberCountry: ")"
606
- * });
607
- * // ➔ "(+63) 917 123 4567"
608
- * ```
609
- */
610
- closingNumberCountry?:string;
611
- /** -------------------------------------------------------
612
- * * ***Return only a boolean validity flag.***
613
- * -------------------------------------------------------
614
- * - ***Behavior:***
615
- * - **Exclusive mode:**
616
- * - ⚠️ When `true`, all formatting options and `takeNumberOnly` must be omitted or are ignored.
617
- * - Conflicts with `takeNumberOnly`:
618
- * - ⚠️ When `checkValidOnly` is `true` and all formatting options and `takeNumberOnly` must be
619
- * omitted or are ignored.
620
- * - But if mistake passing props:
621
- * - ⚠️ When `checkValidOnly` is `true` and other of formatting options was passing:
622
- * - If `takeNumberOnly` is `true` or `false`:
623
- * - Will return a `boolean` because `checkValidOnly` is prioritize first.
624
- * - Output:
625
- * - Boolean ➔ (`true` or `false`).
626
- * - ***DefaultValue: false***
627
- * @default false
628
- * @example
629
- * ```ts
630
- * // Returns `true` if valid number and number with country code (no need `defaultCountry`)
631
- * formatPhoneNumber("+63 912-123-4567", { checkValidOnly: true });
632
- * // ➔ true
633
- *
634
- * // Returns `true` if valid number and number without country code but with `defaultCountry`
635
- * formatPhoneNumber("213-373-4253", { defaultCountry: "US", checkValidOnly: true });
636
- * // ➔ true
637
- *
638
- * // Returns `false` if without country code.
639
- * formatPhoneNumber("213-373-4253", { checkValidOnly: true });
640
- * // ➔ false
641
- *
642
- * // Returns `false` for invalid number.
643
- * formatPhoneNumber("abcd", { checkValidOnly: true });
644
- * // ➔ false
645
- * ```
646
- */
647
- checkValidOnly?:boolean;
648
- /** -------------------------------------------------------
649
- * * ***Return only the digits of the phone number (local number only).***
650
- * -------------------------------------------------------
651
- * **Returns a string containing only numeric characters** from the **local number**,
652
- * ignoring any country code, spaces, plus signs, or separators.
653
- * - **Default:** `false`
654
- * - **Behavior:**
655
- * - **Exclusive mode:**
656
- * - ⚠️ When set to `true`, all formatting options
657
- * (`outputFormat`, `prependPlusCountryCode`, etc.)
658
- * and `checkValidOnly` **must be omitted** or will be **ignored**.
659
- * - **Conflict handling with `checkValidOnly`:**
660
- * - If both `takeNumberOnly` and `checkValidOnly` are `true`,
661
- * `checkValidOnly` takes priority and the function
662
- * returns a `boolean`.
663
- * - If `checkValidOnly` is `false` (or not provided),
664
- * and `takeNumberOnly` is `true`,
665
- * the function returns a **numeric string of the local number**.
666
- * - **Invalid input:**
667
- * - If the input is invalid or cannot be parsed
668
- * (e.g. not matching the `defaultCountry`),
669
- * the function returns an **empty string** (`""`).
670
- * - **Output example:**
671
- * - Valid input ➔ `"81234567890"` // country code removed
672
- * - Invalid input ➔ `""`
673
- * @default false
674
- * @example
675
- * ```ts
676
- * // Returns only digits of the local number with country code (no need `defaultCountry`)
677
- * formatPhoneNumber("+63 912-123-4567", { takeNumberOnly: true });
678
- * // ➔ "09121234567"
679
- *
680
- * // Returns only digits of the local number without country code but with `defaultCountry`
681
- * formatPhoneNumber("213-373-4253", { defaultCountry: "US", takeNumberOnly: true });
682
- * // ➔ "2133734253"
683
- *
684
- * // Returns empty string if without country code.
685
- * formatPhoneNumber("213-373-4253", { takeNumberOnly: true });
686
- * // ➔ ""
687
- *
688
- * // Returns empty string for invalid number.
689
- * formatPhoneNumber("abcd", { takeNumberOnly: true });
690
- * // ➔ ""
691
- * ```
692
- */
693
- takeNumberOnly?:boolean;
694
- /** -------------------------------------------------------
695
- * * ***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"`).***
696
- * -------------------------------------------------------
697
- * **Used to interpret numbers without an explicit `+<countryCode>`.**
698
- * - ***Behavior:***
699
- * - Required if the input without country code (`+`).
700
- * - Ignored if the input already starts with `+`.
701
- * - ***Examples:***
702
- * - `"ID"` ➔ Indonesian.
703
- * - `"US"` ➔ United States.
704
- * - `"GB"` ➔ United Kingdom.
705
- * - ***DefaultValue: `undefined`***.
706
- * @example
707
- * formatPhoneNumber("081234567890", { defaultCountry: "ID" });
708
- * @default undefined
709
- */
710
- defaultCountry?:CountryCode;};
463
+ type FormatPhoneNumberMain = {
464
+ /** -------------------------------------------------------
465
+ * * ***Separator for formatted output.***
466
+ * -------------------------------------------------------
467
+ * **Defines the string used to separate groups of digits**
468
+ * in the formatted phone number.
469
+ * - **Default:** `" "`.
470
+ * - **Executed only when:**
471
+ * - Parameter options `checkValidOnly` and `takeNumberOnly` are both `false`.
472
+ * - (This option is ignored if either `checkValidOnly` or `takeNumberOnly` is `true`.)
473
+ * - **Behavior:**
474
+ * - The formatter inserts this separator between number blocks
475
+ * according to the selected `outputFormat`.
476
+ * @default " "
477
+ * @example
478
+ * ```ts
479
+ * // Using dash as separator
480
+ * formatPhoneNumber("081234567890", { defaultCountry: "ID", separator: "-" });
481
+ * // ➔ "+62 812-3456-7890"
482
+ *
483
+ * // Using space as separator
484
+ * formatPhoneNumber("(151) 2345-6789", { defaultCountry: "DE", separator: " " });
485
+ * // ➔ "+49 1512 3456789"
486
+ * ```
487
+ */
488
+ separator?: string;
489
+ /** -------------------------------------------------------
490
+ * * ***Output format style for the returned phone number.***
491
+ * -------------------------------------------------------
492
+ * **Determines how the formatted phone number string is returned.**
493
+ *
494
+ * - **Default:** `"INTERNATIONAL"`.
495
+ * - **Applicable only when:**
496
+ * - Parameter options `checkValidOnly` and `takeNumberOnly`
497
+ * are both **`false`**.
498
+ * - (Ignored if either of those options is `true`.)
499
+ *
500
+ * - **Supported values (from {@link NumberFormat}):**
501
+ * - `"NATIONAL"` – Local/national format, e.g. `0812 3456 7890`.
502
+ * - `"INTERNATIONAL"` – International format with leading plus, e.g. `+62 812 3456 7890`.
503
+ * - `"E.164"` – Compact E.164 format, e.g. `+6281234567890`.
504
+ * - `"RFC3966"` – RFC 3966 URI format, e.g. `tel:+62-812-3456-7890`.
505
+ *
506
+ * @default "INTERNATIONAL"
507
+ * @example
508
+ * ```ts
509
+ * // Returns a national-format string
510
+ * formatPhoneNumber("+62 81234567890", { outputFormat: "NATIONAL" });
511
+ * // ➔ "0812 3456 7890"
512
+ *
513
+ * // Returns an E.164-format string
514
+ * formatPhoneNumber("+62 81234567890", { outputFormat: "E.164" });
515
+ * // ➔ "+6281234567890"
516
+ * ```
517
+ */
518
+ outputFormat?: OutputFormat;
519
+ /** -------------------------------------------------------
520
+ * * ***Prepend a plus sign and country calling code.***
521
+ * -------------------------------------------------------
522
+ * **Forces the returned phone number to start with a leading `+`
523
+ * followed by the detected country calling code (e.g. `+63`, `+1`).**
524
+ * - **Default:** `true`.
525
+ * - **Executed only when:**
526
+ * - Parameter options `outputFormat` is set to `"INTERNATIONAL"`.
527
+ * - (This option is ignored for `"NATIONAL"`, `"E.164"` or `"RFC3966"` formats.).
528
+ * - **Applicable when:**
529
+ * - You want to guarantee that the result
530
+ * always contains a plus sign and country code, regardless of
531
+ * the selected `outputFormat`.
532
+ * - **Behavior:**
533
+ * - When `true`, the formatter ensures the output begins with
534
+ * a `+` and the correct country code.
535
+ * - When `false`, the output follows the chosen `outputFormat`
536
+ * without forcing a `+` prefix.
537
+ * @default true
538
+ * @example
539
+ * ```ts
540
+ * // Automatically adds +63 (default: `true`) even if input is local format
541
+ * formatPhoneNumber("09171234567", {
542
+ * country: "PH",
543
+ * prependPlusCountryCode: true
544
+ * });
545
+ * // ➔ "+63 917 123 4567"
546
+ *
547
+ * formatPhoneNumber("09171234567", {
548
+ * country: "PH",
549
+ * prependPlusCountryCode: false
550
+ * });
551
+ * // ➔ "63 917 123 4567"
552
+ *
553
+ * // Leaves number in national format (no plus sign)
554
+ * formatPhoneNumber("+63 9171234567", {
555
+ * country: "PH",
556
+ * prependPlusCountryCode: false,
557
+ * outputFormat: "NATIONAL"
558
+ * });
559
+ * // ➔ "0917 123 4567"
560
+ * ```
561
+ */
562
+ prependPlusCountryCode?: boolean;
563
+ /** -------------------------------------------------------
564
+ * * ***Characters before the country code (e.g. `"("`).***
565
+ * -------------------------------------------------------
566
+ * **Adds a custom string that appears **immediately before** the
567
+ * international country calling code when formatting.**
568
+ * - **Default:** `""` (empty string).
569
+ * - **Behavior:**
570
+ * - **Active only when:**
571
+ * - `checkValidOnly` is **false**,
572
+ * - `takeNumberOnly` is **false**, **and**
573
+ * - `outputFormat` is `"INTERNATIONAL"`.
574
+ * - **Ignored if:**
575
+ * - The value is an empty string (after trimming),
576
+ * - `checkValidOnly` or `takeNumberOnly` is `true`,
577
+ * - `outputFormat` is not `"INTERNATIONAL"`,
578
+ * - `closingNumberCountry` is `undefined` or an empty string (after trimming).
579
+ * - **Invalid input:**
580
+ * - Returns no effect if the phone number is invalid or not compatible
581
+ * with the selected `defaultCountry`.
582
+ * @default ""
583
+ * @example
584
+ * ```ts
585
+ * formatPhoneNumber("+63 9171234567", {
586
+ * outputFormat: "INTERNATIONAL",
587
+ * openingNumberCountry: "(",
588
+ * closingNumberCountry: ")"
589
+ * });
590
+ * // ➔ "(+63) 917 123 4567"
591
+ * ```
592
+ */
593
+ openingNumberCountry?: string;
594
+ /** -------------------------------------------------------
595
+ * * ***Characters after the country code (e.g. `")"`).***
596
+ * -------------------------------------------------------
597
+ * **Adds a custom string that appears **immediately after** the
598
+ * international country calling code when formatting.**
599
+ * - **Default:** `""` (empty string).
600
+ * - **Behavior:**
601
+ * - **Active only when:**
602
+ * - `checkValidOnly` is **false**,
603
+ * - `takeNumberOnly` is **false**, **and**
604
+ * - `outputFormat` is `"INTERNATIONAL"`.
605
+ * - **Ignored if:**
606
+ * - The value is an empty string (after trimming),
607
+ * - `checkValidOnly` or `takeNumberOnly` is `true`,
608
+ * - `outputFormat` is not `"INTERNATIONAL"`,
609
+ * - `openingNumberCountry` is `undefined` or an empty string (after trimming).
610
+ * - **Invalid input:**
611
+ * Returns no effect if the phone number is invalid or not compatible
612
+ * with the selected `defaultCountry`.
613
+ * @default ""
614
+ * @example
615
+ * ```ts
616
+ * formatPhoneNumber("+63 9171234567", {
617
+ * outputFormat: "INTERNATIONAL",
618
+ * openingNumberCountry: "(",
619
+ * closingNumberCountry: ")"
620
+ * });
621
+ * // ➔ "(+63) 917 123 4567"
622
+ * ```
623
+ */
624
+ closingNumberCountry?: string;
625
+ /** -------------------------------------------------------
626
+ * * ***Return only a boolean validity flag.***
627
+ * -------------------------------------------------------
628
+ * - ***Behavior:***
629
+ * - **Exclusive mode:**
630
+ * - ⚠️ When `true`, all formatting options and `takeNumberOnly` must be omitted or are ignored.
631
+ * - Conflicts with `takeNumberOnly`:
632
+ * - ⚠️ When `checkValidOnly` is `true` and all formatting options and `takeNumberOnly` must be
633
+ * omitted or are ignored.
634
+ * - But if mistake passing props:
635
+ * - ⚠️ When `checkValidOnly` is `true` and other of formatting options was passing:
636
+ * - If `takeNumberOnly` is `true` or `false`:
637
+ * - Will return a `boolean` because `checkValidOnly` is prioritize first.
638
+ * - Output:
639
+ * - Boolean ➔ (`true` or `false`).
640
+ * - ***DefaultValue: false***
641
+ * @default false
642
+ * @example
643
+ * ```ts
644
+ * // Returns `true` if valid number and number with country code (no need `defaultCountry`)
645
+ * formatPhoneNumber("+63 912-123-4567", { checkValidOnly: true });
646
+ * // ➔ true
647
+ *
648
+ * // Returns `true` if valid number and number without country code but with `defaultCountry`
649
+ * formatPhoneNumber("213-373-4253", { defaultCountry: "US", checkValidOnly: true });
650
+ * // ➔ true
651
+ *
652
+ * // Returns `false` if without country code.
653
+ * formatPhoneNumber("213-373-4253", { checkValidOnly: true });
654
+ * // ➔ false
655
+ *
656
+ * // Returns `false` for invalid number.
657
+ * formatPhoneNumber("abcd", { checkValidOnly: true });
658
+ * // ➔ false
659
+ * ```
660
+ */
661
+ checkValidOnly?: boolean;
662
+ /** -------------------------------------------------------
663
+ * * ***Return only the digits of the phone number (local number only).***
664
+ * -------------------------------------------------------
665
+ * **Returns a string containing only numeric characters** from the **local number**,
666
+ * ignoring any country code, spaces, plus signs, or separators.
667
+ * - **Default:** `false`
668
+ * - **Behavior:**
669
+ * - **Exclusive mode:**
670
+ * - ⚠️ When set to `true`, all formatting options
671
+ * (`outputFormat`, `prependPlusCountryCode`, etc.)
672
+ * and `checkValidOnly` **must be omitted** or will be **ignored**.
673
+ * - **Conflict handling with `checkValidOnly`:**
674
+ * - If both `takeNumberOnly` and `checkValidOnly` are `true`,
675
+ * `checkValidOnly` takes priority and the function
676
+ * returns a `boolean`.
677
+ * - If `checkValidOnly` is `false` (or not provided),
678
+ * and `takeNumberOnly` is `true`,
679
+ * the function returns a **numeric string of the local number**.
680
+ * - **Invalid input:**
681
+ * - If the input is invalid or cannot be parsed
682
+ * (e.g. not matching the `defaultCountry`),
683
+ * the function returns an **empty string** (`""`).
684
+ * - **Output example:**
685
+ * - Valid input ➔ `"81234567890"` // country code removed
686
+ * - Invalid input ➔ `""`
687
+ * @default false
688
+ * @example
689
+ * ```ts
690
+ * // Returns only digits of the local number with country code (no need `defaultCountry`)
691
+ * formatPhoneNumber("+63 912-123-4567", { takeNumberOnly: true });
692
+ * // ➔ "09121234567"
693
+ *
694
+ * // Returns only digits of the local number without country code but with `defaultCountry`
695
+ * formatPhoneNumber("213-373-4253", { defaultCountry: "US", takeNumberOnly: true });
696
+ * // ➔ "2133734253"
697
+ *
698
+ * // Returns empty string if without country code.
699
+ * formatPhoneNumber("213-373-4253", { takeNumberOnly: true });
700
+ * // ➔ ""
701
+ *
702
+ * // Returns empty string for invalid number.
703
+ * formatPhoneNumber("abcd", { takeNumberOnly: true });
704
+ * // ➔ ""
705
+ * ```
706
+ */
707
+ takeNumberOnly?: boolean;
708
+ /** -------------------------------------------------------
709
+ * * ***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"`).***
710
+ * -------------------------------------------------------
711
+ * **Used to interpret numbers without an explicit `+<countryCode>`.**
712
+ * - ***Behavior:***
713
+ * - Required if the input without country code (`+`).
714
+ * - Ignored if the input already starts with `+`.
715
+ * - ***Examples:***
716
+ * - `"ID"` ➔ Indonesian.
717
+ * - `"US"` ➔ United States.
718
+ * - `"GB"` ➔ United Kingdom.
719
+ * - ***DefaultValue: `undefined`***.
720
+ * @example
721
+ * formatPhoneNumber("081234567890", { defaultCountry: "ID" });
722
+ * @default undefined
723
+ */
724
+ defaultCountry?: CountryCode;
725
+ };
711
726
  /** -------------------------------------------------------
712
727
  * * ***Specialized options for the `transformPhoneNumber` variant of {@link formatPhoneNumber|`formatPhoneNumber`}.***
713
728
  * -------------------------------------------------------
@@ -719,106 +734,109 @@ defaultCountry?:CountryCode;};
719
734
  *
720
735
  * **Example Output:** `+62 812 3456 7890`
721
736
  */
722
- type FormatPhoneNumberTransform=OverrideTypes<FormatPhoneNumberMain,{
723
- /** -------------------------------------------------------
724
- * * ***Return only a boolean validity flag.***
725
- * -------------------------------------------------------
726
- * - ***Behavior:***
727
- * - **Exclusive mode:**
728
- * - ⚠️ When `true`, all formatting options and `takeNumberOnly` must be omitted or are ignored.
729
- * - Conflicts with `takeNumberOnly`:
730
- * - ⚠️ When `checkValidOnly` is `true` and all formatting options and `takeNumberOnly` must be
731
- * omitted or are ignored.
732
- * - But if mistake passing props:
733
- * - ⚠️ When `checkValidOnly` is `true` and other of formatting options was passing:
734
- * - If `takeNumberOnly` is `true` or `false`:
735
- * - Will return a `boolean` because `checkValidOnly` is prioritize first.
736
- * - Output:
737
- * - Boolean ➔ (`true` or `false`).
738
- * - ***DefaultValue: false***
739
- * @default false
740
- * @requires `false` or `undefined`
741
- */
742
- checkValidOnly?:never;
743
- /** -------------------------------------------------------
744
- * * ***Return only the digits of the phone number (local number only).***
745
- * -------------------------------------------------------
746
- * **Returns a string containing only numeric characters** from the **local number**,
747
- * ignoring any country code, spaces, plus signs, or separators.
748
- * - **Default:** `false`
749
- * - **Behavior:**
750
- * - **Exclusive mode:**
751
- * - ⚠️ When set to `true`, all formatting options
752
- * (`outputFormat`, `prependPlusCountryCode`, etc.)
753
- * and `checkValidOnly` **must be omitted** or will be **ignored**.
754
- * - **Conflict handling with `checkValidOnly`:**
755
- * - If both `takeNumberOnly` and `checkValidOnly` are `true`,
756
- * `checkValidOnly` takes priority and the function
757
- * returns a `boolean`.
758
- * - If `checkValidOnly` is `false` (or not provided),
759
- * and `takeNumberOnly` is `true`,
760
- * the function returns a **numeric string of the local number**.
761
- * - **Invalid input:**
762
- * - If the input is invalid or cannot be parsed
763
- * (e.g. not matching the `defaultCountry`),
764
- * the function returns an **empty string** (`""`).
765
- * - **Output example:**
766
- * - Valid input ➔ `"81234567890"` // country code removed
767
- * - Invalid input ➔ `""`
768
- * @default false
769
- * @requires `false` or `undefined`
770
- */
771
- takeNumberOnly?:never;}>;type NeverForRestFormatPhoneNumberTransform={
772
- /** -------------------------------------------------------
773
- * * ***Not used in this mode **`(Never allowed in this mode)`**.***
774
- * -------------------------------------------------------
775
- * - ***Behavior:***
776
- * - **Exclusive mode:**
777
- * - ⚠️ When `true`, all formatting options must be omitted or are ignored.
778
- * - Conflicts with `takeNumberOnly` and `checkValidOnly`:
779
- * - If both `takeNumberOnly` and `checkValidOnly` are `true`,
780
- * `checkValidOnly` takes priority and the function
781
- * returns a `boolean`.
782
- * - If `checkValidOnly` is `false` (or not provided),
783
- * and `takeNumberOnly` is `true`,
784
- * the function returns a **numeric string of the local number**.
785
- * @requires `undefined`
786
- */
787
- separator?:never;
788
- /** -------------------------------------------------------
789
- * * ***Not used in this mode **`(Never allowed in this mode)`**.***
790
- * -------------------------------------------------------
791
- * - ***Behavior:***
792
- * - **Exclusive mode:**
793
- * - ⚠️ When `true`, all formatting options must be omitted or are ignored.
794
- * - Conflicts with `takeNumberOnly` and `checkValidOnly`:
795
- * - If both `takeNumberOnly` and `checkValidOnly` are `true`,
796
- * `checkValidOnly` takes priority and the function
797
- * returns a `boolean`.
798
- * - If `checkValidOnly` is `false` (or not provided),
799
- * and `takeNumberOnly` is `true`,
800
- * the function returns a **numeric string of the local number**.
801
- *
802
- * @requires `undefined`
803
- */
804
- openingNumberCountry?:never;
805
- /** -------------------------------------------------------
806
- * * ***Not used in this mode **`(Never allowed in this mode)`**.***
807
- * -------------------------------------------------------
808
- * - ***Behavior:***
809
- * - **Exclusive mode:**
810
- * - ⚠️ When `true`, all formatting options must be omitted or are ignored.
811
- * - Conflicts with `takeNumberOnly` and `checkValidOnly`:
812
- * - If both `takeNumberOnly` and `checkValidOnly` are `true`,
813
- * `checkValidOnly` takes priority and the function
814
- * returns a `boolean`.
815
- * - If `checkValidOnly` is `false` (or not provided),
816
- * and `takeNumberOnly` is `true`,
817
- * the function returns a **numeric string of the local number**.
818
- *
819
- * @requires `undefined`
820
- */
821
- closingNumberCountry?:never;};
737
+ type FormatPhoneNumberTransform = OverrideTypes<FormatPhoneNumberMain, {
738
+ /** -------------------------------------------------------
739
+ * * ***Return only a boolean validity flag.***
740
+ * -------------------------------------------------------
741
+ * - ***Behavior:***
742
+ * - **Exclusive mode:**
743
+ * - ⚠️ When `true`, all formatting options and `takeNumberOnly` must be omitted or are ignored.
744
+ * - Conflicts with `takeNumberOnly`:
745
+ * - ⚠️ When `checkValidOnly` is `true` and all formatting options and `takeNumberOnly` must be
746
+ * omitted or are ignored.
747
+ * - But if mistake passing props:
748
+ * - ⚠️ When `checkValidOnly` is `true` and other of formatting options was passing:
749
+ * - If `takeNumberOnly` is `true` or `false`:
750
+ * - Will return a `boolean` because `checkValidOnly` is prioritize first.
751
+ * - Output:
752
+ * - Boolean ➔ (`true` or `false`).
753
+ * - ***DefaultValue: false***
754
+ * @default false
755
+ * @requires `false` or `undefined`
756
+ */
757
+ checkValidOnly?: never;
758
+ /** -------------------------------------------------------
759
+ * * ***Return only the digits of the phone number (local number only).***
760
+ * -------------------------------------------------------
761
+ * **Returns a string containing only numeric characters** from the **local number**,
762
+ * ignoring any country code, spaces, plus signs, or separators.
763
+ * - **Default:** `false`
764
+ * - **Behavior:**
765
+ * - **Exclusive mode:**
766
+ * - ⚠️ When set to `true`, all formatting options
767
+ * (`outputFormat`, `prependPlusCountryCode`, etc.)
768
+ * and `checkValidOnly` **must be omitted** or will be **ignored**.
769
+ * - **Conflict handling with `checkValidOnly`:**
770
+ * - If both `takeNumberOnly` and `checkValidOnly` are `true`,
771
+ * `checkValidOnly` takes priority and the function
772
+ * returns a `boolean`.
773
+ * - If `checkValidOnly` is `false` (or not provided),
774
+ * and `takeNumberOnly` is `true`,
775
+ * the function returns a **numeric string of the local number**.
776
+ * - **Invalid input:**
777
+ * - If the input is invalid or cannot be parsed
778
+ * (e.g. not matching the `defaultCountry`),
779
+ * the function returns an **empty string** (`""`).
780
+ * - **Output example:**
781
+ * - Valid input ➔ `"81234567890"` // country code removed
782
+ * - Invalid input ➔ `""`
783
+ * @default false
784
+ * @requires `false` or `undefined`
785
+ */
786
+ takeNumberOnly?: never;
787
+ }>;
788
+ type NeverForRestFormatPhoneNumberTransform = {
789
+ /** -------------------------------------------------------
790
+ * * ***Not used in this mode **`(Never allowed in this mode)`**.***
791
+ * -------------------------------------------------------
792
+ * - ***Behavior:***
793
+ * - **Exclusive mode:**
794
+ * - ⚠️ When `true`, all formatting options must be omitted or are ignored.
795
+ * - Conflicts with `takeNumberOnly` and `checkValidOnly`:
796
+ * - If both `takeNumberOnly` and `checkValidOnly` are `true`,
797
+ * `checkValidOnly` takes priority and the function
798
+ * returns a `boolean`.
799
+ * - If `checkValidOnly` is `false` (or not provided),
800
+ * and `takeNumberOnly` is `true`,
801
+ * the function returns a **numeric string of the local number**.
802
+ * @requires `undefined`
803
+ */
804
+ separator?: never;
805
+ /** -------------------------------------------------------
806
+ * * ***Not used in this mode **`(Never allowed in this mode)`**.***
807
+ * -------------------------------------------------------
808
+ * - ***Behavior:***
809
+ * - **Exclusive mode:**
810
+ * - ⚠️ When `true`, all formatting options must be omitted or are ignored.
811
+ * - Conflicts with `takeNumberOnly` and `checkValidOnly`:
812
+ * - If both `takeNumberOnly` and `checkValidOnly` are `true`,
813
+ * `checkValidOnly` takes priority and the function
814
+ * returns a `boolean`.
815
+ * - If `checkValidOnly` is `false` (or not provided),
816
+ * and `takeNumberOnly` is `true`,
817
+ * the function returns a **numeric string of the local number**.
818
+ *
819
+ * @requires `undefined`
820
+ */
821
+ openingNumberCountry?: never;
822
+ /** -------------------------------------------------------
823
+ * * ***Not used in this mode **`(Never allowed in this mode)`**.***
824
+ * -------------------------------------------------------
825
+ * - ***Behavior:***
826
+ * - **Exclusive mode:**
827
+ * - ⚠️ When `true`, all formatting options must be omitted or are ignored.
828
+ * - Conflicts with `takeNumberOnly` and `checkValidOnly`:
829
+ * - If both `takeNumberOnly` and `checkValidOnly` are `true`,
830
+ * `checkValidOnly` takes priority and the function
831
+ * returns a `boolean`.
832
+ * - If `checkValidOnly` is `false` (or not provided),
833
+ * and `takeNumberOnly` is `true`,
834
+ * the function returns a **numeric string of the local number**.
835
+ *
836
+ * @requires `undefined`
837
+ */
838
+ closingNumberCountry?: never;
839
+ };
822
840
  /** -------------------------------------------------------
823
841
  * * ***Options subset for **validity-check mode** of
824
842
  * {@link formatPhoneNumber|`formatPhoneNumber`}.***
@@ -832,55 +850,56 @@ closingNumberCountry?:never;};
832
850
  * formatPhoneNumber("+6281234567890", { checkValidOnly: true }) // boolean
833
851
  * ```
834
852
  */
835
- type FormatPhoneNumberCheckValidOnly=Prettify<OverrideTypes<FormatPhoneNumberMain,{
836
- /** -------------------------------------------------------
837
- * * ***Return only a boolean validity flag.***
838
- * -------------------------------------------------------
839
- * - ***Behavior:***
840
- * - **Exclusive mode:**
841
- * - ⚠️ When `true`, all formatting options and `takeNumberOnly` must be omitted or are ignored.
842
- * - Conflicts with `takeNumberOnly`:
843
- * - ⚠️ When `checkValidOnly` is `true` and all formatting options and `takeNumberOnly` must be
844
- * omitted or are ignored.
845
- * - But if mistake passing props:
846
- * - ⚠️ When `checkValidOnly` is `true` and other of formatting options was passing:
847
- * - If `takeNumberOnly` is `true` or `false`:
848
- * - Will return a `boolean` because `checkValidOnly` is prioritize first.
849
- * - Output:
850
- * - Boolean ➔ (`true` or `false`).
851
- * - ***DefaultValue: false***
852
- * @default false
853
- */
854
- checkValidOnly:true;
855
- /** -------------------------------------------------------
856
- * * ***Return only the digits of the phone number (local number only).***
857
- * -------------------------------------------------------
858
- * **Returns a string containing only numeric characters** from the **local number**,
859
- * ignoring any country code, spaces, plus signs, or separators.
860
- * - **Default:** `false`
861
- * - **Behavior:**
862
- * - **Exclusive mode:**
863
- * - ⚠️ When set to `true`, all formatting options
864
- * (`outputFormat`, `prependPlusCountryCode`, etc.)
865
- * and `checkValidOnly` **must be omitted** or will be **ignored**.
866
- * - **Conflict handling with `checkValidOnly`:**
867
- * - If both `takeNumberOnly` and `checkValidOnly` are `true`,
868
- * `checkValidOnly` takes priority and the function
869
- * returns a `boolean`.
870
- * - If `checkValidOnly` is `false` (or not provided),
871
- * and `takeNumberOnly` is `true`,
872
- * the function returns a **numeric string of the local number**.
873
- * - **Invalid input:**
874
- * - If the input is invalid or cannot be parsed
875
- * (e.g. not matching the `defaultCountry`),
876
- * the function returns an **empty string** (`""`).
877
- * - **Output example:**
878
- * - Valid input ➔ `"81234567890"` // country code removed
879
- * - Invalid input ➔ `""`
880
- * @default false
881
- * @requires `false` or `undefined`
882
- */
883
- takeNumberOnly?:false;}& NeverForRestFormatPhoneNumberTransform>>;
853
+ type FormatPhoneNumberCheckValidOnly = Prettify<OverrideTypes<FormatPhoneNumberMain, {
854
+ /** -------------------------------------------------------
855
+ * * ***Return only a boolean validity flag.***
856
+ * -------------------------------------------------------
857
+ * - ***Behavior:***
858
+ * - **Exclusive mode:**
859
+ * - ⚠️ When `true`, all formatting options and `takeNumberOnly` must be omitted or are ignored.
860
+ * - Conflicts with `takeNumberOnly`:
861
+ * - ⚠️ When `checkValidOnly` is `true` and all formatting options and `takeNumberOnly` must be
862
+ * omitted or are ignored.
863
+ * - But if mistake passing props:
864
+ * - ⚠️ When `checkValidOnly` is `true` and other of formatting options was passing:
865
+ * - If `takeNumberOnly` is `true` or `false`:
866
+ * - Will return a `boolean` because `checkValidOnly` is prioritize first.
867
+ * - Output:
868
+ * - Boolean ➔ (`true` or `false`).
869
+ * - ***DefaultValue: false***
870
+ * @default false
871
+ */
872
+ checkValidOnly: true;
873
+ /** -------------------------------------------------------
874
+ * * ***Return only the digits of the phone number (local number only).***
875
+ * -------------------------------------------------------
876
+ * **Returns a string containing only numeric characters** from the **local number**,
877
+ * ignoring any country code, spaces, plus signs, or separators.
878
+ * - **Default:** `false`
879
+ * - **Behavior:**
880
+ * - **Exclusive mode:**
881
+ * - ⚠️ When set to `true`, all formatting options
882
+ * (`outputFormat`, `prependPlusCountryCode`, etc.)
883
+ * and `checkValidOnly` **must be omitted** or will be **ignored**.
884
+ * - **Conflict handling with `checkValidOnly`:**
885
+ * - If both `takeNumberOnly` and `checkValidOnly` are `true`,
886
+ * `checkValidOnly` takes priority and the function
887
+ * returns a `boolean`.
888
+ * - If `checkValidOnly` is `false` (or not provided),
889
+ * and `takeNumberOnly` is `true`,
890
+ * the function returns a **numeric string of the local number**.
891
+ * - **Invalid input:**
892
+ * - If the input is invalid or cannot be parsed
893
+ * (e.g. not matching the `defaultCountry`),
894
+ * the function returns an **empty string** (`""`).
895
+ * - **Output example:**
896
+ * - Valid input ➔ `"81234567890"` // country code removed
897
+ * - Invalid input ➔ `""`
898
+ * @default false
899
+ * @requires `false` or `undefined`
900
+ */
901
+ takeNumberOnly?: false;
902
+ } & NeverForRestFormatPhoneNumberTransform>>;
884
903
  /** -------------------------------------------------------
885
904
  * * ***Options subset for calling {@link formatPhoneNumber|`formatPhoneNumber`} in
886
905
  * **digits-only mode**.***
@@ -893,214 +912,219 @@ takeNumberOnly?:false;}& NeverForRestFormatPhoneNumberTransform>>;
893
912
  *
894
913
  * **Example Output:** `"6281234567890"`
895
914
  */
896
- type FormatPhoneNumberTakeNumberOnly=Prettify<OverrideTypes<FormatPhoneNumberMain,{
897
- /** -------------------------------------------------------
898
- * * ***Return only a boolean validity flag.***
899
- * -------------------------------------------------------
900
- * - ***Behavior:***
901
- * - **Exclusive mode:**
902
- * - ⚠️ When `true`, all formatting options and `takeNumberOnly` must be omitted or are ignored.
903
- * - Conflicts with `takeNumberOnly`:
904
- * - ⚠️ When `checkValidOnly` is `true` and all formatting options and `takeNumberOnly` must be
905
- * omitted or are ignored.
906
- * - But if mistake passing props:
907
- * - ⚠️ When `checkValidOnly` is `true` and other of formatting options was passing:
908
- * - If `takeNumberOnly` is `true` or `false`:
909
- * - Will return a `boolean` because `checkValidOnly` is prioritize first.
910
- * - Output:
911
- * - Boolean ➔ (`true` or `false`).
912
- * - ***DefaultValue: false***
913
- * @default false
914
- * @requires `false` or `undefined`
915
- */
916
- checkValidOnly?:false;
917
- /** -------------------------------------------------------
918
- * * ***Return only the digits of the phone number (local number only).***
919
- * -------------------------------------------------------
920
- * **Returns a string containing only numeric characters** from the **local number**,
921
- * ignoring any country code, spaces, plus signs, or separators.
922
- * - **Default:** `false`
923
- * - **Behavior:**
924
- * - **Exclusive mode:**
925
- * - ⚠️ When set to `true`, all formatting options
926
- * (`outputFormat`, `prependPlusCountryCode`, etc.)
927
- * and `checkValidOnly` **must be omitted** or will be **ignored**.
928
- * - **Conflict handling with `checkValidOnly`:**
929
- * - If both `takeNumberOnly` and `checkValidOnly` are `true`,
930
- * `checkValidOnly` takes priority and the function
931
- * returns a `boolean`.
932
- * - If `checkValidOnly` is `false` (or not provided),
933
- * and `takeNumberOnly` is `true`,
934
- * the function returns a **numeric string of the local number**.
935
- * - **Invalid input:**
936
- * - If the input is invalid or cannot be parsed
937
- * (e.g. not matching the `defaultCountry`),
938
- * the function returns an **empty string** (`""`).
939
- * - **Output example:**
940
- * - Valid input ➔ `"81234567890"` // country code removed
941
- * - Invalid input ➔ `""`
942
- * @default false
943
- */
944
- takeNumberOnly:true;}& NeverForRestFormatPhoneNumberTransform>>;
915
+ type FormatPhoneNumberTakeNumberOnly = Prettify<OverrideTypes<FormatPhoneNumberMain, {
916
+ /** -------------------------------------------------------
917
+ * * ***Return only a boolean validity flag.***
918
+ * -------------------------------------------------------
919
+ * - ***Behavior:***
920
+ * - **Exclusive mode:**
921
+ * - ⚠️ When `true`, all formatting options and `takeNumberOnly` must be omitted or are ignored.
922
+ * - Conflicts with `takeNumberOnly`:
923
+ * - ⚠️ When `checkValidOnly` is `true` and all formatting options and `takeNumberOnly` must be
924
+ * omitted or are ignored.
925
+ * - But if mistake passing props:
926
+ * - ⚠️ When `checkValidOnly` is `true` and other of formatting options was passing:
927
+ * - If `takeNumberOnly` is `true` or `false`:
928
+ * - Will return a `boolean` because `checkValidOnly` is prioritize first.
929
+ * - Output:
930
+ * - Boolean ➔ (`true` or `false`).
931
+ * - ***DefaultValue: false***
932
+ * @default false
933
+ * @requires `false` or `undefined`
934
+ */
935
+ checkValidOnly?: false;
936
+ /** -------------------------------------------------------
937
+ * * ***Return only the digits of the phone number (local number only).***
938
+ * -------------------------------------------------------
939
+ * **Returns a string containing only numeric characters** from the **local number**,
940
+ * ignoring any country code, spaces, plus signs, or separators.
941
+ * - **Default:** `false`
942
+ * - **Behavior:**
943
+ * - **Exclusive mode:**
944
+ * - ⚠️ When set to `true`, all formatting options
945
+ * (`outputFormat`, `prependPlusCountryCode`, etc.)
946
+ * and `checkValidOnly` **must be omitted** or will be **ignored**.
947
+ * - **Conflict handling with `checkValidOnly`:**
948
+ * - If both `takeNumberOnly` and `checkValidOnly` are `true`,
949
+ * `checkValidOnly` takes priority and the function
950
+ * returns a `boolean`.
951
+ * - If `checkValidOnly` is `false` (or not provided),
952
+ * and `takeNumberOnly` is `true`,
953
+ * the function returns a **numeric string of the local number**.
954
+ * - **Invalid input:**
955
+ * - If the input is invalid or cannot be parsed
956
+ * (e.g. not matching the `defaultCountry`),
957
+ * the function returns an **empty string** (`""`).
958
+ * - **Output example:**
959
+ * - Valid input ➔ `"81234567890"` // country code removed
960
+ * - Invalid input ➔ `""`
961
+ * @default false
962
+ */
963
+ takeNumberOnly: true;
964
+ } & NeverForRestFormatPhoneNumberTransform>>;
945
965
  /** -------------------------------------------------------
946
966
  * * ***Options subset for calling {@link formatPhoneNumber|`formatPhoneNumber`} force to **Validity-check Mode**.***
947
967
  * -------------------------------------------------------
948
968
  */
949
- type FormatPhoneNumberAllPassing=OverrideTypes<FormatPhoneNumberMain,{
950
- /** -------------------------------------------------------
951
- * * ***Return only a boolean validity flag.***
952
- * -------------------------------------------------------
953
- * - ***Behavior:***
954
- * - **Exclusive mode:**
955
- * - ⚠️ When `true`, all formatting options and `takeNumberOnly` must be omitted or are ignored.
956
- * - Conflicts with `takeNumberOnly`:
957
- * - ⚠️ When `checkValidOnly` is `true` and all formatting options and `takeNumberOnly` must be
958
- * omitted or are ignored.
959
- * - But if mistake passing props:
960
- * - ⚠️ When `checkValidOnly` is `true` and other of formatting options was passing:
961
- * - If `takeNumberOnly` is `true` or `false`:
962
- * - Will return a `boolean` because `checkValidOnly` is prioritize first.
963
- * - Output:
964
- * - Boolean ➔ (`true` or `false`).
965
- * - ***DefaultValue: false***
966
- * @default false
967
- */
968
- checkValidOnly:true;
969
- /** -------------------------------------------------------
970
- * * ***Return only the digits of the phone number (local number only).***
971
- * -------------------------------------------------------
972
- * **Returns a string containing only numeric characters** from the **local number**,
973
- * ignoring any country code, spaces, plus signs, or separators.
974
- * - **Default:** `false`
975
- * - **Behavior:**
976
- * - **Exclusive mode:**
977
- * - ⚠️ When set to `true`, all formatting options
978
- * (`outputFormat`, `prependPlusCountryCode`, etc.)
979
- * and `checkValidOnly` **must be omitted** or will be **ignored**.
980
- * - **Conflict handling with `checkValidOnly`:**
981
- * - If both `takeNumberOnly` and `checkValidOnly` are `true`,
982
- * `checkValidOnly` takes priority and the function
983
- * returns a `boolean`.
984
- * - If `checkValidOnly` is `false` (or not provided),
985
- * and `takeNumberOnly` is `true`,
986
- * the function returns a **numeric string of the local number**.
987
- * - **Invalid input:**
988
- * - If the input is invalid or cannot be parsed
989
- * (e.g. not matching the `defaultCountry`),
990
- * the function returns an **empty string** (`""`).
991
- * - **Output example:**
992
- * - Valid input ➔ `"81234567890"` // country code removed
993
- * - Invalid input ➔ `""`
994
- * @default false
995
- * @requires `false` or `undefined`
996
- */
997
- takeNumberOnly:true;}>;
969
+ type FormatPhoneNumberAllPassing = OverrideTypes<FormatPhoneNumberMain, {
970
+ /** -------------------------------------------------------
971
+ * * ***Return only a boolean validity flag.***
972
+ * -------------------------------------------------------
973
+ * - ***Behavior:***
974
+ * - **Exclusive mode:**
975
+ * - ⚠️ When `true`, all formatting options and `takeNumberOnly` must be omitted or are ignored.
976
+ * - Conflicts with `takeNumberOnly`:
977
+ * - ⚠️ When `checkValidOnly` is `true` and all formatting options and `takeNumberOnly` must be
978
+ * omitted or are ignored.
979
+ * - But if mistake passing props:
980
+ * - ⚠️ When `checkValidOnly` is `true` and other of formatting options was passing:
981
+ * - If `takeNumberOnly` is `true` or `false`:
982
+ * - Will return a `boolean` because `checkValidOnly` is prioritize first.
983
+ * - Output:
984
+ * - Boolean ➔ (`true` or `false`).
985
+ * - ***DefaultValue: false***
986
+ * @default false
987
+ */
988
+ checkValidOnly: true;
989
+ /** -------------------------------------------------------
990
+ * * ***Return only the digits of the phone number (local number only).***
991
+ * -------------------------------------------------------
992
+ * **Returns a string containing only numeric characters** from the **local number**,
993
+ * ignoring any country code, spaces, plus signs, or separators.
994
+ * - **Default:** `false`
995
+ * - **Behavior:**
996
+ * - **Exclusive mode:**
997
+ * - ⚠️ When set to `true`, all formatting options
998
+ * (`outputFormat`, `prependPlusCountryCode`, etc.)
999
+ * and `checkValidOnly` **must be omitted** or will be **ignored**.
1000
+ * - **Conflict handling with `checkValidOnly`:**
1001
+ * - If both `takeNumberOnly` and `checkValidOnly` are `true`,
1002
+ * `checkValidOnly` takes priority and the function
1003
+ * returns a `boolean`.
1004
+ * - If `checkValidOnly` is `false` (or not provided),
1005
+ * and `takeNumberOnly` is `true`,
1006
+ * the function returns a **numeric string of the local number**.
1007
+ * - **Invalid input:**
1008
+ * - If the input is invalid or cannot be parsed
1009
+ * (e.g. not matching the `defaultCountry`),
1010
+ * the function returns an **empty string** (`""`).
1011
+ * - **Output example:**
1012
+ * - Valid input ➔ `"81234567890"` // country code removed
1013
+ * - Invalid input ➔ `""`
1014
+ * @default false
1015
+ * @requires `false` or `undefined`
1016
+ */
1017
+ takeNumberOnly: true;
1018
+ }>;
998
1019
  /** -------------------------------------------------------
999
1020
  * * ***Options subset for calling {@link formatPhoneNumber|`formatPhoneNumber`} force to **Validity-check Mode**.***
1000
1021
  * -------------------------------------------------------
1001
1022
  */
1002
- type FormatPhoneNumberAllPassingValidOnly=OverrideTypes<FormatPhoneNumberMain,{
1003
- /** -------------------------------------------------------
1004
- * * ***Return only a boolean validity flag.***
1005
- * -------------------------------------------------------
1006
- * - ***Behavior:***
1007
- * - **Exclusive mode:**
1008
- * - ⚠️ When `true`, all formatting options and `takeNumberOnly` must be omitted or are ignored.
1009
- * - Conflicts with `takeNumberOnly`:
1010
- * - ⚠️ When `checkValidOnly` is `true` and all formatting options and `takeNumberOnly` must be
1011
- * omitted or are ignored.
1012
- * - But if mistake passing props:
1013
- * - ⚠️ When `checkValidOnly` is `true` and other of formatting options was passing:
1014
- * - If `takeNumberOnly` is `true` or `false`:
1015
- * - Will return a `boolean` because `checkValidOnly` is prioritize first.
1016
- * - Output:
1017
- * - Boolean ➔ (`true` or `false`).
1018
- * - ***DefaultValue: false***
1019
- * @default false
1020
- */
1021
- checkValidOnly:true;
1022
- /** -------------------------------------------------------
1023
- * * ***Return only the digits of the phone number (local number only).***
1024
- * -------------------------------------------------------
1025
- * **Returns a string containing only numeric characters** from the **local number**,
1026
- * ignoring any country code, spaces, plus signs, or separators.
1027
- * - **Default:** `false`
1028
- * - **Behavior:**
1029
- * - **Exclusive mode:**
1030
- * - ⚠️ When set to `true`, all formatting options
1031
- * (`outputFormat`, `prependPlusCountryCode`, etc.)
1032
- * and `checkValidOnly` **must be omitted** or will be **ignored**.
1033
- * - **Conflict handling with `checkValidOnly`:**
1034
- * - If both `takeNumberOnly` and `checkValidOnly` are `true`,
1035
- * `checkValidOnly` takes priority and the function
1036
- * returns a `boolean`.
1037
- * - If `checkValidOnly` is `false` (or not provided),
1038
- * and `takeNumberOnly` is `true`,
1039
- * the function returns a **numeric string of the local number**.
1040
- * - **Invalid input:**
1041
- * - If the input is invalid or cannot be parsed
1042
- * (e.g. not matching the `defaultCountry`),
1043
- * the function returns an **empty string** (`""`).
1044
- * - **Output example:**
1045
- * - Valid input ➔ `"81234567890"` // country code removed
1046
- * - Invalid input ➔ `""`
1047
- * @default false
1048
- * @requires `false` or `undefined`
1049
- */
1050
- takeNumberOnly?:false;}>;
1023
+ type FormatPhoneNumberAllPassingValidOnly = OverrideTypes<FormatPhoneNumberMain, {
1024
+ /** -------------------------------------------------------
1025
+ * * ***Return only a boolean validity flag.***
1026
+ * -------------------------------------------------------
1027
+ * - ***Behavior:***
1028
+ * - **Exclusive mode:**
1029
+ * - ⚠️ When `true`, all formatting options and `takeNumberOnly` must be omitted or are ignored.
1030
+ * - Conflicts with `takeNumberOnly`:
1031
+ * - ⚠️ When `checkValidOnly` is `true` and all formatting options and `takeNumberOnly` must be
1032
+ * omitted or are ignored.
1033
+ * - But if mistake passing props:
1034
+ * - ⚠️ When `checkValidOnly` is `true` and other of formatting options was passing:
1035
+ * - If `takeNumberOnly` is `true` or `false`:
1036
+ * - Will return a `boolean` because `checkValidOnly` is prioritize first.
1037
+ * - Output:
1038
+ * - Boolean ➔ (`true` or `false`).
1039
+ * - ***DefaultValue: false***
1040
+ * @default false
1041
+ */
1042
+ checkValidOnly: true;
1043
+ /** -------------------------------------------------------
1044
+ * * ***Return only the digits of the phone number (local number only).***
1045
+ * -------------------------------------------------------
1046
+ * **Returns a string containing only numeric characters** from the **local number**,
1047
+ * ignoring any country code, spaces, plus signs, or separators.
1048
+ * - **Default:** `false`
1049
+ * - **Behavior:**
1050
+ * - **Exclusive mode:**
1051
+ * - ⚠️ When set to `true`, all formatting options
1052
+ * (`outputFormat`, `prependPlusCountryCode`, etc.)
1053
+ * and `checkValidOnly` **must be omitted** or will be **ignored**.
1054
+ * - **Conflict handling with `checkValidOnly`:**
1055
+ * - If both `takeNumberOnly` and `checkValidOnly` are `true`,
1056
+ * `checkValidOnly` takes priority and the function
1057
+ * returns a `boolean`.
1058
+ * - If `checkValidOnly` is `false` (or not provided),
1059
+ * and `takeNumberOnly` is `true`,
1060
+ * the function returns a **numeric string of the local number**.
1061
+ * - **Invalid input:**
1062
+ * - If the input is invalid or cannot be parsed
1063
+ * (e.g. not matching the `defaultCountry`),
1064
+ * the function returns an **empty string** (`""`).
1065
+ * - **Output example:**
1066
+ * - Valid input ➔ `"81234567890"` // country code removed
1067
+ * - Invalid input ➔ `""`
1068
+ * @default false
1069
+ * @requires `false` or `undefined`
1070
+ */
1071
+ takeNumberOnly?: false;
1072
+ }>;
1051
1073
  /** -------------------------------------------------------
1052
1074
  * * ***Options subset for calling {@link formatPhoneNumber|`formatPhoneNumber`} force to **Digits-only Mode**.***
1053
1075
  * -------------------------------------------------------
1054
1076
  */
1055
- type FormatPhoneNumberAllPassingTakeOnly=OverrideTypes<FormatPhoneNumberMain,{
1056
- /** -------------------------------------------------------
1057
- * * ***Return only a boolean validity flag.***
1058
- * -------------------------------------------------------
1059
- * - ***Behavior:***
1060
- * - **Exclusive mode:**
1061
- * - ⚠️ When `true`, all formatting options and `takeNumberOnly` must be omitted or are ignored.
1062
- * - Conflicts with `takeNumberOnly`:
1063
- * - ⚠️ When `checkValidOnly` is `true` and all formatting options and `takeNumberOnly` must be
1064
- * omitted or are ignored.
1065
- * - But if mistake passing props:
1066
- * - ⚠️ When `checkValidOnly` is `true` and other of formatting options was passing:
1067
- * - If `takeNumberOnly` is `true` or `false`:
1068
- * - Will return a `boolean` because `checkValidOnly` is prioritize first.
1069
- * - Output:
1070
- * - Boolean ➔ (`true` or `false`).
1071
- * - ***DefaultValue: false***
1072
- * @default false
1073
- * @requires `false` or `undefined`
1074
- */
1075
- checkValidOnly?:false;
1076
- /** -------------------------------------------------------
1077
- * * ***Return only the digits of the phone number (local number only).***
1078
- * -------------------------------------------------------
1079
- * **Returns a string containing only numeric characters** from the **local number**,
1080
- * ignoring any country code, spaces, plus signs, or separators.
1081
- * - **Default:** `false`
1082
- * - **Behavior:**
1083
- * - **Exclusive mode:**
1084
- * - ⚠️ When set to `true`, all formatting options
1085
- * (`outputFormat`, `prependPlusCountryCode`, etc.)
1086
- * and `checkValidOnly` **must be omitted** or will be **ignored**.
1087
- * - **Conflict handling with `checkValidOnly`:**
1088
- * - If both `takeNumberOnly` and `checkValidOnly` are `true`,
1089
- * `checkValidOnly` takes priority and the function
1090
- * returns a `boolean`.
1091
- * - If `checkValidOnly` is `false` (or not provided),
1092
- * and `takeNumberOnly` is `true`,
1093
- * the function returns a **numeric string of the local number**.
1094
- * - **Invalid input:**
1095
- * - If the input is invalid or cannot be parsed
1096
- * (e.g. not matching the `defaultCountry`),
1097
- * the function returns an **empty string** (`""`).
1098
- * - **Output example:**
1099
- * - Valid input ➔ `"81234567890"` // country code removed
1100
- * - Invalid input ➔ `""`
1101
- * @default false
1102
- */
1103
- takeNumberOnly:true;}>;
1077
+ type FormatPhoneNumberAllPassingTakeOnly = OverrideTypes<FormatPhoneNumberMain, {
1078
+ /** -------------------------------------------------------
1079
+ * * ***Return only a boolean validity flag.***
1080
+ * -------------------------------------------------------
1081
+ * - ***Behavior:***
1082
+ * - **Exclusive mode:**
1083
+ * - ⚠️ When `true`, all formatting options and `takeNumberOnly` must be omitted or are ignored.
1084
+ * - Conflicts with `takeNumberOnly`:
1085
+ * - ⚠️ When `checkValidOnly` is `true` and all formatting options and `takeNumberOnly` must be
1086
+ * omitted or are ignored.
1087
+ * - But if mistake passing props:
1088
+ * - ⚠️ When `checkValidOnly` is `true` and other of formatting options was passing:
1089
+ * - If `takeNumberOnly` is `true` or `false`:
1090
+ * - Will return a `boolean` because `checkValidOnly` is prioritize first.
1091
+ * - Output:
1092
+ * - Boolean ➔ (`true` or `false`).
1093
+ * - ***DefaultValue: false***
1094
+ * @default false
1095
+ * @requires `false` or `undefined`
1096
+ */
1097
+ checkValidOnly?: false;
1098
+ /** -------------------------------------------------------
1099
+ * * ***Return only the digits of the phone number (local number only).***
1100
+ * -------------------------------------------------------
1101
+ * **Returns a string containing only numeric characters** from the **local number**,
1102
+ * ignoring any country code, spaces, plus signs, or separators.
1103
+ * - **Default:** `false`
1104
+ * - **Behavior:**
1105
+ * - **Exclusive mode:**
1106
+ * - ⚠️ When set to `true`, all formatting options
1107
+ * (`outputFormat`, `prependPlusCountryCode`, etc.)
1108
+ * and `checkValidOnly` **must be omitted** or will be **ignored**.
1109
+ * - **Conflict handling with `checkValidOnly`:**
1110
+ * - If both `takeNumberOnly` and `checkValidOnly` are `true`,
1111
+ * `checkValidOnly` takes priority and the function
1112
+ * returns a `boolean`.
1113
+ * - If `checkValidOnly` is `false` (or not provided),
1114
+ * and `takeNumberOnly` is `true`,
1115
+ * the function returns a **numeric string of the local number**.
1116
+ * - **Invalid input:**
1117
+ * - If the input is invalid or cannot be parsed
1118
+ * (e.g. not matching the `defaultCountry`),
1119
+ * the function returns an **empty string** (`""`).
1120
+ * - **Output example:**
1121
+ * - Valid input ➔ `"81234567890"` // country code removed
1122
+ * - Invalid input ➔ `""`
1123
+ * @default false
1124
+ */
1125
+ takeNumberOnly: true;
1126
+ }>;
1127
+
1104
1128
  /** -------------------------------------------------------
1105
1129
  * * ***Utility: `formatPhoneNumber`.***
1106
1130
  * -------------------------------------------------------
@@ -1224,7 +1248,7 @@ takeNumberOnly:true;}>;
1224
1248
  * // ➔ false
1225
1249
  * ```
1226
1250
  */
1227
- declare function formatPhoneNumber(value:ValueFormatPhoneNumber,options?:FormatPhoneNumberTransform):string;
1251
+ declare function formatPhoneNumber(value: ValueFormatPhoneNumber, options?: FormatPhoneNumberTransform): string;
1228
1252
  /** -------------------------------------------------------
1229
1253
  * * ***Utility: `formatPhoneNumber`.***
1230
1254
  * -------------------------------------------------------
@@ -1280,7 +1304,7 @@ declare function formatPhoneNumber(value:ValueFormatPhoneNumber,options?:FormatP
1280
1304
  * // ➔ ""
1281
1305
  * ```
1282
1306
  */
1283
- declare function formatPhoneNumber(value:ValueFormatPhoneNumber,options?:FormatPhoneNumberTakeNumberOnly):string;
1307
+ declare function formatPhoneNumber(value: ValueFormatPhoneNumber, options?: FormatPhoneNumberTakeNumberOnly): string;
1284
1308
  /** -------------------------------------------------------
1285
1309
  * * ***Utility: `formatPhoneNumber`.***
1286
1310
  * -------------------------------------------------------
@@ -1340,7 +1364,7 @@ declare function formatPhoneNumber(value:ValueFormatPhoneNumber,options?:FormatP
1340
1364
  * // ➔ false
1341
1365
  * ```
1342
1366
  */
1343
- declare function formatPhoneNumber(value:ValueFormatPhoneNumber,options?:FormatPhoneNumberCheckValidOnly):boolean;
1367
+ declare function formatPhoneNumber(value: ValueFormatPhoneNumber, options?: FormatPhoneNumberCheckValidOnly): boolean;
1344
1368
  /** -------------------------------------------------------
1345
1369
  * * ***Utility: `formatPhoneNumber`.***
1346
1370
  * -------------------------------------------------------
@@ -1456,7 +1480,7 @@ declare function formatPhoneNumber(value:ValueFormatPhoneNumber,options?:FormatP
1456
1480
  * // ➔ false
1457
1481
  * ```
1458
1482
  */
1459
- declare function formatPhoneNumber(value:ValueFormatPhoneNumber,options?:FormatPhoneNumberAllPassingValidOnly):boolean;
1483
+ declare function formatPhoneNumber(value: ValueFormatPhoneNumber, options?: FormatPhoneNumberAllPassingValidOnly): boolean;
1460
1484
  /** -------------------------------------------------------
1461
1485
  * * ***Utility: `formatPhoneNumber`.***
1462
1486
  * -------------------------------------------------------
@@ -1534,7 +1558,7 @@ declare function formatPhoneNumber(value:ValueFormatPhoneNumber,options?:FormatP
1534
1558
  * // ➔ ""
1535
1559
  * ```
1536
1560
  */
1537
- declare function formatPhoneNumber(value:ValueFormatPhoneNumber,options?:FormatPhoneNumberAllPassingTakeOnly):string;
1561
+ declare function formatPhoneNumber(value: ValueFormatPhoneNumber, options?: FormatPhoneNumberAllPassingTakeOnly): string;
1538
1562
  /** -------------------------------------------------------
1539
1563
  * * ***Utility: `formatPhoneNumber`.***
1540
1564
  * -------------------------------------------------------
@@ -1675,15 +1699,18 @@ declare function formatPhoneNumber(value:ValueFormatPhoneNumber,options?:FormatP
1675
1699
  * // ➔ false
1676
1700
  * ```
1677
1701
  */
1678
- declare function formatPhoneNumber(value:ValueFormatPhoneNumber,options?:FormatPhoneNumberAllPassing):boolean;type CensorEmailOptions={
1679
- /** ----------------------------------------------------------
1680
- * * ***Censorship Mode.***
1681
- * ----------------------------------------------------------
1682
- * - **Valid value:**
1683
- * - `"fixed"` (default) – Deterministic censorship based on a hash of the email, same input always produces the same output.
1684
- * - `"random"` – Each character is randomly replaced every time the function is called.
1685
- */
1686
- mode?:"random"|"fixed";};
1702
+ declare function formatPhoneNumber(value: ValueFormatPhoneNumber, options?: FormatPhoneNumberAllPassing): boolean;
1703
+
1704
+ type CensorEmailOptions = {
1705
+ /** ----------------------------------------------------------
1706
+ * * ***Censorship Mode.***
1707
+ * ----------------------------------------------------------
1708
+ * - **Valid value:**
1709
+ * - `"fixed"` (default) – Deterministic censorship based on a hash of the email, same input always produces the same output.
1710
+ * - `"random"` – Each character is randomly replaced every time the function is called.
1711
+ */
1712
+ mode?: "random" | "fixed";
1713
+ };
1687
1714
  /** ----------------------------------------------------------
1688
1715
  * * ***Utility: `censorEmail`.***
1689
1716
  * ----------------------------------------------------------
@@ -1715,25 +1742,28 @@ mode?:"random"|"fixed";};
1715
1742
  * censorEmail("invalid-email");
1716
1743
  * // ➔ ""
1717
1744
  */
1718
- declare const censorEmail:(email:string|null|undefined,options?:CensorEmailOptions)=>string;type ChunkStringOptions={
1719
- /** ***The separator string to insert between characters or words.***
1720
- *
1721
- * - Used when inserting separators every `limiter` characters.
1722
- * - Default is a single space `" "`.
1723
- *
1724
- * @default " "
1725
- */
1726
- separator?:string;
1727
- /** ***Determines whether counting for `limiter` resets after each space.***
1728
- *
1729
- * - If `true`, the string is treated as words separated by spaces,
1730
- * and separators are applied within words, then words are grouped.
1731
- * - If `false` ***(default)***, counting is continuous across the whole string,
1732
- * treating spaces as normal characters.
1733
- *
1734
- * @default false
1735
- */
1736
- reCountAfterSpace?:boolean;};
1745
+ declare const censorEmail: (email: string | null | undefined, options?: CensorEmailOptions) => string;
1746
+
1747
+ type ChunkStringOptions = {
1748
+ /** ***The separator string to insert between characters or words.***
1749
+ *
1750
+ * - Used when inserting separators every `limiter` characters.
1751
+ * - Default is a single space `" "`.
1752
+ *
1753
+ * @default " "
1754
+ */
1755
+ separator?: string;
1756
+ /** ***Determines whether counting for `limiter` resets after each space.***
1757
+ *
1758
+ * - If `true`, the string is treated as words separated by spaces,
1759
+ * and separators are applied within words, then words are grouped.
1760
+ * - If `false` ***(default)***, counting is continuous across the whole string,
1761
+ * treating spaces as normal characters.
1762
+ *
1763
+ * @default false
1764
+ */
1765
+ reCountAfterSpace?: boolean;
1766
+ };
1737
1767
  /** ----------------------------------------------
1738
1768
  * * ***Utility: `chunkString`.***
1739
1769
  * ----------------------------------------------
@@ -1785,24 +1815,27 @@ reCountAfterSpace?:boolean;};
1785
1815
  * // The word "JKL" forms its own group (as it's the last word and completes no other group).
1786
1816
  * // The groups "ABC-DEF-GHI" and "JKL" are then joined by a space.
1787
1817
  */
1788
- declare function chunkString(subject:string,limiter:number,options?:ChunkStringOptions):string;type TruncateStringOptions={
1789
- /** ***Maximum length of the truncated string **(default: `10`)**.***
1790
- *
1791
- * @default 10
1792
- */
1793
- length?:number;
1794
- /** ***String to append if truncation occurs.***
1795
- *
1796
- * - Will be trimmed first; defaults to `"..."` if empty.
1797
- *
1798
- * @default "..."
1799
- */
1800
- ending?:string;
1801
- /** ***Whether to trim the input string before truncation ***(default: `true`)***.***
1802
- *
1803
- * @default true
1804
- */
1805
- trim?:boolean;};
1818
+ declare function chunkString(subject: string, limiter: number, options?: ChunkStringOptions): string;
1819
+
1820
+ type TruncateStringOptions = {
1821
+ /** ***Maximum length of the truncated string **(default: `10`)**.***
1822
+ *
1823
+ * @default 10
1824
+ */
1825
+ length?: number;
1826
+ /** ***String to append if truncation occurs.***
1827
+ *
1828
+ * - Will be trimmed first; defaults to `"..."` if empty.
1829
+ *
1830
+ * @default "..."
1831
+ */
1832
+ ending?: string;
1833
+ /** ***Whether to trim the input string before truncation ***(default: `true`)***.***
1834
+ *
1835
+ * @default true
1836
+ */
1837
+ trim?: boolean;
1838
+ };
1806
1839
  /** ----------------------------------------------------------
1807
1840
  * * ***Utility: `truncateString`.***
1808
1841
  * ----------------------------------------------------------
@@ -1837,7 +1870,8 @@ trim?:boolean;};
1837
1870
  * truncateString(null, { length: 5 });
1838
1871
  * // ➔ ""
1839
1872
  */
1840
- declare const truncateString:(text:string|null|undefined,options?:TruncateStringOptions)=>string;
1873
+ declare const truncateString: (text: string | null | undefined, options?: TruncateStringOptions) => string;
1874
+
1841
1875
  /** ----------------------------------------------------------------------
1842
1876
  * * ***Options for formatting dates with `date-fns/format`.***
1843
1877
  * ----------------------------------------------------------------------
@@ -1847,71 +1881,73 @@ declare const truncateString:(text:string|null|undefined,options?:TruncateString
1847
1881
  *
1848
1882
  * @private ***types for {@link formatDateFns}.***
1849
1883
  */
1850
- type FormatDateFnsOptions=Prettify<OmitStrict<FormatOptions,"locale",true,false>&{
1851
- /** ------------------------------------------------------------
1852
- * * ***Output format string passed to `date-fns/format`.***
1853
- * ------------------------------------------------------------
1854
- * - **Behavior:**
1855
- * - Determines how the date will be rendered.
1856
- * - Uses the full power of `date-fns` tokens.
1857
- * - ***Default Value***: `"dd MMM yyyy - HH:mm:ss"`.
1858
- * @example
1859
- * "dd MMMM yyyy, HH:mm:ss" // ➔ "03 September 2025, 10:25:42"
1860
- * @default "dd MMM yyyy - HH:mm:ss"
1861
- */
1862
- format?:string;
1863
- /** ------------------------------------------------------------
1864
- * * ***Locale used for formatting.***
1865
- * ------------------------------------------------------------
1866
- * - **Behavior:**
1867
- * - If `string`: only accepts `"id"` (Indonesian) or `"en"` (English) - **(default)**.
1868
- * - If `Locale`: accepts a locale object from `date-fns/locale`.
1869
- * - ***Default Value***: `"en"`.
1870
- * ```ts
1871
- * import { ar } from "date-fns/locale";
1872
- *
1873
- * formatDateFns(new Date(), {
1874
- * locale: ar,
1875
- * format: "dd MMMM yyyy"
1876
- * });
1877
- * // ➔ "03 سبتمبر 2025"
1878
- * ```
1879
- * @default "en"
1880
- */
1881
- locale?:"id"|"en"|AnyString|Locale;
1882
- /** ------------------------------------------------------------
1883
- * * ***Input locale used when parsing non-standard string dates.***
1884
- * ------------------------------------------------------------
1885
- * - **Behavior:**
1886
- * - Required if `date` is a **localized string**
1887
- * (e.g. `"03 Mei 2025 10:25:42"` in Indonesian).
1888
- * - Same accepted types as `locale` parameter.
1889
- * - ***Default Value***: `"en"`.
1890
- * ```ts
1891
- * import { ar } from "date-fns/locale";
1892
- *
1893
- * formatDateFns("03 مايو 2025 10:25:42", {
1894
- * inputFormat: "dd MMMM yyyy HH:mm:ss",
1895
- * inputLocale: ar,
1896
- * format: "PPpp"
1897
- * });
1898
- * // ➔ "May 3, 2025 at 10:25:42 AM"
1899
- * ```
1900
- * @default "en"
1901
- */
1902
- inputLocale?:"id"|"en"|AnyString|Locale;
1903
- /** ------------------------------------------------------------
1904
- * * ***Input format string for parsing non-ISO string dates.***
1905
- * ------------------------------------------------------------
1906
- * - **Behavior:**
1907
- * - Required if `date` is **not ISO-8601** and not a native `Date`.
1908
- * - Works together with `inputLocale` parameter.
1909
- * - ***Default Value***: `undefined`.
1910
- * @default undefined
1911
- * @example
1912
- * "dd MMMM yyyy HH:mm:ss" // ➔ "03 May 2025 10:25:42"
1913
- */
1914
- inputFormat?:string;}>;
1884
+ type FormatDateFnsOptions = Prettify<OmitStrict<FormatOptions, "locale", true, false> & {
1885
+ /** ------------------------------------------------------------
1886
+ * * ***Output format string passed to `date-fns/format`.***
1887
+ * ------------------------------------------------------------
1888
+ * - **Behavior:**
1889
+ * - Determines how the date will be rendered.
1890
+ * - Uses the full power of `date-fns` tokens.
1891
+ * - ***Default Value***: `"dd MMM yyyy - HH:mm:ss"`.
1892
+ * @example
1893
+ * "dd MMMM yyyy, HH:mm:ss" // ➔ "03 September 2025, 10:25:42"
1894
+ * @default "dd MMM yyyy - HH:mm:ss"
1895
+ */
1896
+ format?: string;
1897
+ /** ------------------------------------------------------------
1898
+ * * ***Locale used for formatting.***
1899
+ * ------------------------------------------------------------
1900
+ * - **Behavior:**
1901
+ * - If `string`: only accepts `"id"` (Indonesian) or `"en"` (English) - **(default)**.
1902
+ * - If `Locale`: accepts a locale object from `date-fns/locale`.
1903
+ * - ***Default Value***: `"en"`.
1904
+ * ```ts
1905
+ * import { ar } from "date-fns/locale";
1906
+ *
1907
+ * formatDateFns(new Date(), {
1908
+ * locale: ar,
1909
+ * format: "dd MMMM yyyy"
1910
+ * });
1911
+ * // ➔ "03 سبتمبر 2025"
1912
+ * ```
1913
+ * @default "en"
1914
+ */
1915
+ locale?: "id" | "en" | AnyString | Locale;
1916
+ /** ------------------------------------------------------------
1917
+ * * ***Input locale used when parsing non-standard string dates.***
1918
+ * ------------------------------------------------------------
1919
+ * - **Behavior:**
1920
+ * - Required if `date` is a **localized string**
1921
+ * (e.g. `"03 Mei 2025 10:25:42"` in Indonesian).
1922
+ * - Same accepted types as `locale` parameter.
1923
+ * - ***Default Value***: `"en"`.
1924
+ * ```ts
1925
+ * import { ar } from "date-fns/locale";
1926
+ *
1927
+ * formatDateFns("03 مايو 2025 10:25:42", {
1928
+ * inputFormat: "dd MMMM yyyy HH:mm:ss",
1929
+ * inputLocale: ar,
1930
+ * format: "PPpp"
1931
+ * });
1932
+ * // ➔ "May 3, 2025 at 10:25:42 AM"
1933
+ * ```
1934
+ * @default "en"
1935
+ */
1936
+ inputLocale?: "id" | "en" | AnyString | Locale;
1937
+ /** ------------------------------------------------------------
1938
+ * * ***Input format string for parsing non-ISO string dates.***
1939
+ * ------------------------------------------------------------
1940
+ * - **Behavior:**
1941
+ * - Required if `date` is **not ISO-8601** and not a native `Date`.
1942
+ * - Works together with `inputLocale` parameter.
1943
+ * - ***Default Value***: `undefined`.
1944
+ * @default undefined
1945
+ * @example
1946
+ * "dd MMMM yyyy HH:mm:ss" // ➔ "03 May 2025 10:25:42"
1947
+ */
1948
+ inputFormat?: string;
1949
+ }>;
1950
+
1915
1951
  /** ----------------------------------------------------------
1916
1952
  * * ***Utility: `formatDateFns`.***
1917
1953
  * ----------------------------------------------------------
@@ -1962,7 +1998,8 @@ inputFormat?:string;}>;
1962
1998
  * formatDateFns(null);
1963
1999
  * // ➔ null
1964
2000
  */
1965
- declare const formatDateFns:(date:string|Date|null|undefined,options?:FormatDateFnsOptions)=>string|null;
2001
+ declare const formatDateFns: (date: string | Date | null | undefined, options?: FormatDateFnsOptions) => string | null;
2002
+
1966
2003
  /** -------------------------------------------------------------
1967
2004
  * * ***Supported IETF BCP-47 locale codes for Intl API.***
1968
2005
  * -------------------------------------------------------------
@@ -1977,7 +2014,8 @@ declare const formatDateFns:(date:string|Date|null|undefined,options?:FormatDate
1977
2014
  * const locale: SupportedLocales = "fr-CA";
1978
2015
  * new Intl.DateTimeFormat(locale).format(new Date());
1979
2016
  */
1980
- 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);
2017
+ 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);
2018
+
1981
2019
  /** ----------------------------------------------------------------
1982
2020
  * * ***Options for formatting dates with `Intl.DateTimeFormat`.***
1983
2021
  * ----------------------------------------------------------------
@@ -1986,28 +2024,30 @@ type SupportedLocales="en-US"|"en-GB"|"en-AU"|"en-CA"|"en-NZ"|"en-ZA"|"en-IN"|"e
1986
2024
  * an additional `locale` property that is validated against **{@link SupportedLocales | `SupportedLocales`}**.**
1987
2025
  * @private ***types for {@link formatDateIntl}.***
1988
2026
  */
1989
- type FormatDateIntlOptions=Intl.DateTimeFormatOptions &{
1990
- /** ------------------------------------------------------------
1991
- * * ***Locale for date formatting.***
1992
- * ------------------------------------------------------------
1993
- * - **Behavior:**
1994
- * - Must be a valid [***BCP-47 locale***](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locales_argument),
1995
- * validated against {@link SupportedLocales | **`SupportedLocales`**}.
1996
- * - If `locale` is `undefined` or an empty string (after trimming),
1997
- * it will **default to `"en-US"`**.
1998
- * @default "en-US"
1999
- * @example
2000
- * { year: "numeric", month: "long" }
2001
- * // Unset locale, default locale ➔ "en-US"
2002
- * { locale: "fr-FR", ...}
2003
- * // Explicit locale
2004
- * { locale: " ", ...}
2005
- * // Empty string locale ➔ defaults to "en-US"
2006
- * { locale: " en-GB ", ...}
2007
- * // Value will trimming ➔ "en-GB"
2008
- *
2009
- */
2010
- locale?:SupportedLocales;};
2027
+ type FormatDateIntlOptions = Intl.DateTimeFormatOptions & {
2028
+ /** ------------------------------------------------------------
2029
+ * * ***Locale for date formatting.***
2030
+ * ------------------------------------------------------------
2031
+ * - **Behavior:**
2032
+ * - Must be a valid [***BCP-47 locale***](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locales_argument),
2033
+ * validated against {@link SupportedLocales | **`SupportedLocales`**}.
2034
+ * - If `locale` is `undefined` or an empty string (after trimming),
2035
+ * it will **default to `"en-US"`**.
2036
+ * @default "en-US"
2037
+ * @example
2038
+ * { year: "numeric", month: "long" }
2039
+ * // Unset locale, default locale ➔ "en-US"
2040
+ * { locale: "fr-FR", ...}
2041
+ * // Explicit locale
2042
+ * { locale: " ", ...}
2043
+ * // Empty string locale ➔ defaults to "en-US"
2044
+ * { locale: " en-GB ", ...}
2045
+ * // Value will trimming ➔ "en-GB"
2046
+ *
2047
+ */
2048
+ locale?: SupportedLocales;
2049
+ };
2050
+
2011
2051
  /** ----------------------------------------------------------
2012
2052
  * * ***Utility: `formatDateIntl`.***
2013
2053
  * ----------------------------------------------------------
@@ -2035,7 +2075,8 @@ locale?:SupportedLocales;};
2035
2075
  * formatDateIntl(new Date(), { timeZone: "UTC", hour: "2-digit", minute: "2-digit" });
2036
2076
  * // ➔ "01:30 AM"
2037
2077
  */
2038
- declare const formatDateIntl:(date:string|Date|null|undefined,options?:FormatDateIntlOptions)=>string|null;
2078
+ declare const formatDateIntl: (date: string | Date | null | undefined, options?: FormatDateIntlOptions) => string | null;
2079
+
2039
2080
  /** ----------------------------------------------------------
2040
2081
  * * ***Utility: `formatDateTime`.***
2041
2082
  * ----------------------------------------------------------
@@ -2076,7 +2117,8 @@ declare const formatDateIntl:(date:string|Date|null|undefined,options?:FormatDat
2076
2117
  * formatDateTime(undefined);
2077
2118
  * // ➔ null
2078
2119
  */
2079
- declare const formatDateTime:(date:string|Date|null|undefined,format?:string)=>string|null;
2120
+ declare const formatDateTime: (date: string | Date | null | undefined, format?: string) => string | null;
2121
+
2080
2122
  /** ----------------------------------------------------------
2081
2123
  * * ***Utility: `getGMTOffset`.***
2082
2124
  * ----------------------------------------------------------
@@ -2107,4 +2149,6 @@ declare const formatDateTime:(date:string|Date|null|undefined,format?:string)=>s
2107
2149
  * getGMTOffset(123);
2108
2150
  * // ➔ "0"
2109
2151
  */
2110
- declare const getGMTOffset:(date?:string|Date|null)=>string;export{censorEmail,chunkString,formatCurrency,formatDateFns,formatDateIntl,formatDateTime,formatNumber,formatPhoneNumber,getGMTOffset,truncateString};
2152
+ declare const getGMTOffset: (date?: string | Date | null) => string;
2153
+
2154
+ export { censorEmail, chunkString, formatCurrency, formatDateFns, formatDateIntl, formatDateTime, formatNumber, formatPhoneNumber, getGMTOffset, truncateString };