@rzl-zone/utils-js 3.1.0-beta.2 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (195) hide show
  1. package/README.md +56 -27
  2. package/dist/NumberRangeUnion-DC-C3_Kq.d.ts +23 -23
  3. package/dist/any-BmdI8UbK.d.ts +56 -56
  4. package/dist/arrays-normalize-recursive-CnjYJ9xg.d.ts +66 -66
  5. package/dist/assertions/index.cjs +1 -1
  6. package/dist/assertions/index.d.ts +396 -396
  7. package/dist/assertions/index.js +1 -1
  8. package/dist/chunk-26XIKDJI.cjs +1 -0
  9. package/dist/chunk-2NWHDDM5.js +1 -0
  10. package/dist/chunk-2UIRWYE3.js +1 -0
  11. package/dist/chunk-3KBHD3BS.cjs +1 -0
  12. package/dist/chunk-4HD2O5A4.js +1 -0
  13. package/dist/chunk-5C2SMIGX.cjs +1 -0
  14. package/dist/chunk-5I2B5DOG.js +1 -0
  15. package/dist/chunk-6HQDHIOD.js +1 -0
  16. package/dist/chunk-735HJXBT.cjs +1 -0
  17. package/dist/chunk-7BXIZM57.cjs +1 -0
  18. package/dist/chunk-7KJBDGEP.js +1 -0
  19. package/dist/chunk-7U44T63D.cjs +1 -0
  20. package/dist/chunk-AJ65QFV2.js +1 -0
  21. package/dist/chunk-APHDUCVQ.js +1 -0
  22. package/dist/chunk-BSVZRN7C.js +1 -0
  23. package/dist/chunk-C6JFHUR2.cjs +1 -0
  24. package/dist/chunk-CPLBRGST.js +1 -0
  25. package/dist/chunk-CTBRLEOG.js +1 -0
  26. package/dist/chunk-DUK2K4FB.js +1 -0
  27. package/dist/chunk-DVMHRLKP.cjs +1 -0
  28. package/dist/chunk-E63WVPZE.cjs +1 -0
  29. package/dist/chunk-EBMHQW7X.cjs +1 -0
  30. package/dist/chunk-EGNZCW4K.js +1 -0
  31. package/dist/chunk-FEKDB32T.js +1 -0
  32. package/dist/chunk-FIAAX3UE.js +1 -0
  33. package/dist/chunk-FUS3DVLB.cjs +1 -0
  34. package/dist/chunk-GGRMHIFJ.cjs +1 -0
  35. package/dist/chunk-HQ5GQTEE.js +1 -0
  36. package/dist/chunk-I5X5IN4H.js +1 -0
  37. package/dist/chunk-I7YGXQPI.cjs +1 -0
  38. package/dist/chunk-INUFZJLX.cjs +1 -0
  39. package/dist/chunk-IREHUBF7.js +1 -0
  40. package/dist/chunk-J2RGTPGK.cjs +1 -0
  41. package/dist/chunk-KHO2SBNA.cjs +1 -0
  42. package/dist/chunk-KXIXXSWX.cjs +1 -0
  43. package/dist/chunk-LBMEEJWA.js +1 -0
  44. package/dist/chunk-MC3LXMCQ.js +1 -0
  45. package/dist/chunk-MMSYCIJ2.cjs +1 -1
  46. package/dist/chunk-NU3N4WHD.cjs +1 -0
  47. package/dist/chunk-ODZQXH7E.cjs +1 -0
  48. package/dist/chunk-ONZFBJVW.js +1 -0
  49. package/dist/chunk-PXDRHFIE.js +1 -0
  50. package/dist/chunk-Q6NHYWVX.js +1 -0
  51. package/dist/chunk-QNKGP5DY.js +1 -0
  52. package/dist/chunk-S6Z6I2EG.cjs +1 -0
  53. package/dist/chunk-SMADKXZE.js +1 -0
  54. package/dist/chunk-TSLYDPBJ.js +1 -0
  55. package/dist/chunk-TVXADXCC.cjs +1 -0
  56. package/dist/chunk-UDA26MCU.cjs +1 -0
  57. package/dist/chunk-UET567YM.cjs +1 -0
  58. package/dist/chunk-VEYMQ3UA.js +1 -0
  59. package/dist/chunk-W2W3L2M5.js +1 -0
  60. package/dist/chunk-WBWTXKMC.cjs +1 -0
  61. package/dist/chunk-WVSPXFTY.js +1 -0
  62. package/dist/chunk-XC2PYCT4.cjs +1 -0
  63. package/dist/chunk-XIXA5KDF.cjs +1 -0
  64. package/dist/chunk-Y4O5KZF6.cjs +1 -0
  65. package/dist/chunk-YRM7IJLX.js +1 -0
  66. package/dist/chunk-YT3MSZKK.cjs +1 -0
  67. package/dist/chunk-YXHCULSO.cjs +1 -0
  68. package/dist/chunk-YZR5OGJA.cjs +1 -0
  69. package/dist/chunk-Z4DXK7A6.cjs +1 -0
  70. package/dist/chunk-ZXIWDFEQ.js +1 -0
  71. package/dist/conversions/index.cjs +1 -1
  72. package/dist/conversions/index.d.ts +1347 -1297
  73. package/dist/conversions/index.js +1 -1
  74. package/dist/env/index.cjs +1 -1
  75. package/dist/env/index.d.ts +14 -14
  76. package/dist/env/index.js +1 -1
  77. package/dist/events/index.cjs +1 -1
  78. package/dist/events/index.d.ts +109 -109
  79. package/dist/events/index.js +1 -1
  80. package/dist/extends-Bk_SBGdT.d.ts +330 -330
  81. package/dist/formatting/index.cjs +1 -1
  82. package/dist/formatting/index.d.ts +855 -855
  83. package/dist/formatting/index.js +1 -1
  84. package/dist/generator/index.cjs +1 -1
  85. package/dist/generator/index.d.ts +155 -155
  86. package/dist/generator/index.js +1 -1
  87. package/dist/if-CvT4R7Kh.d.ts +16 -16
  88. package/dist/is-array-Cymwrsmm.d.ts +1119 -0
  89. package/dist/isPlainObject-BVhBAPHX.d.ts +154 -154
  90. package/dist/never-BfayMBF9.d.ts +64 -64
  91. package/dist/next/index.cjs +1 -8
  92. package/dist/next/index.d.ts +183 -183
  93. package/dist/next/index.js +1 -8
  94. package/dist/next/server/index.cjs +1 -2
  95. package/dist/next/server/index.d.ts +25 -25
  96. package/dist/next/server/index.js +1 -2
  97. package/dist/nils-DMz3kU7M.d.ts +155 -155
  98. package/dist/omit-VvmIsZmX.d.ts +25 -25
  99. package/dist/operations/index.cjs +1 -1
  100. package/dist/operations/index.d.ts +120 -120
  101. package/dist/operations/index.js +1 -1
  102. package/dist/or-DyZCRvaU.d.ts +89 -0
  103. package/dist/parsers/index.cjs +1 -1
  104. package/dist/parsers/index.d.ts +34 -34
  105. package/dist/parsers/index.js +1 -1
  106. package/dist/predicates/index.cjs +1 -1
  107. package/dist/predicates/index.d.ts +1774 -1680
  108. package/dist/predicates/index.js +1 -1
  109. package/dist/prettify-C4xLcYOP.d.ts +328 -328
  110. package/dist/promise/index.cjs +1 -1
  111. package/dist/promise/index.d.ts +29 -29
  112. package/dist/promise/index.js +1 -1
  113. package/dist/rzl-utils.global.js +1 -4
  114. package/dist/string-XA-til3C.d.ts +318 -318
  115. package/dist/strings/index.cjs +1 -1
  116. package/dist/strings/index.d.ts +690 -690
  117. package/dist/strings/index.js +1 -1
  118. package/dist/tailwind/index.cjs +1 -0
  119. package/dist/tailwind/index.d.ts +565 -0
  120. package/dist/tailwind/index.js +1 -0
  121. package/dist/type-data-DDs-u2kq.d.ts +241 -241
  122. package/dist/types/index.d.ts +3266 -3266
  123. package/dist/urls/index.cjs +1 -1
  124. package/dist/urls/index.d.ts +373 -373
  125. package/dist/urls/index.js +1 -1
  126. package/package.json +24 -23
  127. package/dist/chunk-25G6B35W.js +0 -1
  128. package/dist/chunk-2AUUPGMN.js +0 -1
  129. package/dist/chunk-2JQQQ625.js +0 -1
  130. package/dist/chunk-445TAVT4.cjs +0 -1
  131. package/dist/chunk-467VEMJH.js +0 -1
  132. package/dist/chunk-56QBKKRE.js +0 -1
  133. package/dist/chunk-5SZUSNGZ.js +0 -1
  134. package/dist/chunk-6Q4I2RPC.cjs +0 -1
  135. package/dist/chunk-6SMJMZ7G.cjs +0 -1
  136. package/dist/chunk-7YWAQOA4.cjs +0 -1
  137. package/dist/chunk-BLCANGFS.js +0 -1
  138. package/dist/chunk-CK3BZGEU.js +0 -1
  139. package/dist/chunk-D43GV6EF.cjs +0 -1
  140. package/dist/chunk-DFSTVQFI.cjs +0 -1
  141. package/dist/chunk-DYRDBYPF.cjs +0 -1
  142. package/dist/chunk-ELDDNERR.js +0 -1
  143. package/dist/chunk-EXXLUO7L.cjs +0 -1
  144. package/dist/chunk-FIEZKTAZ.cjs +0 -1
  145. package/dist/chunk-G72VSVGO.js +0 -1
  146. package/dist/chunk-GAJTFCUA.js +0 -1
  147. package/dist/chunk-GOJNH55O.cjs +0 -1
  148. package/dist/chunk-HXST7RJB.js +0 -1
  149. package/dist/chunk-HXTACM3O.cjs +0 -1
  150. package/dist/chunk-IJTZWWRJ.cjs +0 -1
  151. package/dist/chunk-ISJ33O2J.cjs +0 -1
  152. package/dist/chunk-JISH2VGG.js +0 -1
  153. package/dist/chunk-JQZUWBIX.js +0 -1
  154. package/dist/chunk-K4PLGD7C.js +0 -1
  155. package/dist/chunk-KZQB7H4E.cjs +0 -1
  156. package/dist/chunk-LUVV5KSD.cjs +0 -2
  157. package/dist/chunk-LVUSFXQS.cjs +0 -1
  158. package/dist/chunk-ME5OV5HN.js +0 -1
  159. package/dist/chunk-MF5Y5K4N.cjs +0 -1
  160. package/dist/chunk-MJAW5RAK.js +0 -1
  161. package/dist/chunk-MWLEM7ED.js +0 -1
  162. package/dist/chunk-NNM7QCNB.js +0 -1
  163. package/dist/chunk-NSVLG7NY.js +0 -4
  164. package/dist/chunk-NUHOOAUN.cjs +0 -1
  165. package/dist/chunk-NUVGETPD.js +0 -2
  166. package/dist/chunk-O5VXBNUQ.cjs +0 -4
  167. package/dist/chunk-O7SJR4CY.cjs +0 -1
  168. package/dist/chunk-OX6RLS2F.cjs +0 -1
  169. package/dist/chunk-PFLNHD4B.cjs +0 -1
  170. package/dist/chunk-PSWITZK5.js +0 -1
  171. package/dist/chunk-PUQXRLZH.cjs +0 -1
  172. package/dist/chunk-PYUVKHUF.cjs +0 -1
  173. package/dist/chunk-REFMEB4A.js +0 -1
  174. package/dist/chunk-RHE3M2NJ.cjs +0 -1
  175. package/dist/chunk-RHIBYOFQ.js +0 -1
  176. package/dist/chunk-RV2VULM7.cjs +0 -1
  177. package/dist/chunk-S7GMG4TB.js +0 -1
  178. package/dist/chunk-SW6HYEW7.cjs +0 -1
  179. package/dist/chunk-SYJC7UAW.js +0 -1
  180. package/dist/chunk-TQMZ2LPI.js +0 -1
  181. package/dist/chunk-U4TZO7WV.js +0 -1
  182. package/dist/chunk-UUMKL74S.js +0 -1
  183. package/dist/chunk-VQLAPEL3.js +0 -1
  184. package/dist/chunk-VTR75UID.cjs +0 -1
  185. package/dist/chunk-XFCJDSB2.cjs +0 -1
  186. package/dist/chunk-XOYX4PLZ.cjs +0 -1
  187. package/dist/chunk-Z6FLCEN6.js +0 -1
  188. package/dist/chunk-ZO5364A6.cjs +0 -1
  189. package/dist/index.cjs +0 -1
  190. package/dist/index.d.ts +0 -1
  191. package/dist/index.js +0 -1
  192. package/dist/is-array--YjXV-Wx.d.ts +0 -1207
  193. package/dist/stylings/index.cjs +0 -1
  194. package/dist/stylings/index.d.ts +0 -41
  195. package/dist/stylings/index.js +0 -1
@@ -1,353 +1,353 @@
1
1
  import{I as If}from'./if-CvT4R7Kh.js';import{A as AnyFunction,N as NonPlainObject}from'./type-data-DDs-u2kq.js';import{I as IsNever}from'./never-BfayMBF9.js';
2
2
  /** -------------------------------------------------------
3
- * * ***IsArrayOrTuple.***
4
- * -------------------------------------------------------
5
- * Checks if a given type `T` is an array or tuple type.
6
- * This includes both mutable (`T[]`) and readonly (`readonly T[]`) arrays.
7
- *
8
- * @template T - The type to check.
9
- * @example
10
- * // truthy
11
- * type A = IsArrayOrTuple<string[]>;
12
- * // ➔ true
13
- * type B = IsArrayOrTuple<readonly [string, number]>;
14
- * // ➔ true
15
- *
16
- * // falsy
17
- * type C = IsArrayOrTuple<string>; // ➔ false
18
- */
3
+ * * ***IsArrayOrTuple.***
4
+ * -------------------------------------------------------
5
+ * Checks if a given type `T` is an array or tuple type.
6
+ * This includes both mutable (`T[]`) and readonly (`readonly T[]`) arrays.
7
+ *
8
+ * @template T - The type to check.
9
+ * @example
10
+ * // truthy
11
+ * type A = IsArrayOrTuple<string[]>;
12
+ * // ➔ true
13
+ * type B = IsArrayOrTuple<readonly [string, number]>;
14
+ * // ➔ true
15
+ *
16
+ * // falsy
17
+ * type C = IsArrayOrTuple<string>; // ➔ false
18
+ */
19
19
  type IsArrayOrTuple<T>=T extends readonly any[]?true:false;
20
20
  /** -------------------------------------------------------
21
- * * ***IsConstructor.***
22
- * -------------------------------------------------------
23
- * Checks if a given type `T` is a constructor type (`new () => any`).
24
- *
25
- * @template T - The type to check.
26
- * @returns `true` if `T` is a constructor, otherwise `false`.
27
- * @example
28
- * class MyClass {}
29
- * type A = IsConstructor<typeof MyClass>;
30
- * // ➔ true
31
- * type B = IsConstructor<() => void>;
32
- * // ➔ false
33
- */
21
+ * * ***IsConstructor.***
22
+ * -------------------------------------------------------
23
+ * Checks if a given type `T` is a constructor type (`new () => any`).
24
+ *
25
+ * @template T - The type to check.
26
+ * @returns `true` if `T` is a constructor, otherwise `false`.
27
+ * @example
28
+ * class MyClass {}
29
+ * type A = IsConstructor<typeof MyClass>;
30
+ * // ➔ true
31
+ * type B = IsConstructor<() => void>;
32
+ * // ➔ false
33
+ */
34
34
  type IsConstructor<T>=T extends abstract new(...args:any[])=>any?true:false;
35
35
  /** -------------------------------------------------------
36
- * * ***IsFunction.***
37
- * -------------------------------------------------------
38
- * Checks if a given type `T` is a callable function type.
39
- *
40
- * @template T - The type to check.
41
- * @example
42
- * type A = IsFunction<() => void>; // ➔ true
43
- * type B = IsFunction<string>; // ➔ false
44
- */
36
+ * * ***IsFunction.***
37
+ * -------------------------------------------------------
38
+ * Checks if a given type `T` is a callable function type.
39
+ *
40
+ * @template T - The type to check.
41
+ * @example
42
+ * type A = IsFunction<() => void>; // ➔ true
43
+ * type B = IsFunction<string>; // ➔ false
44
+ */
45
45
  type IsFunction<T>=T extends AnyFunction?true:false;
46
46
  /** -------------------------------------------------------
47
- * * ***Primitive.***
48
- * -------------------------------------------------------
49
- *
50
- * Represents **all primitive types in JavaScript/TypeScript**,
51
- * including their literal variants.
52
- *
53
- * This type matches:
54
- * - Core primitive types: `string`, `number`, `boolean`, `bigint`, `symbol`, `null`, `undefined`
55
- * - Literal counterparts: `"foo"`, `42`, `true`, etc.
56
- *
57
- * ⚠️ Note:
58
- * - Unlike some definitions, this does **not** include `void` or `never`,
59
- * since they are TypeScript-specific keywords, not runtime primitives.
60
- *
61
- * @example
62
- * ```ts
63
- * type A = Primitive; // any strict primitive type
64
- * type B = "hello" extends Primitive ? true : false; // true
65
- * type C = void extends Primitive ? true : false; // false
66
- * ```
67
- */
47
+ * * ***Primitive.***
48
+ * -------------------------------------------------------
49
+ *
50
+ * Represents **all primitive types in JavaScript/TypeScript**,
51
+ * including their literal variants.
52
+ *
53
+ * This type matches:
54
+ * - Core primitive types: `string`, `number`, `boolean`, `bigint`, `symbol`, `null`, `undefined`
55
+ * - Literal counterparts: `"foo"`, `42`, `true`, etc.
56
+ *
57
+ * ⚠️ Note:
58
+ * - Unlike some definitions, this does **not** include `void` or `never`,
59
+ * since they are TypeScript-specific keywords, not runtime primitives.
60
+ *
61
+ * @example
62
+ * ```ts
63
+ * type A = Primitive; // any strict primitive type
64
+ * type B = "hello" extends Primitive ? true : false; // true
65
+ * type C = void extends Primitive ? true : false; // false
66
+ * ```
67
+ */
68
68
  type Primitive=string|number|bigint|boolean|symbol|null|undefined;
69
69
  /** -------------------------------------------------------
70
- * * ***IsPrimitive.***
71
- * -------------------------------------------------------
72
- *
73
- * Checks if a given type `T` is a **strict primitive type** in JavaScript/TypeScript,
74
- * including literal variants.
75
- * This excludes `void` and `never`.
76
- *
77
- * Includes:
78
- * - `string`, `number`, `bigint`, `boolean`, `symbol`, `null`, `undefined`.
79
- * - Literal types like `"foo"`, `42`, `true`.
80
- *
81
- * Excludes:
82
- * - `void` (absence of value)
83
- * - `never` (impossible type)
84
- * - `object`, `unknown`, `Date`, `arrays`, `functions`, etc.
85
- *
86
- * @template T - The type to check
87
- *
88
- * @example
89
- * ```ts
90
- * type A = IsPrimitive<"foo">; // true
91
- * type B = IsPrimitive<null>; // true
92
- * type C = IsPrimitive<number>; // true
93
- * type D = IsPrimitive<undefined>; // true
94
- * type E = IsPrimitive<{}>; // false
95
- * type F = IsPrimitive<void>; // false
96
- * type G = IsPrimitive<never>; // false
97
- * type H = IsPrimitive<unknown>; // false
98
- * type I = IsPrimitive<object>; // false
99
- * type J = IsPrimitive<Date>; // false
100
- * type K = IsPrimitive<[]>; // false
101
- * type L = IsPrimitive<() => void>; // false
102
- * ```
103
- */
70
+ * * ***IsPrimitive.***
71
+ * -------------------------------------------------------
72
+ *
73
+ * Checks if a given type `T` is a **strict primitive type** in JavaScript/TypeScript,
74
+ * including literal variants.
75
+ * This excludes `void` and `never`.
76
+ *
77
+ * Includes:
78
+ * - `string`, `number`, `bigint`, `boolean`, `symbol`, `null`, `undefined`.
79
+ * - Literal types like `"foo"`, `42`, `true`.
80
+ *
81
+ * Excludes:
82
+ * - `void` (absence of value)
83
+ * - `never` (impossible type)
84
+ * - `object`, `unknown`, `Date`, `arrays`, `functions`, etc.
85
+ *
86
+ * @template T - The type to check
87
+ *
88
+ * @example
89
+ * ```ts
90
+ * type A = IsPrimitive<"foo">; // true
91
+ * type B = IsPrimitive<null>; // true
92
+ * type C = IsPrimitive<number>; // true
93
+ * type D = IsPrimitive<undefined>; // true
94
+ * type E = IsPrimitive<{}>; // false
95
+ * type F = IsPrimitive<void>; // false
96
+ * type G = IsPrimitive<never>; // false
97
+ * type H = IsPrimitive<unknown>; // false
98
+ * type I = IsPrimitive<object>; // false
99
+ * type J = IsPrimitive<Date>; // false
100
+ * type K = IsPrimitive<[]>; // false
101
+ * type L = IsPrimitive<() => void>; // false
102
+ * ```
103
+ */
104
104
  type IsPrimitive<T>=IsNever<T>extends true?false:T extends Primitive?true:false;
105
105
  /** -------------------------------------------------------
106
- * * ***IsRealPrimitive.***
107
- * -------------------------------------------------------
108
- *
109
- * Checks if a given type `T` is a **real primitive type** in JavaScript/TypeScript,
110
- * based on runtime behavior, **excluding `null`** but including `undefined`.
111
- *
112
- * Includes:
113
- * - `string`, `number`, `bigint`, `boolean`, `symbol`, `undefined`
114
- * - Literal types like `"foo"`, `42`, `true`
115
- *
116
- * Excludes:
117
- * - `null`
118
- * - `never` (impossible type)
119
- * - Objects, arrays, functions, `Date`, `unknown`, etc.
120
- *
121
- * ⚠️ Note:
122
- * - This aligns with runtime `typeof` checks in JS: `typeof null === "object"`,
123
- * so `null` is excluded from **“real primitives”**.
124
- *
125
- * @template T - The type to check.
126
- *
127
- * @example
128
- * ```ts
129
- * type A = IsRealPrimitive<42>; // true
130
- * type B = IsRealPrimitive<string>; // true
131
- * type C = IsRealPrimitive<boolean>; // true
132
- * type D = IsRealPrimitive<undefined>; // true
133
- * type E = IsRealPrimitive<{}>; // false
134
- * type F = IsRealPrimitive<[]>; // false
135
- * type G = IsRealPrimitive<null>; // false
136
- * type H = IsRealPrimitive<Date>; // false
137
- * type I = IsRealPrimitive<() => void>; // false
138
- * ```
139
- */
106
+ * * ***IsRealPrimitive.***
107
+ * -------------------------------------------------------
108
+ *
109
+ * Checks if a given type `T` is a **real primitive type** in JavaScript/TypeScript,
110
+ * based on runtime behavior, **excluding `null`** but including `undefined`.
111
+ *
112
+ * Includes:
113
+ * - `string`, `number`, `bigint`, `boolean`, `symbol`, `undefined`
114
+ * - Literal types like `"foo"`, `42`, `true`
115
+ *
116
+ * Excludes:
117
+ * - `null`
118
+ * - `never` (impossible type)
119
+ * - Objects, arrays, functions, `Date`, `unknown`, etc.
120
+ *
121
+ * ⚠️ Note:
122
+ * - This aligns with runtime `typeof` checks in JS: `typeof null === "object"`,
123
+ * so `null` is excluded from **“real primitives”**.
124
+ *
125
+ * @template T - The type to check.
126
+ *
127
+ * @example
128
+ * ```ts
129
+ * type A = IsRealPrimitive<42>; // true
130
+ * type B = IsRealPrimitive<string>; // true
131
+ * type C = IsRealPrimitive<boolean>; // true
132
+ * type D = IsRealPrimitive<undefined>; // true
133
+ * type E = IsRealPrimitive<{}>; // false
134
+ * type F = IsRealPrimitive<[]>; // false
135
+ * type G = IsRealPrimitive<null>; // false
136
+ * type H = IsRealPrimitive<Date>; // false
137
+ * type I = IsRealPrimitive<() => void>; // false
138
+ * ```
139
+ */
140
140
  type IsRealPrimitive<T>=T extends Exclude<Primitive,null>?true:false;
141
141
  /**
142
- * Applies readonly behavior according to mode.
143
- */
142
+ * Applies readonly behavior according to mode.
143
+ */
144
144
  type ApplyReadonlyMode<T,Mode extends PrettifyOptions["readonlyMode"]>=Mode extends"remove"?{-readonly [K in keyof T]:T[K];}:Mode extends"preserve"?{readonly [K in keyof T]:T[K];}:{[K in keyof T]:T[K];};
145
145
  /** -------------------------------------------------------
146
- * * ***PrettifyOptions***
147
- * -------------------------------------------------------
148
- *
149
- * Options for customizing the behavior of the {@link Prettify} type.
150
- */
146
+ * * ***PrettifyOptions***
147
+ * -------------------------------------------------------
148
+ *
149
+ * Options for customizing the behavior of the {@link Prettify} type.
150
+ */
151
151
  type PrettifyOptions={
152
152
  /** -------------------------------------------------------
153
- * * ***recursive***
154
- * -------------------------------------------------------
155
- *
156
- * Enables **deep prettification** of types when set to `true`.
157
- *
158
- * By default (`false`), {@link Prettify} only flattens the **top-level shape**
159
- * of objects and intersections. Nested objects, arrays, and tuples remain as-is
160
- * unless this option is enabled.
161
- *
162
- * ⚡ Behavior when `true`:
163
- * - **Plain objects**: Nested intersections are expanded recursively.
164
- * - **Arrays & tuples**: Each element type is recursively prettified.
165
- * - **Readonly handling**: Nested properties respect the `readonlyMode` option.
166
- * - **Functions, constructors, and built-in objects** (Set, Map, Date, Promise, etc.)
167
- * are **not** affected or expanded.
168
- * - **Nested intersections**: Combined properties are flattened recursively.
169
- *
170
- * ⚠️ Notes:
171
- * - Recursive mode only applies to **plain objects**, **arrays**, and **tuples**.
172
- * - Readonly modifiers on nested properties follow the `readonlyMode` rules:
173
- * - `"auto"` → keep as-is
174
- * - `"remove"` → strip readonly
175
- * - `"preserve"` → make readonly
176
- * - Arrays and tuples maintain `readonly` if the original type is `readonly` and `readonlyMode` is `"auto"` or `"preserve"`.
177
- *
178
- * @default false
179
- *
180
- * @example
181
- * ```ts
182
- * type Nested = {
183
- * a: {
184
- * readonly b: { c: number } & { d: string }
185
- * } & { e: boolean };
186
- * list: readonly ({ id: number } & { name: string })[];
187
- * set: Set<{ x: number } & { y: string }>;
188
- * };
189
- *
190
- * // Top-level only (default)
191
- * type Shallow = Prettify<Nested>;
192
- * // ➔ {
193
- * // a: { readonly b: { c: number } & { d: string } } & { e: boolean };
194
- * // list: readonly ({ id: number } & { name: string })[];
195
- * // set: Set<{ x: number } & { y: string }>;
196
- * // }
197
- *
198
- * // Fully recursive flatten
199
- * type Deep = Prettify<Nested, { recursive: true }>;
200
- * // ➔ {
201
- * // a: { readonly b: { c: number; d: string }; e: boolean };
202
- * // list: readonly { id: number; name: string }[];
203
- * // set: Set<{ x: number } & { y: string }>; // built-in ignored
204
- * // }
205
- * ```
206
- */
153
+ * * ***recursive***
154
+ * -------------------------------------------------------
155
+ *
156
+ * Enables **deep prettification** of types when set to `true`.
157
+ *
158
+ * By default (`false`), {@link Prettify} only flattens the **top-level shape**
159
+ * of objects and intersections. Nested objects, arrays, and tuples remain as-is
160
+ * unless this option is enabled.
161
+ *
162
+ * ⚡ Behavior when `true`:
163
+ * - **Plain objects**: Nested intersections are expanded recursively.
164
+ * - **Arrays & tuples**: Each element type is recursively prettified.
165
+ * - **Readonly handling**: Nested properties respect the `readonlyMode` option.
166
+ * - **Functions, constructors, and built-in objects** (Set, Map, Date, Promise, etc.)
167
+ * are **not** affected or expanded.
168
+ * - **Nested intersections**: Combined properties are flattened recursively.
169
+ *
170
+ * ⚠️ Notes:
171
+ * - Recursive mode only applies to **plain objects**, **arrays**, and **tuples**.
172
+ * - Readonly modifiers on nested properties follow the `readonlyMode` rules:
173
+ * - `"auto"` → keep as-is
174
+ * - `"remove"` → strip readonly
175
+ * - `"preserve"` → make readonly
176
+ * - Arrays and tuples maintain `readonly` if the original type is `readonly` and `readonlyMode` is `"auto"` or `"preserve"`.
177
+ *
178
+ * @default false
179
+ *
180
+ * @example
181
+ * ```ts
182
+ * type Nested = {
183
+ * a: {
184
+ * readonly b: { c: number } & { d: string }
185
+ * } & { e: boolean };
186
+ * list: readonly ({ id: number } & { name: string })[];
187
+ * set: Set<{ x: number } & { y: string }>;
188
+ * };
189
+ *
190
+ * // Top-level only (default)
191
+ * type Shallow = Prettify<Nested>;
192
+ * // ➔ {
193
+ * // a: { readonly b: { c: number } & { d: string } } & { e: boolean };
194
+ * // list: readonly ({ id: number } & { name: string })[];
195
+ * // set: Set<{ x: number } & { y: string }>;
196
+ * // }
197
+ *
198
+ * // Fully recursive flatten
199
+ * type Deep = Prettify<Nested, { recursive: true }>;
200
+ * // ➔ {
201
+ * // a: { readonly b: { c: number; d: string }; e: boolean };
202
+ * // list: readonly { id: number; name: string }[];
203
+ * // set: Set<{ x: number } & { y: string }>; // built-in ignored
204
+ * // }
205
+ * ```
206
+ */
207
207
  recursive?:boolean;
208
208
  /** -------------------------------------------------------
209
- * * ***readonlyMode***
210
- * -------------------------------------------------------
211
- *
212
- * Determines how `readonly` modifiers are applied to properties
213
- * when using {@link Prettify}.
214
- *
215
- * Modes:
216
- * - `"auto"` → Keep `readonly` exactly as in the original type (default).
217
- * - `"remove"` → Remove all `readonly` modifiers.
218
- * - `"preserve"` → Make all properties `readonly`.
219
- *
220
- * ⚡ Behavior:
221
- * - Applies to both **top-level** and **nested properties** (if `recursive` is `true`).
222
- * - Arrays and tuples preserve or adjust `readonly` according to the selected mode:
223
- * - `"auto"` → preserve array/tuple readonly as-is.
224
- * - `"remove"` → array/tuple becomes mutable.
225
- * - `"preserve"` → array/tuple becomes readonly.
226
- * - Functions, constructors, and built-in objects (Set, Map, Date, Promise, etc.) are **not affected**.
227
- * - Nested intersections respect `readonlyMode` recursively if `recursive` is enabled.
228
- *
229
- * ⚠️ Notes:
230
- * - For nested objects, `readonly` behavior only changes if `recursive: true`.
231
- * - `readonlyMode` does **not** override `readonly` on function parameters, methods, or constructors.
232
- *
233
- * @default "auto"
234
- *
235
- * @example
236
- * ```ts
237
- * type T = { readonly a: number; b: string };
238
- *
239
- * // Default: auto
240
- * type Auto = Prettify<T, { readonlyMode: "auto" }>;
241
- * // ➔ { readonly a: number; b: string }
242
- *
243
- * // Remove readonly
244
- * type Remove = Prettify<T, { readonlyMode: "remove" }>;
245
- * // ➔ { a: number; b: string }
246
- *
247
- * // Force all readonly
248
- * type Preserve = Prettify<T, { readonlyMode: "preserve" }>;
249
- * // ➔ { readonly a: number; readonly b: string }
250
- *
251
- * // Recursive + preserve
252
- * type Nested = {
253
- * config: { readonly port: number } & { host: string }
254
- * };
255
- * type RecursivePreserve = Prettify<Nested, { recursive: true; readonlyMode: "preserve" }>;
256
- * // ➔ { readonly config: { readonly port: number; readonly host: string } }
257
- * ```
258
- */
209
+ * * ***readonlyMode***
210
+ * -------------------------------------------------------
211
+ *
212
+ * Determines how `readonly` modifiers are applied to properties
213
+ * when using {@link Prettify}.
214
+ *
215
+ * Modes:
216
+ * - `"auto"` → Keep `readonly` exactly as in the original type (default).
217
+ * - `"remove"` → Remove all `readonly` modifiers.
218
+ * - `"preserve"` → Make all properties `readonly`.
219
+ *
220
+ * ⚡ Behavior:
221
+ * - Applies to both **top-level** and **nested properties** (if `recursive` is `true`).
222
+ * - Arrays and tuples preserve or adjust `readonly` according to the selected mode:
223
+ * - `"auto"` → preserve array/tuple readonly as-is.
224
+ * - `"remove"` → array/tuple becomes mutable.
225
+ * - `"preserve"` → array/tuple becomes readonly.
226
+ * - Functions, constructors, and built-in objects (Set, Map, Date, Promise, etc.) are **not affected**.
227
+ * - Nested intersections respect `readonlyMode` recursively if `recursive` is enabled.
228
+ *
229
+ * ⚠️ Notes:
230
+ * - For nested objects, `readonly` behavior only changes if `recursive: true`.
231
+ * - `readonlyMode` does **not** override `readonly` on function parameters, methods, or constructors.
232
+ *
233
+ * @default "auto"
234
+ *
235
+ * @example
236
+ * ```ts
237
+ * type T = { readonly a: number; b: string };
238
+ *
239
+ * // Default: auto
240
+ * type Auto = Prettify<T, { readonlyMode: "auto" }>;
241
+ * // ➔ { readonly a: number; b: string }
242
+ *
243
+ * // Remove readonly
244
+ * type Remove = Prettify<T, { readonlyMode: "remove" }>;
245
+ * // ➔ { a: number; b: string }
246
+ *
247
+ * // Force all readonly
248
+ * type Preserve = Prettify<T, { readonlyMode: "preserve" }>;
249
+ * // ➔ { readonly a: number; readonly b: string }
250
+ *
251
+ * // Recursive + preserve
252
+ * type Nested = {
253
+ * config: { readonly port: number } & { host: string }
254
+ * };
255
+ * type RecursivePreserve = Prettify<Nested, { recursive: true; readonlyMode: "preserve" }>;
256
+ * // ➔ { readonly config: { readonly port: number; readonly host: string } }
257
+ * ```
258
+ */
259
259
  readonlyMode?:Extract<"auto"|"remove"|"preserve",string>;};
260
260
  /** -------------------------------------------------------
261
- * * ***DefaultPrettifyOptions***
262
- * -------------------------------------------------------
263
- *
264
- * Default options {@link Prettify} used when no custom options are provided.
265
- */
261
+ * * ***DefaultPrettifyOptions***
262
+ * -------------------------------------------------------
263
+ *
264
+ * Default options {@link Prettify} used when no custom options are provided.
265
+ */
266
266
  type DefaultPrettifyOptions={recursive:false;readonlyMode:"auto";};type MergeReadonlyIntersection<T>=T extends readonly any[]?T:T extends object?{[K in keyof T]:T[K];}:T;
267
267
  /** -------------------------------------------------------
268
- * * ***Prettify.***
269
- * -------------------------------------------------------
270
- * Flattens and simplifies complex TypeScript types into a more
271
- * human-readable form, by forcing the compiler to expand intersections.
272
- *
273
- * By default, only the **top-level shape** of an object is flattened.
274
- * To also prettify **nested objects**, set the `recursive` option.
275
- *
276
- * ⚠️ Note:
277
- * - `recursive: true` only affects **plain objects** and **arrays/tuples**.
278
- * - Built-in objects like `Set`, `Map`, `Date`, `Promise`, etc.
279
- * will **not** be recursively prettified.
280
- * - `readonly` handling is controlled via the `readonlyMode` option.
281
- *
282
- * ℹ️ Options:
283
- * - `recursive?: boolean` (default: `false`)
284
- * - Whether to recursively expand nested objects and intersections.
285
- * - `readonlyMode?: "auto" | "remove" | "preserve"` (default: `"auto"`)
286
- * - How `readonly` modifiers are treated:
287
- * - `"auto"` → preserve `readonly` as-is (default).
288
- * - `"remove"` → strip all `readonly`.
289
- * - `"preserve"` → enforce `readonly` everywhere.
290
- * @template T - The type to prettify.
291
- * @template Options - Configuration options.
292
- *
293
- * @example
294
- * ```ts
295
- * // --- Top-level only (default) ---
296
- * type T0 = Prettify<{ a: number } & { b: string }>;
297
- * // ➔ { a: number; b: string }
298
- *
299
- * // --- Recursive expansion of nested objects ---
300
- * type T1 = Prettify<
301
- * { a: { x: number } & { y: string } } & { b: boolean },
302
- * { recursive: true }
303
- * >;
304
- * // ➔ { a: { x: number; y: string }; b: boolean }
305
- *
306
- * // --- Readonly handling modes ---
307
- * type T2 = { readonly id: number; name: string };
308
- *
309
- * type R1 = Prettify<T2>;
310
- * // (default: readonlyMode = "auto")
311
- * // ➔ { readonly id: number; name: string }
312
- *
313
- * type R2 = Prettify<T2, { readonlyMode: "remove" }>;
314
- * // ➔ { id: number; name: string }
315
- *
316
- * type R3 = Prettify<T2, { readonlyMode: "preserve" }>;
317
- * // ➔ { readonly id: number; readonly name: string }
318
- *
319
- * // --- Readonly + mutable intersection ---
320
- * type T3 = Prettify<{ readonly a: number } & { a: number; b: boolean }>;
321
- * // ➔ { a: number; b: boolean }
322
- * // (in "auto" mode, readonly lose over mutable)
323
- *
324
- * // --- Nested readonly with recursive ---
325
- * type T4 = Prettify<
326
- * { config: { readonly port: number } & { host: string } },
327
- * { recursive: true }
328
- * >;
329
- * // ➔ { config: { readonly port: number; host: string } }
330
- *
331
- * // --- Arrays with readonly ---
332
- * type T5 = Prettify<
333
- * { list: readonly ({ id: number } & { name: string })[] },
334
- * { recursive: true }
335
- * >;
336
- * // (readonly on array is preserved in "auto" mode)
337
- * // ➔ { list: readonly { id: number; name: string }[] }
338
- *
339
- * type T6 = Prettify<
340
- * { list: readonly ({ id: number } & { name: string })[] },
341
- * { recursive: true; readonlyMode: "remove" }
342
- * >;
343
- * // ➔ { list: { id: number; name: string }[] }
344
- *
345
- * // --- Built-in objects are ignored (not expanded) ---
346
- * type T7 = Prettify<
347
- * { s: Set<{ a: number } & { b: string }> },
348
- * { recursive: true }
349
- * >;
350
- * // ➔ { s: Set<{ a: number } & { b: string }> }
351
- * ```
352
- */
268
+ * * ***Prettify.***
269
+ * -------------------------------------------------------
270
+ * Flattens and simplifies complex TypeScript types into a more
271
+ * human-readable form, by forcing the compiler to expand intersections.
272
+ *
273
+ * By default, only the **top-level shape** of an object is flattened.
274
+ * To also prettify **nested objects**, set the `recursive` option.
275
+ *
276
+ * ⚠️ Note:
277
+ * - `recursive: true` only affects **plain objects** and **arrays/tuples**.
278
+ * - Built-in objects like `Set`, `Map`, `Date`, `Promise`, etc.
279
+ * will **not** be recursively prettified.
280
+ * - `readonly` handling is controlled via the `readonlyMode` option.
281
+ *
282
+ * ℹ️ Options:
283
+ * - `recursive?: boolean` (default: `false`)
284
+ * - Whether to recursively expand nested objects and intersections.
285
+ * - `readonlyMode?: "auto" | "remove" | "preserve"` (default: `"auto"`)
286
+ * - How `readonly` modifiers are treated:
287
+ * - `"auto"` → preserve `readonly` as-is (default).
288
+ * - `"remove"` → strip all `readonly`.
289
+ * - `"preserve"` → enforce `readonly` everywhere.
290
+ * @template T - The type to prettify.
291
+ * @template Options - Configuration options.
292
+ *
293
+ * @example
294
+ * ```ts
295
+ * // --- Top-level only (default) ---
296
+ * type T0 = Prettify<{ a: number } & { b: string }>;
297
+ * // ➔ { a: number; b: string }
298
+ *
299
+ * // --- Recursive expansion of nested objects ---
300
+ * type T1 = Prettify<
301
+ * { a: { x: number } & { y: string } } & { b: boolean },
302
+ * { recursive: true }
303
+ * >;
304
+ * // ➔ { a: { x: number; y: string }; b: boolean }
305
+ *
306
+ * // --- Readonly handling modes ---
307
+ * type T2 = { readonly id: number; name: string };
308
+ *
309
+ * type R1 = Prettify<T2>;
310
+ * // (default: readonlyMode = "auto")
311
+ * // ➔ { readonly id: number; name: string }
312
+ *
313
+ * type R2 = Prettify<T2, { readonlyMode: "remove" }>;
314
+ * // ➔ { id: number; name: string }
315
+ *
316
+ * type R3 = Prettify<T2, { readonlyMode: "preserve" }>;
317
+ * // ➔ { readonly id: number; readonly name: string }
318
+ *
319
+ * // --- Readonly + mutable intersection ---
320
+ * type T3 = Prettify<{ readonly a: number } & { a: number; b: boolean }>;
321
+ * // ➔ { a: number; b: boolean }
322
+ * // (in "auto" mode, readonly lose over mutable)
323
+ *
324
+ * // --- Nested readonly with recursive ---
325
+ * type T4 = Prettify<
326
+ * { config: { readonly port: number } & { host: string } },
327
+ * { recursive: true }
328
+ * >;
329
+ * // ➔ { config: { readonly port: number; host: string } }
330
+ *
331
+ * // --- Arrays with readonly ---
332
+ * type T5 = Prettify<
333
+ * { list: readonly ({ id: number } & { name: string })[] },
334
+ * { recursive: true }
335
+ * >;
336
+ * // (readonly on array is preserved in "auto" mode)
337
+ * // ➔ { list: readonly { id: number; name: string }[] }
338
+ *
339
+ * type T6 = Prettify<
340
+ * { list: readonly ({ id: number } & { name: string })[] },
341
+ * { recursive: true; readonlyMode: "remove" }
342
+ * >;
343
+ * // ➔ { list: { id: number; name: string }[] }
344
+ *
345
+ * // --- Built-in objects are ignored (not expanded) ---
346
+ * type T7 = Prettify<
347
+ * { s: Set<{ a: number } & { b: string }> },
348
+ * { recursive: true }
349
+ * >;
350
+ * // ➔ { s: Set<{ a: number } & { b: string }> }
351
+ * ```
352
+ */
353
353
  type Prettify<T,Options extends PrettifyOptions=DefaultPrettifyOptions>=IsPrimitive<T>extends true?T:IsFunction<T>extends true?T:IsConstructor<T>extends true?T:IsArrayOrTuple<T>extends true?ApplyReadonlyMode<{[K in keyof T]:If<Options["recursive"],Prettify<T[K],Options>,T[K]>;},Options["readonlyMode"]>:T extends NonPlainObject?T:T extends object?ApplyReadonlyMode<MergeReadonlyIntersection<{[K in keyof T]:If<Options["recursive"],Prettify<T[K],Options>,T[K]>;}>,Options["readonlyMode"]>:T;export type{DefaultPrettifyOptions as D,IsArrayOrTuple as I,Prettify as P,PrettifyOptions as a,IsConstructor as b,IsFunction as c,IsPrimitive as d,IsRealPrimitive as e,Primitive as f};