@rzl-zone/utils-js 2.0.1 → 3.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/dist/NumberRangeUnion-DC-C3_Kq.d.ts +26 -0
  2. package/dist/any-BmdI8UbK.d.ts +67 -0
  3. package/dist/array-CIZRbqTF.d.ts +223 -0
  4. package/dist/arrays-normalize-recursive-CnjYJ9xg.d.ts +72 -0
  5. package/dist/assertions/index.cjs +1 -0
  6. package/dist/assertions/index.d.ts +428 -0
  7. package/dist/assertions/index.js +1 -0
  8. package/dist/chunk-2TRAPBZ7.cjs +1 -0
  9. package/dist/chunk-3D74QO5D.cjs +1 -0
  10. package/dist/chunk-4DK3RCC4.js +2 -0
  11. package/dist/chunk-4JOQ45HL.js +1 -0
  12. package/dist/chunk-55CZALRS.js +1 -0
  13. package/dist/chunk-56QBKKRE.js +1 -0
  14. package/dist/chunk-5JFV3GDE.cjs +4 -0
  15. package/dist/chunk-5SZUSNGZ.js +1 -0
  16. package/dist/chunk-62HX5Z45.cjs +1 -0
  17. package/dist/chunk-7NA6DUHR.cjs +2 -0
  18. package/dist/chunk-7YWAQOA4.cjs +1 -0
  19. package/dist/chunk-BVPMMWDL.cjs +1 -0
  20. package/dist/chunk-BYZAD3XN.cjs +1 -0
  21. package/dist/chunk-CEFYHEM4.cjs +1 -0
  22. package/dist/chunk-CN53M4QZ.cjs +1 -0
  23. package/dist/chunk-D47MHBSD.cjs +1 -0
  24. package/dist/chunk-DGH75GJD.js +1 -0
  25. package/dist/chunk-E5NUI7PN.js +1 -0
  26. package/dist/chunk-ELDDNERR.js +1 -0
  27. package/dist/chunk-EXZ47NOW.js +1 -0
  28. package/dist/chunk-FDITZ5C6.cjs +1 -0
  29. package/dist/chunk-FF76ISQ2.js +1 -0
  30. package/dist/chunk-FIEZKTAZ.cjs +1 -0
  31. package/dist/chunk-FSSV24W7.cjs +1 -0
  32. package/dist/chunk-G5LXIEFO.js +0 -0
  33. package/dist/chunk-GCGU2WB7.js +1 -0
  34. package/dist/chunk-GECI2YBP.js +1 -0
  35. package/dist/chunk-GQE4OVHC.cjs +1 -0
  36. package/dist/chunk-GRVZXQXL.cjs +1 -0
  37. package/dist/chunk-I4AVNHPA.cjs +1 -0
  38. package/dist/chunk-JFRL7NKU.js +4 -0
  39. package/dist/chunk-JWHM3WZQ.cjs +1 -0
  40. package/dist/chunk-KCQDDZJE.cjs +1 -0
  41. package/dist/chunk-L54ZPSYJ.js +1 -0
  42. package/dist/chunk-LVKAYEZ4.js +1 -0
  43. package/dist/chunk-MBDWTK54.cjs +1 -0
  44. package/dist/chunk-MMSYCIJ2.cjs +1 -0
  45. package/dist/chunk-MNGGDB2G.js +1 -0
  46. package/dist/chunk-MY7BA4GI.cjs +1 -0
  47. package/dist/chunk-N2IJPIND.cjs +1 -0
  48. package/dist/chunk-NIMNTEGV.js +1 -0
  49. package/dist/chunk-NNM7QCNB.js +1 -0
  50. package/dist/chunk-PUQXRLZH.cjs +1 -0
  51. package/dist/chunk-PVJF2JHM.js +1 -0
  52. package/dist/chunk-QCFXEUKL.js +1 -0
  53. package/dist/chunk-QFCGBBSY.js +1 -0
  54. package/dist/chunk-QQYAUPSK.cjs +1 -0
  55. package/dist/chunk-RN3TP3S3.js +1 -0
  56. package/dist/chunk-RV2VULM7.cjs +1 -0
  57. package/dist/chunk-SW6HYEW7.cjs +1 -0
  58. package/dist/chunk-SYJC7UAW.js +1 -0
  59. package/dist/chunk-TC4VBE4Y.cjs +1 -0
  60. package/dist/chunk-TUXDINHF.cjs +1 -0
  61. package/dist/chunk-U5Y2FXMN.cjs +1 -0
  62. package/dist/chunk-UUPQI6ND.cjs +1 -0
  63. package/dist/chunk-VYCGZ2S6.js +1 -0
  64. package/dist/chunk-W5EDKJK3.js +1 -0
  65. package/dist/chunk-WHAVUFEU.js +1 -0
  66. package/dist/chunk-XCFIOTCV.js +1 -0
  67. package/dist/chunk-XE27XPJR.js +1 -0
  68. package/dist/chunk-XH6MCRLP.js +1 -0
  69. package/dist/chunk-XVB3ZZEB.js +1 -0
  70. package/dist/chunk-ZBSIGJFO.cjs +1 -0
  71. package/dist/chunk-ZYAML74V.js +1 -0
  72. package/dist/conversions/index.cjs +1 -0
  73. package/dist/conversions/index.d.ts +1633 -0
  74. package/dist/conversions/index.js +1 -0
  75. package/dist/env/index.cjs +1 -0
  76. package/dist/env/index.d.ts +19 -0
  77. package/dist/env/index.js +1 -0
  78. package/dist/events/index.cjs +1 -0
  79. package/dist/events/index.d.ts +119 -0
  80. package/dist/events/index.js +1 -0
  81. package/dist/extends-Mp81Hq9-.d.ts +145 -0
  82. package/dist/formatting/index.cjs +1 -0
  83. package/dist/formatting/index.d.ts +912 -0
  84. package/dist/formatting/index.js +1 -0
  85. package/dist/generator/index.cjs +1 -0
  86. package/dist/generator/index.d.ts +163 -0
  87. package/dist/generator/index.js +1 -0
  88. package/dist/if-CvT4R7Kh.d.ts +18 -0
  89. package/dist/index.cjs +1 -1
  90. package/dist/index.d.ts +1 -4313
  91. package/dist/index.js +1 -1
  92. package/dist/is-array-Ckm_47hw.d.ts +1557 -0
  93. package/dist/isPlainObject-BKYaI6a8.d.ts +182 -0
  94. package/dist/never-BfayMBF9.d.ts +75 -0
  95. package/dist/next/index.cjs +8 -1
  96. package/dist/next/index.d.ts +169 -169
  97. package/dist/next/index.js +8 -1
  98. package/dist/next/server/index.cjs +2 -1
  99. package/dist/next/server/index.d.ts +37 -37
  100. package/dist/next/server/index.js +2 -1
  101. package/dist/nils-DMz3kU7M.d.ts +177 -0
  102. package/dist/omit-VvmIsZmX.d.ts +28 -0
  103. package/dist/operations/index.cjs +1 -0
  104. package/dist/operations/index.d.ts +182 -0
  105. package/dist/operations/index.js +1 -0
  106. package/dist/parsers/index.cjs +1 -0
  107. package/dist/parsers/index.d.ts +37 -0
  108. package/dist/parsers/index.js +1 -0
  109. package/dist/predicates/index.cjs +1 -0
  110. package/dist/predicates/index.d.ts +1839 -0
  111. package/dist/predicates/index.js +1 -0
  112. package/dist/prettify-C4xLcYOP.d.ts +353 -0
  113. package/dist/promise/index.cjs +1 -0
  114. package/dist/promise/index.d.ts +40 -0
  115. package/dist/promise/index.js +1 -0
  116. package/dist/rzl-utils.global.js +4 -1
  117. package/dist/strings/index.cjs +1 -0
  118. package/dist/strings/index.d.ts +816 -0
  119. package/dist/strings/index.js +1 -0
  120. package/dist/stylings/index.cjs +1 -0
  121. package/dist/stylings/index.d.ts +49 -0
  122. package/dist/stylings/index.js +1 -0
  123. package/dist/type-data-DDs-u2kq.d.ts +261 -0
  124. package/dist/types/index.d.ts +3589 -2090
  125. package/dist/urls/index.cjs +1 -0
  126. package/dist/urls/index.d.ts +418 -0
  127. package/dist/urls/index.js +1 -0
  128. package/package.json +147 -21
@@ -0,0 +1,1633 @@
1
+ import{A as AnyFunction,T as TypedArray,W as WebApiObjects,I as IntlObjects}from'../type-data-DDs-u2kq.js';import{N as NormalizeEmptyArraysRecursive,R as RemoveEmptyArrayElements,F as FixNeverArrayRecursive}from'../arrays-normalize-recursive-CnjYJ9xg.js';import{h as Nullish,a as KeepNull,b as KeepUndef}from'../nils-DMz3kU7M.js';import{I as IsAny}from'../any-BmdI8UbK.js';import{c as IfNotExtends,I as IfExtends}from'../extends-Mp81Hq9-.js';import{P as Prettify}from'../prettify-C4xLcYOP.js';import{N as NumberRangeUnion}from'../NumberRangeUnion-DC-C3_Kq.js';import'../if-CvT4R7Kh.js';import'../array-CIZRbqTF.js';import'../never-BfayMBF9.js';type ExcludeNil<T>=Exclude<T,null|undefined>;
2
+ /** ----------------------------------------------------------
3
+ * * ***Element extractor***
4
+ * ----------------------------------------------------------
5
+ */
6
+ type ElementOf<A extends readonly unknown[]>=A extends readonly(infer U)[]?U:never;
7
+ /** ----------------------------------------------------------
8
+ * * ***Compute `FilterNilArray`***
9
+ * ----------------------------------------------------------
10
+ *
11
+ * for a tuple/array A by using the element type (without null|undefined).
12
+ *
13
+ */
14
+ type FilterNilArrayFromTuple<A extends readonly unknown[]>=FilterNilArray<ExcludeNil<ElementOf<A>>>;
15
+ /** ----------------------------------------------------------
16
+ * ***Preserve `mutability`: if A is mutable (extends unknown[]), keep B; otherwise make B readonly***. */
17
+ type PreserveMutability<A extends readonly unknown[],B>=A extends unknown[]?B:Readonly<B>;type IsDeepEmptyArray<T>=T extends readonly []?true:T extends readonly(infer U)[]?IsDeepEmptyArray<U>:false;type FilterNilRecursive<T>=T extends readonly(infer U)[]?T extends(infer U)[]?FilterNilRecursive<ExcludeEmptyArray<U>>[]:readonly FilterNilRecursive<ExcludeEmptyArray<U>>[]:Exclude<T,null|undefined>;type ExcludeEmptyArray<T>=T extends []?never:T;type NormalizerArrays<T>=NormalizeEmptyArraysRecursive<RemoveEmptyArrayElements<FilterNilRecursive<T[]>>>;type FilterNilArray<T>=IsDeepEmptyArray<NormalizerArrays<T>>extends true?[]:FixNeverArrayRecursive<NormalizerArrays<T>>;type ResUnFTN<Force extends false|"stringOrNumber"|"primitives"|"all"=false>=Force extends"all"?Array<unknown[]|Record<string,unknown>|string>:Force extends"stringOrNumber"?Array<string|boolean|bigint|symbol|null|undefined|Record<string,unknown>|AnyFunction|unknown[]|Date|RegExp|Map<unknown,unknown>|Set<unknown>|Promise<unknown>>:Force extends"primitives"?Array<string|symbol|Record<string,unknown>|AnyFunction|unknown[]|Date|RegExp|Map<unknown,unknown>|Set<unknown>|Promise<unknown>>:Force extends false?Array<string|number|bigint|boolean|symbol|RegExp|Record<string,unknown>|AnyFunction|Date|Map<unknown,unknown>|Set<unknown>|Promise<unknown>|unknown[]|null|undefined>:unknown[];type ResFTN<Force extends false|"stringOrNumber"|"primitives"|"all"=false>=Force extends"all"?Array<string|Record<string,unknown>>:Force extends"stringOrNumber"?Array<string|boolean|bigint|symbol|null|undefined|Record<string,unknown>|AnyFunction|Date|RegExp|Promise<unknown>>:Force extends"primitives"?Array<string|symbol|RegExp|Record<string,unknown>|AnyFunction|Date|Promise<unknown>>:Force extends false?Array<string|number|bigint|boolean|symbol|RegExp|Record<string,unknown>|AnyFunction|Date|Promise<unknown>|null|undefined>:unknown[];type DedupeResult<Force extends ForceToStringOptions=false,FTN extends boolean=false>=FTN extends false?ResUnFTN<Force>:ResFTN<Force>;type ForceToStringOptions=false|"stringOrNumber"|"primitives"|"all";type DedupeArrayOptions<F extends ForceToStringOptions,Fl extends boolean>={
18
+ /** Enables string conversion for comparison, default is `false`.
19
+ *
20
+ * @default false
21
+ * @type {ForceToStringOptions}
22
+ */
23
+ forceToString?:F;
24
+ /** If true, deeply flattens arrays, Maps, and Sets before deduplication, default is `false`.
25
+ *
26
+ * @default false
27
+ */
28
+ flatten?:Fl;};
29
+ /** ----------------------------------------------------------
30
+ * * ***Removes `null` and `undefined` values from an array, including nested arrays.***
31
+ * ----------------------------------------------------------
32
+ *
33
+ * - ✅ Returns `undefined` if the input is explicitly `undefined` or `null`.
34
+ * - ✅ Returns `[]` if input is empty or all elements are removed after filtering.
35
+ * - ✅ Recursively filters nested arrays while preserving structure.
36
+ * - ✅ Ensures proper type inference for safer downstream operations.
37
+ *
38
+ * @template T - The type of elements in the array.
39
+ * @param {T[]} [input] - The array to be filtered.
40
+ * @returns {T[] | undefined} A new array with `null` and `undefined` values removed,
41
+ * or `undefined` if the input is explicitly `undefined` or `null`.
42
+ *
43
+ * @example
44
+ * ```ts
45
+ * filterNilArray([1, null, 2, undefined, 3]);
46
+ * // ➔ [1, 2, 3]
47
+ *
48
+ * filterNilArray([null, undefined]);
49
+ * // ➔ []
50
+ *
51
+ * filterNilArray(undefined);
52
+ * // ➔ undefined
53
+ *
54
+ * filterNilArray(null);
55
+ * // ➔ undefined
56
+ *
57
+ * filterNilArray([]); // or
58
+ * filterNilArray([[[]]]); // or
59
+ * filterNilArray([[[],undefined,null]]);
60
+ * // ➔ []
61
+ *
62
+ * filterNilArray([1, [null, 2, [undefined, 3]]]);
63
+ * // ➔ [1, [2, [3]]]
64
+ * ```
65
+ */
66
+ declare function filterNilArray(input?:null):undefined;declare function filterNilArray<A extends readonly unknown[]>(input:A):PreserveMutability<A,FilterNilArrayFromTuple<A>>;declare function filterNilArray<A extends readonly unknown[]>(input:A|null|undefined):PreserveMutability<A,FilterNilArrayFromTuple<A>>|undefined;declare function filterNilArray<T>(input?:(T|null|undefined)[]|null|undefined):FilterNilArray<T>|undefined;declare function filterNilArray(input:readonly unknown[]|null|undefined):unknown[]|undefined;declare function filterNilArray(input:unknown[]):unknown[];
67
+ /** ----------------------------------------------------------
68
+ * * ***Removes `null` and `undefined` values from an array, including nested arrays.***
69
+ * ----------------------------------------------------------
70
+ *
71
+ * **⚠️ Notes:** This function is deprecated and renamed to `filterNilArray`, will remove in the next version.
72
+ *
73
+ * @deprecated Use `filterNilArray` instead.
74
+ */
75
+ declare const filterNullArray:typeof filterNilArray;
76
+ /** ----------------------------------------------------------
77
+ * * ***Deduplicates values in an array (with optional flattening and deep stringification).***
78
+ * ----------------------------------------------------------
79
+ *
80
+ * - Supports various modes for converting values to strings before deduplication:
81
+ * - `"stringOrNumber"`: Converts strings and numbers to strings.
82
+ * - `"primitives"`: Converts all primitives (string, number, boolean, bigint, null, undefined, NaN) to strings.
83
+ * - `"all"`: Converts all values (primitives, objects, Maps, Sets, Symbols, RegExp, Dates, Errors, Promises, functions)
84
+ * to strings, including nested object properties.
85
+ * - `false` (default): No conversion applied.
86
+ *
87
+ * - Options:
88
+ * - `forceToString`: Enables string conversion for comparison, default is `false`.
89
+ * - `flatten`: If true, deeply flattens arrays, Maps, and Sets before deduplication, default is `false`.
90
+ *
91
+ * @template ForceToString - `forceToString` mode.
92
+ * @template Flattening - `flatten` mode.
93
+ *
94
+ * @param {unknown[]} inputArray - The array to deduplicate. Can be deeply nested and contain any mix of types.
95
+ * @param {{ forceToString?: false | "stringOrNumber" | "primitives" | "all" }} [options] - Options to control string conversion.
96
+ * @returns {DedupeResult<ForceToString, Flattening>} Deduplicated array with optional transformations.
97
+ *
98
+ * @throws {TypeError} If the input is not an array, or options is not an object, or if `forceToString` is invalid.
99
+ *
100
+ * @example
101
+ * ```ts
102
+ * dedupeArray(["apple", "banana", "apple"]);
103
+ * // ➔ ["apple", "banana"]
104
+ *
105
+ * dedupeArray([[1, 2], [1, 2]], { flatten: true });
106
+ * // ➔ [1, 2]
107
+ *
108
+ * dedupeArray([new Set([1, 2]), new Set([2, 3])], { flatten: true });
109
+ * // ➔ [1, 2, 3]
110
+ *
111
+ * dedupeArray([1, "1", 2, "2"], {
112
+ * forceToString: "stringOrNumber"
113
+ * });
114
+ * // ➔ ["1", "2"]
115
+ *
116
+ * dedupeArray([true, "true", false, undefined], {
117
+ * forceToString: "primitives"
118
+ * });
119
+ * // ➔ ["true", "false", "undefined"]
120
+ *
121
+ * dedupeArray([1, "1", { a: 1 }], {
122
+ * forceToString: "all"
123
+ * });
124
+ * // ➔ ["1", { a: "1" }]
125
+ *
126
+ * dedupeArray([1, 1, [2, 2, [3, 3]]]);
127
+ * // ➔ [1, [2, [3]]]
128
+ *
129
+ * dedupeArray([null, undefined, null]);
130
+ * // ➔ [null, undefined]
131
+ *
132
+ * dedupeArray([[], [[]], [[[]]], [[]], [[[]]]]);
133
+ * // ➔ [[], [[]], [[[]]]]
134
+ *
135
+ * const fn = () => 1;
136
+ * dedupeArray([fn, fn, () => 1]);
137
+ * // ➔ [fn, () => 1] cause: ref () => 1 and fn is different but ref const `fn` and `fn` is same ref.
138
+ *
139
+ * dedupeArray([Symbol("x"), Symbol("x")]);
140
+ * // ➔ [Symbol("x")] (symbols are same by identity, so dedupe
141
+ *
142
+ * dedupeArray([NaN, NaN, 1, "1"]);
143
+ * // ➔ [NaN, 1, "1"]
144
+ *
145
+ * dedupeArray([NaN, NaN, 1, "1"], {
146
+ * forceToString: "primitives"
147
+ * });
148
+ * // ➔ ["NaN", "1"]
149
+ *
150
+ * dedupeArray([new Date("2025-01-01"), new Date("2025-01-01")]);
151
+ * // ➔ [Date("2025-01-01")] (same time, deduped)
152
+ *
153
+ * dedupeArray([new Date("2025-01-01"), new Date("2025-01-01")], {
154
+ * forceToString: "all"
155
+ * });
156
+ * // ➔ ["2025-01-01T00:00:00.000Z"]
157
+ *
158
+ * dedupeArray([/abc/, /abc/], {
159
+ * forceToString: "all"
160
+ * });
161
+ * // ➔ ["/abc/"]
162
+ *
163
+ * dedupeArray([new Map(), new Set(), new Error("err")], {
164
+ * forceToString: "all"
165
+ * });
166
+ * // ➔ ["[object Map]", "[object Set]", "Error: err"]
167
+ *
168
+ * dedupeArray([Promise.resolve(1), Promise.resolve(1)], {
169
+ * forceToString: "all"
170
+ * });
171
+ * // ➔ ["[object Promise]"]
172
+ *
173
+ * dedupeArray([{ a: 1 }, { a: 1 }, { a: 2 }], {
174
+ * forceToString: "primitives"
175
+ * });
176
+ * // ➔ [{ a: "1" }, { a: "2" }]
177
+ *
178
+ * dedupeArray([{ a: { b: 1 } }, { a: { b: 1 } }], {
179
+ * forceToString: "all"
180
+ * });
181
+ * // ➔ [{ a: { b: "1" } }]
182
+ *
183
+ * dedupeArray("not an array");
184
+ * // Throws TypeError
185
+ *
186
+ * dedupeArray([1, 2, 3], {
187
+ * forceToString: "invalid"
188
+ * });
189
+ * // Throws TypeError
190
+ * ```
191
+ */
192
+ declare const dedupeArray:<ForceToString extends ForceToStringOptions=false,Flattening extends boolean=false>(inputArray:unknown[],options?:DedupeArrayOptions<ForceToString,Flattening>)=>DedupeResult<ForceToString,Flattening>;type NormalizeInputToNumberArrayUnRecursive<T>=T extends string|bigint|boolean|number|Nullish?T:HasNonNumberLikeNonNullish<T>;
193
+ /**
194
+ * Detects whether `T` contains any number-like type (`string | number | bigint`).
195
+ *
196
+ * @template T Input type.
197
+ * @returns `true` if `T` contains number-like, otherwise `false`.
198
+ */
199
+ type HasNumberLike<T>=[Extract<T,string|bigint|number>] extends [never]?false:true;
200
+ /**
201
+ * Detects whether `T` contains a string type.
202
+ *
203
+ * - Useful for identifying values that may fail parsing to number (`undefined` when `R=false`).
204
+ *
205
+ * @template T Input type.
206
+ * @returns `true` if `T` contains `string`, otherwise `false`.
207
+ */
208
+ type HasString<T>=[Extract<T,string>] extends [never]?false:true;
209
+ /**
210
+ * Detects whether `T` contains non-number-like, non-nullish values
211
+ * (objects, arrays, symbols, functions, etc.).
212
+ *
213
+ * @template T Input type.
214
+ * @returns `true` if such types exist, otherwise `false`.
215
+ */
216
+ type HasNonNumberLikeNonNullish<T>=[ Exclude<T,string|bigint|number|Nullish>] extends [never]?false:true;
217
+ /**
218
+ * Computes the return type of `toNumberArrayUnRecursive` based on input type `T` and option `R`.
219
+ *
220
+ * @template T Input element type.
221
+ * @template R Flag indicating whether invalid values should be removed (`true`) or kept (`false`).
222
+ *
223
+ * Behavior:
224
+ *
225
+ * - If `R = true` (`removeInvalidValueNumber: true`):
226
+ * - If `T` is only `null | undefined` → returns `[]`.
227
+ * - If `T` contains number-like (`string | number | bigint`) → returns `number[]`.
228
+ * - Otherwise → returns `[]`.
229
+ *
230
+ * - If `R = false` (`removeInvalidValueNumber: false`):
231
+ * - Preserves `null[]` or `undefined[]` if input is purely nullish.
232
+ * - Otherwise returns an array of:
233
+ * - `number` if `T` includes number-like.
234
+ * - `undefined` if parsing fails (string or invalid non-number-like).
235
+ * - Original `null` / `undefined` from input.
236
+ */
237
+ type ToNumberArrayUnRecursiveReturn<T,R extends boolean>=R extends true?[ Exclude<T,null|undefined>] extends [never]?[]:HasNumberLike<T>extends true?number[]:[]:[ Exclude<T,null>] extends [never]?null[]:[Exclude<T,undefined>] extends [never]?undefined[]:Array<(HasNumberLike<T>extends true?number:never)|(HasString<T>extends true?undefined:never)|(HasNonNumberLikeNonNullish<T>extends true?undefined:never)|KeepNull<T>|KeepUndef<T>>;
238
+ /**
239
+ * Options object for `toNumberArrayUnRecursive`.
240
+ *
241
+ * @template T Flag indicating whether invalid values should be removed.
242
+ */
243
+ type ToNumberArrayUnRecursiveOptions<T extends boolean>={
244
+ /**
245
+ * If true, removes invalid number values (`NaN`, non-numeric strings, `null`, `undefined`) from the result, defaultValue: `true`.
246
+ *
247
+ * @default true
248
+ */
249
+ removeInvalidValueNumber?:T;};
250
+ /** -------------------------------------------------------
251
+ * * ***Converts a flat array of strings, numbers, nulls, or undefineds into numbers.***
252
+ * -------------------------------------------------------
253
+ *
254
+ * - Only supports **flat arrays** (non-recursive).
255
+ * - Valid inputs: `string`, `number`, `null`, `undefined`.
256
+ * - `BigInt` will be converted to `number`.
257
+ * - Other values → coerced into `undefined`.
258
+ * - Invalid values can be **removed** (`removeInvalidValueNumber: true`) or **kept** (`false`).
259
+ * -------------------------------------------------------
260
+ * * **⚠️ Note:** _For recursive / nested arrays, use `toNumberDeep` instead._
261
+ * -------------------------------------------------------
262
+ *
263
+ * @template T Element type of the input array.
264
+ * @template RemoveInvalidValue Whether invalid values should be removed (`true`) or kept (`false`).
265
+ *
266
+ * @param {Array<T> | readonly T[] | null | undefined} [array]
267
+ * The array to convert. Returns `undefined` if not an array.
268
+ *
269
+ * @param {ToNumberArrayUnRecursiveOptions<RemoveInvalidValue>} [options]
270
+ * Options controlling conversion behavior. Defaults to `{ removeInvalidValueNumber: true }`.
271
+ *
272
+ * @returns {ToNumberArrayUnRecursiveReturn<NormalizeInput<T>, RemoveInvalidValue>}
273
+ *
274
+ * @example
275
+ * ```ts
276
+ * toNumberArrayUnRecursive(['1', 2, '3']);
277
+ * // ➔ [1, 2, 3]
278
+ *
279
+ * toNumberArrayUnRecursive([1, null, undefined, 'abc']);
280
+ * // ➔ [1]
281
+ *
282
+ * toNumberArrayUnRecursive(['1', null, undefined, 'abc'], {
283
+ * removeInvalidValueNumber: false
284
+ * });
285
+ * // ➔ [1, null, undefined, undefined]
286
+ *
287
+ * toNumberArrayUnRecursive(null); // ➔ undefined
288
+ * toNumberArrayUnRecursive(undefined); // ➔ undefined
289
+ * toNumberArrayUnRecursive(1); // ➔ undefined
290
+ * ```
291
+ */
292
+ declare function toNumberArrayUnRecursive(array?:null|undefined,options?:ToNumberArrayUnRecursiveOptions<boolean>):undefined;declare function toNumberArrayUnRecursive(array?:Array<never>,options?:ToNumberArrayUnRecursiveOptions<boolean>):[];declare function toNumberArrayUnRecursive<T,R extends boolean=true>(array?:Array<T>|readonly T[]|null,options?:ToNumberArrayUnRecursiveOptions<R>):ToNumberArrayUnRecursiveReturn<NormalizeInputToNumberArrayUnRecursive<T>,R>;declare function toNumberArrayUnRecursive<T=unknown>(array?:T,options?:ToNumberArrayUnRecursiveOptions<boolean>):undefined;
293
+ /**
294
+ * Union of primitive types that can be safely converted to string.
295
+ */
296
+ type AllowedToString=string|number|boolean|bigint;
297
+ /**
298
+ * Checks whether `T` contains any type that is allowed for conversion to string.
299
+ *
300
+ * - Returns `true` if `T` contains `string`, `number`, `boolean`, or `bigint`.
301
+ * - Otherwise returns `false`.
302
+ *
303
+ * @template T Input type to check.
304
+ */
305
+ type HasAllowed<T>=[Extract<T,AllowedToString>] extends [never]?false:true;
306
+ /**
307
+ * Checks whether `T` contains any non-nullish value that is disallowed for conversion.
308
+ *
309
+ * - Disallowed non-nullish types include objects, arrays, symbols, functions, etc.
310
+ * - Returns `true` if such types exist, otherwise `false`.
311
+ *
312
+ * @template T Input type to check.
313
+ */
314
+ type HasDisallowedNonNullish<T>=[Exclude<T,AllowedToString|Nullish>] extends [never]?false:true;
315
+ /**
316
+ * Computes the resulting type of `toStringArrayUnRecursive` based on input type `T` and option `R`.
317
+ *
318
+ * @template T Input element type.
319
+ * @template R Flag indicating whether invalid values should be removed (`true`) or kept (`false`).
320
+ *
321
+ * - If `R = true` (`removeInvalidValue = true`):
322
+ * - If `T` contains any allowed values → `string[]`.
323
+ * - If `T` contains only nullish or disallowed types → `[]`.
324
+ *
325
+ * - If `R = false` (`removeInvalidValue = false`):
326
+ * - Include `string` if `T` has allowed values.
327
+ * - Include `undefined` if `T` has disallowed non-nullish values.
328
+ * - Preserve `null` and `undefined` from original `T`.
329
+ */
330
+ type ToStringArrayUnRecursiveReturn<T,R extends boolean>=R extends true?HasAllowed<T>extends true?string[]:[]:Array<(HasAllowed<T>extends true?string:never)|(HasDisallowedNonNullish<T>extends true?undefined:never)|KeepNull<T>|KeepUndef<T>>;
331
+ /**
332
+ * Options object for `toStringArrayUnRecursive`.
333
+ *
334
+ * @template T Flag indicating whether invalid values should be removed.
335
+ */
336
+ type ToStringArrayUnRecursiveOptions<T extends boolean>={
337
+ /**
338
+ * If true, removes invalid values (`null` and `undefined`) from the output, defaultValue: `true`.
339
+ *
340
+ * @default true
341
+ */
342
+ removeInvalidValue?:T;};
343
+ /** ---------------------------------------------
344
+ * * ***Converts all values in a flat array into string representations.***
345
+ * ---------------------------------------------
346
+ *
347
+ * - Only processes **flat arrays** (non-recursive).
348
+ * - Supports input values: `string`, `number`, `bigint`, `boolean`, `null`, `undefined`.
349
+ * - Invalid values (`null` and `undefined`) can be **removed** or **kept** depending on the option.
350
+ * - Other unsupported types will be converted to `undefined` (and removed if `removeInvalidValue=true`).
351
+ * ---------------------------------------------
352
+ * * **⚠️ Note:** _For recursive / nested arrays, use `toStringDeep` instead._
353
+ * ---------------------------------------------
354
+ *
355
+ * @template RemoveInvalidValue
356
+ * @param {Array<string | number | bigint | boolean | null | undefined> | null | undefined} [array]
357
+ * The flat array to transform. Returns `undefined` if not an array.
358
+ *
359
+ * @param {ToStringArrayUnRecursiveOptions<RemoveInvalidValue>} [options]
360
+ * Options object to control transformation behavior.
361
+ *
362
+ * @param {RemoveInvalidValue extends true ? boolean : boolean} [options.removeInvalidValue=true]
363
+ * Whether to remove invalid values (`null`, `undefined`, or unsupported types). Default: `true`.
364
+ *
365
+ * @returns {RemoveInvalidValue extends true
366
+ * ? string[]
367
+ * : (string | null | undefined)[]}
368
+ * A new array of string representations, with invalid values optionally removed.
369
+ *
370
+ * @example
371
+ * ```ts
372
+ * // Convert numbers and strings
373
+ * toStringArrayUnRecursive([1, 2, '3']);
374
+ * // ➔ ['1', '2', '3']
375
+ *
376
+ * // Remove null and undefined
377
+ * toStringArrayUnRecursive([1, null, undefined, 'abc'], {
378
+ * removeInvalidValue: true
379
+ * });
380
+ * // ➔ ['1', 'abc']
381
+ *
382
+ * // Keep null and undefined
383
+ * toStringArrayUnRecursive([1, null, undefined, 'abc'], {
384
+ * removeInvalidValue: false
385
+ * });
386
+ * // ➔ ['1', null, undefined, 'abc']
387
+ *
388
+ * // Convert boolean and bigint
389
+ * toStringArrayUnRecursive([true, false, 10n]);
390
+ * // ➔ ['true', 'false', '10']
391
+ *
392
+ * // Not an array → returns undefined
393
+ * toStringArrayUnRecursive(null);
394
+ * // ➔ undefined
395
+ *
396
+ * toStringArrayUnRecursive(undefined);
397
+ * // ➔ undefined
398
+ *
399
+ * toStringArrayUnRecursive(1);
400
+ * // ➔ undefined
401
+ *
402
+ * toStringArrayUnRecursive("string");
403
+ * // ➔ undefined
404
+ * ```
405
+ */
406
+ declare function toStringArrayUnRecursive(array?:undefined|null,options?:ToStringArrayUnRecursiveOptions<boolean>):undefined;declare function toStringArrayUnRecursive(array?:Array<never>,options?:ToStringArrayUnRecursiveOptions<boolean>):[];declare function toStringArrayUnRecursive<T,R extends boolean=true>(array?:Array<T>|readonly T[]|null,options?:ToStringArrayUnRecursiveOptions<R>):ToStringArrayUnRecursiveReturn<T,R>;declare function toStringArrayUnRecursive<T=unknown>(array?:T,options?:ToStringArrayUnRecursiveOptions<boolean>):undefined;
407
+ /** ---------------------------------
408
+ * * ***Converts a given value into a boolean (strict).***
409
+ * ---------------------------------
410
+ *
411
+ * This is stricter than normal JS coercion:
412
+ * - `null` and `undefined` return `false`.
413
+ * - Empty strings return `false`, non-empty strings return `true`.
414
+ * - Numbers: `0` is `false`, others `true`.
415
+ * - Booleans returned as-is.
416
+ * - Arrays: `[]` is `false`, non-empty is `true`.
417
+ * - Objects: `{}` is `false`, object with keys is `true`.
418
+ *
419
+ * @param {unknown} [value] - The value to be converted.
420
+ * @returns {boolean} `true` if the value is considered non-empty, otherwise `false`.
421
+ *
422
+ * @example
423
+ * toBooleanContent(null); // ➔ false
424
+ * toBooleanContent(""); // ➔ false
425
+ * toBooleanContent(" "); // ➔ false
426
+ * toBooleanContent(" asd "); // ➔ true
427
+ * toBooleanContent("abc"); // ➔ true
428
+ * toBooleanContent(0); // ➔ false
429
+ * toBooleanContent(42); // ➔ true
430
+ * toBooleanContent(NaN); // ➔ true
431
+ * toBooleanContent([]); // ➔ false
432
+ * toBooleanContent([1]); // ➔ true
433
+ * toBooleanContent({}); // ➔ false
434
+ * toBooleanContent({ a: 1 }); // ➔ true
435
+ * toBooleanContent({[Symbol("key")]: 123}); // ➔ false
436
+ */
437
+ declare const toBooleanContent:(value?:unknown)=>boolean;
438
+ /** -------------------------------------------------
439
+ * * ***Recursively checks if value is "non-empty".***
440
+ * -------------------------------------------------
441
+ *
442
+ * This function does a deep inspection to determine if the input
443
+ * contains any meaningful / non-empty value. It is stricter than
444
+ * JavaScript's normal truthy checks because it looks *inside*
445
+ * nested arrays & objects.
446
+ *
447
+ * Rules:
448
+ * - `null` and `undefined` return `false`
449
+ * - Empty strings `""` return `false`
450
+ * - `0` returns `false`
451
+ * - Empty arrays `[]` or empty objects `{}` return `false`
452
+ * - Checks deeply nested arrays/objects — if any value inside is "non-empty", returns `true`
453
+ *
454
+ * @param {unknown} [value] - The value to check.
455
+ * @returns {boolean} `true` if the value or anything nested inside is non-empty, otherwise `false`.
456
+ *
457
+ * @example
458
+ * toBooleanContentDeep(null); // ➔ false
459
+ * toBooleanContentDeep(""); // ➔ false
460
+ * toBooleanContentDeep(0); // ➔ false
461
+ * toBooleanContentDeep([]); // ➔ false
462
+ * toBooleanContentDeep({}); // ➔ false
463
+ * toBooleanContentDeep([[], {}]); // ➔ false
464
+ * toBooleanContentDeep("abc"); // ➔ true
465
+ * toBooleanContentDeep(42); // ➔ true
466
+ * toBooleanContentDeep(NaN); // ➔ true
467
+ * toBooleanContentDeep([0, "", 5]); // ➔ true
468
+ * toBooleanContentDeep([NaN, "", 0]); // ➔ true
469
+ * toBooleanContentDeep([0, "", null]); // ➔ false
470
+ * toBooleanContentDeep({ a: 0 }); // ➔ false
471
+ * toBooleanContentDeep({ a: 1 }); // ➔ true
472
+ * toBooleanContentDeep({ a: { b: [] }}); // ➔ false
473
+ * toBooleanContentDeep({ a: { b: "x" }}); // ➔ true
474
+ * toBooleanContentDeep({[Symbol("key")]: 123}); // ➔false
475
+ */
476
+ declare const toBooleanContentDeep:(value?:unknown)=>boolean;type ToBooleanExplicitOptions={
477
+ /** Whether string comparison ignores case, _defaultValue: `false`_.
478
+ *
479
+ * @default false
480
+ */
481
+ caseInsensitive?:boolean;
482
+ /** Whether to trim whitespace before comparison, _defaultValue: `true`_.
483
+ *
484
+ * @default true
485
+ */
486
+ trimString?:boolean;
487
+ /** Whether to consider the string `"indeterminate"` as `true`, _defaultValue: `false`_.
488
+ *
489
+ * @default false
490
+ */
491
+ includeIndeterminate?:boolean;};
492
+ /** ---------------------------------
493
+ * * ***Converts a value into a strict boolean.***
494
+ * ---------------------------------
495
+ *
496
+ * It supports various common string representations of truthy values,
497
+ * including `"true"`, `"on"`, `"yes"`, `"1"`, the number `1`, the boolean `true`,
498
+ * and optionally the string `"indeterminate"` if enabled.
499
+ *
500
+ * Any other value, including `undefined`, `null`, `false`, `0`, and
501
+ * unrecognized strings will return `false`.
502
+ *
503
+ * Supports optional `caseInsensitive` and `trimString` to customize string normalization.
504
+ *
505
+ * @param {unknown} [value] - The value to convert.
506
+ * @param {Object} [options] - Options for conversion behavior.
507
+ * @param {boolean} [options.caseInsensitive=false] - Whether string comparison ignores case. Default: `false`.
508
+ * @param {boolean} [options.trimString=true] - Whether to trim whitespace before comparison. Default: `true`.
509
+ * @param {boolean} [options.includeIndeterminate=false] - If `true`, the string `"indeterminate"` is considered a truthy value. Defaults to `false`.
510
+ * @returns {boolean} `true` if the value matches a truthy representation, otherwise `false`.
511
+ * @throws {TypeError} Throws if any option provided is not a boolean.
512
+ *
513
+ * @example
514
+ *
515
+ * toBooleanExplicit(1);
516
+ * // ➔ true
517
+ *
518
+ * toBooleanExplicit(true);
519
+ * // ➔ true
520
+ *
521
+ * toBooleanExplicit("on");
522
+ * // ➔ true
523
+ *
524
+ * toBooleanExplicit("1");
525
+ * // ➔ true
526
+ *
527
+ * toBooleanExplicit(0);
528
+ * // ➔ false
529
+ *
530
+ * toBooleanExplicit("off");
531
+ * // ➔ false
532
+ *
533
+ * toBooleanExplicit("Yes");
534
+ * // ➔ false (caseInsensitive is false by default)
535
+ *
536
+ * toBooleanExplicit(" yes ");
537
+ * // ➔ true (whitespace trimmed by default)
538
+ *
539
+ * toBooleanExplicit("YES", { caseInsensitive: true });
540
+ * // ➔ true
541
+ *
542
+ * toBooleanExplicit("YES", { caseInsensitive: false });
543
+ * // ➔ false
544
+ *
545
+ * toBooleanExplicit(" YES ", { trimString: false });
546
+ * // ➔ false (whitespace not trimmed)
547
+ *
548
+ * toBooleanExplicit(" YES ", { trimString: true, caseInsensitive: true });
549
+ * // ➔ true
550
+ *
551
+ * toBooleanExplicit(" YES ", { trimString: true, caseInsensitive: false });
552
+ * // ➔ false
553
+ *
554
+ * toBooleanExplicit("indeterminate");
555
+ * // ➔ false (default)
556
+ *
557
+ * toBooleanExplicit("indeterminate", { includeIndeterminate: true });
558
+ * // ➔ true
559
+ */
560
+ declare const toBooleanExplicit:(value?:unknown,options?:ToBooleanExplicitOptions)=>boolean;
561
+ /** ---------------------------------
562
+ * * ***Converts a given value into a boolean (loose).***
563
+ * ---------------------------------
564
+ *
565
+ * This follows JavaScript's typical truthy/falsy rules with some tweaks:
566
+ * - `null` and `undefined` return `false`.
567
+ * - Empty strings return `false`, non-empty strings return `true`.
568
+ * - Numbers: `0` is `false`, others `true`.
569
+ * - Booleans returned as-is.
570
+ * - Arrays: `[]` is `false`, non-empty is `true`.
571
+ * - Other objects: uses `Boolean(value)`, so `{}` is `true`.
572
+ *
573
+ * @param {unknown} [value] - The value to be converted.
574
+ * @returns {boolean} `true` if the value is truthy, otherwise `false`.
575
+ *
576
+ * @example
577
+ * toBooleanLoose(null); // ➔ false
578
+ * toBooleanLoose(""); // ➔ false
579
+ * toBooleanLoose("abc"); // ➔ true
580
+ * toBooleanLoose(0); // ➔ false
581
+ * toBooleanLoose(42); // ➔ true
582
+ * toBooleanLoose([]); // ➔ false
583
+ * toBooleanLoose([1]); // ➔ true
584
+ * toBooleanLoose({}); // ➔ true
585
+ * toBooleanLoose({ a: 1 }); // ➔ true
586
+ */
587
+ declare const toBooleanLoose:(value?:unknown)=>boolean;
588
+ /** -------------------------------------------------------------
589
+ * * ***Parses a human-friendly currency string into a JavaScript number.***
590
+ * -------------------------------------------------------------
591
+ *
592
+ * - Supports multi-locale formats:
593
+ * - US: `"15,000.10"` ➔ `15300.10`
594
+ * - Swiss: `"15'000.10"` ➔ `15300.10`
595
+ * - French: `"15 000,10"` ➔ `15300.10`
596
+ * - Indian: `"1,23,456.78"` ➔ `123456.78`
597
+ * - European: `"151.000,10"` ➔ `151300.10`
598
+ * - Compact: `"15300000,10"` ➔ `15300000.10`
599
+ *
600
+ * - Features:
601
+ * - Strips symbols automatically: `"Rp"`, `"$"`, `"EUR"`, etc.
602
+ * - Handles bracket negatives: `"(15.000,10)"` ➔ `-15300.10`
603
+ * - Normalizes decimal separator (last dot or comma).
604
+ * - Detects non-breaking spaces (`\u00A0`, `\u202F`) often in European data.
605
+ * - Fallback to `0` for empty, invalid, or non-numeric strings.
606
+ *
607
+ * - #### How it parses internally:
608
+ * 1. Removes all characters except digits, `.`, `,`, `'`, `space`, `\u00A0`, `\u202F`.
609
+ * 2. Detects bracket (...) as negative.
610
+ * 3. If Indian style (`1,23,456`) detected by multiple ,\d{2}, removes all commas.
611
+ * 4. Otherwise:
612
+ * - If multiple dots & no commas ➔ thousands: removes all `.`.
613
+ * - If multiple commas & no dots ➔ thousands: removes all `,`.
614
+ * - If mixed, treats last `,` or `.` as decimal.
615
+ * 5. Converts final decimal to `.` for JS float.
616
+ *
617
+ * - Gotchas:
618
+ * - If both `.` and `,` are present, last occurrence is used as decimal.
619
+ * - For strings like `"1.121.234,56"` ➔ decimal is `,`.
620
+ * - For `"1,121,234.56"` ➔ decimal is `.`.
621
+ * - For `"15300000,2121"` ➔ decimal becomes `.` internally.
622
+ *
623
+ * @param {string} input Any messy currency string, may contain:
624
+ * - currency symbols (`Rp`,`$`, `CHF`, `EUR`)
625
+ *
626
+ * - thousands separators (`.`, `,`, `'`, `space`, `\u00A0`, `\u202F`)
627
+ * - various decimal formats (`,` or `.`)
628
+ * - bracket negative: `"(15.000,10)"`
629
+ *
630
+ * @returns {number}
631
+ * JavaScript float representation.
632
+ * Will return `0` for invalid, empty, or non-string input.
633
+ *
634
+ * ***⚠️ Notes:***
635
+ * - You can use this function as a first step to **sanitize currency inputs**
636
+ * before storing into database or doing math.
637
+ * - Always pair this with your formatter for consistent output display.
638
+ *
639
+ * @example
640
+ * ```ts
641
+ * parseCurrencyString("Rp 15.300.000,21");
642
+ * // ➔ 15300000.21
643
+ *
644
+ * parseCurrencyString("15 300 000,21");
645
+ * // ➔ 15300000.21
646
+ *
647
+ * parseCurrencyString("CHF 15'300'000.21");
648
+ * // ➔ 15300000.21
649
+ *
650
+ * parseCurrencyString("$15,300,000.21");
651
+ * // ➔ 15300000.21
652
+ *
653
+ * parseCurrencyString("(15.000,10)");
654
+ * // ➔ -15000.10
655
+ *
656
+ * parseCurrencyString("1,23,456.78");
657
+ * // ➔ 123456.78
658
+ *
659
+ * parseCurrencyString("15300000,2121");
660
+ * // ➔ 15300000.2121
661
+ *
662
+ * parseCurrencyString("USD 15 300 000.21");
663
+ * // ➔ 15300000.21
664
+ *
665
+ * parseCurrencyString("");
666
+ * // ➔ 0
667
+ *
668
+ * parseCurrencyString("abc");
669
+ * // ➔ 0
670
+ * ```
671
+ */
672
+ declare const parseCurrencyString:(input?:string|null)=>number;
673
+ /** ----------------------------------------------------------
674
+ * * ***Converts a value from a string to its corresponding JavaScript primitive type.***
675
+ * ----------------------------------------------------------
676
+ *
677
+ * - Supported conversions for string inputs (case-insensitive, trimmed):
678
+ * - `"true"` ➔ `true` (***boolean***).
679
+ * - `"false"` ➔ `false` (***boolean***).
680
+ * - `"null"` ➔ `null`.
681
+ * - `"yes"` ➔ `true` (***boolean***).
682
+ * - `"no"` ➔ `false` (***boolean***).
683
+ * - `"nan"` ➔ `NaN` (***number***).
684
+ * - `"undefined"` ➔ `undefined`.
685
+ *
686
+ * - Numeric strings with optional thousands separators (e.g. `"3,567,890.14"`) ➔ ***`number`***.
687
+ * - Strings containing only whitespace are converted to empty string `""`.
688
+ *
689
+ * - Non-string inputs are returned unchanged.
690
+ * - Strings not matching any special case are trimmed and returned as-is.
691
+ *
692
+ * @param {unknown} value - The value to convert, usually a string or other type.
693
+ * @returns {unknown} The converted JavaScript primitive (***`boolean`***, ***`number`***, ***`null`***, ***`undefined`***, ***`NaN`***) or the original value if no conversion applies.
694
+ *
695
+ * @example
696
+ * convertType("true") // ➔ true
697
+ * convertType(" 42 ") // ➔ 42
698
+ * convertType("FALSE") // ➔ false
699
+ * convertType(" null ") // ➔ null
700
+ * convertType(" ") // ➔ ""
701
+ * convertType(" Hello World ") // ➔ "Hello World"
702
+ * convertType("NaN") // ➔ NaN
703
+ * convertType(100) // ➔ 100
704
+ * convertType(NaN) // ➔ NaN
705
+ * convertType({}) // ➔ {}
706
+ */
707
+ declare const convertType:(value:unknown)=>unknown;type NonJsonParsableType=Omit<Exclude<unknown,string|null|undefined>,string>;type Contains<T,U>=[Extract<T,U>] extends [never]?false:true;type UnknownValue={undefined:true;};type SafeJsonParseResult<TData,T>=IfNotExtends<T,NonJsonParsableType>extends true?T extends never?undefined:T extends void?undefined:T extends number?undefined:Contains<T,string>extends true?Contains<T,null & string>extends true?TData|null|undefined:TData|undefined:IfExtends<T,null>extends true?null:IfNotExtends<T,NonJsonParsableType>extends true?TData|null|undefined:undefined:Contains<T,string>extends true?IsAny<T>extends true?TData|undefined|null:TData|undefined:undefined;
708
+ /** --------------------------------------------------
709
+ * * ***Options for cleaning and transforming parsed JSON data.***
710
+ * --------------------------------------------------
711
+ */
712
+ type ParseParsedDataOptions={
713
+ /** Convert numeric strings to numbers (e.g., `"42"` ➔ `42`), defaultValue: `false`.
714
+ *
715
+ * @default false
716
+ */
717
+ convertNumbers?:boolean;
718
+ /** Convert numeric strings "NaN" to NaN (e.g., `"NaN"` ➔ `NaN`), defaultValue: `false`.
719
+ *
720
+ * @default false
721
+ */
722
+ convertNaN?:boolean;
723
+ /** Convert `"true"` / `"false"` strings to boolean values, defaultValue: `false`.
724
+ *
725
+ * @default false
726
+ */
727
+ convertBooleans?:boolean;
728
+ /** Convert valid date strings into `Date` objects, defaultValue: `false`.
729
+ *
730
+ * @default false
731
+ */
732
+ convertDates?:boolean;
733
+ /** Custom date formats to be parsed (e.g., `["DD/MM/YYYY", "MM/DD/YYYY"]`), defaultValue: `[]`.
734
+ *
735
+ * @default []
736
+ */
737
+ customDateFormats?:string[];
738
+ /** Remove `null` values from objects and arrays, defaultValue: `false`.
739
+ *
740
+ * @default false
741
+ */
742
+ removeNulls?:boolean;
743
+ /** Remove `undefined` values from objects and arrays, defaultValue: `false`.
744
+ *
745
+ * - `false` (default): replaces `undefined` with `null`
746
+ * - `true`: removes keys with `undefined` values
747
+ *
748
+ * @default false
749
+ */
750
+ removeUndefined?:boolean;
751
+ /** Remove empty objects `{}` from the final output, defaultValue: `false`.
752
+ *
753
+ * @default false
754
+ */
755
+ removeEmptyObjects?:boolean;
756
+ /** Remove empty arrays `[]` from the final output, defaultValue: `false`.
757
+ *
758
+ * @default false
759
+ */
760
+ removeEmptyArrays?:boolean;
761
+ /** Strict mode: Removes values that do not match selected conversions, defaultValue: `false`.
762
+ *
763
+ * @default false
764
+ */
765
+ strictMode?:boolean;
766
+ /** Enable error logging if JSON parsing fails, defaultValue: `false`.
767
+ *
768
+ * @default false
769
+ */
770
+ loggingOnFail?:boolean;
771
+ /** Custom error handler function.
772
+ *
773
+ * - If provided, it will be called with the error.
774
+ *
775
+ * - If not provided, defaults to `undefined` in type, but internally a no-op function is used.
776
+ *
777
+ * @default undefined
778
+ */
779
+ onError?:(error:Error)=>void;
780
+ /**
781
+ * Whether to check symbol properties when checking empty objects.
782
+ * @default false
783
+ */
784
+ checkSymbols?:boolean;};
785
+ /** --------------------------------------------------
786
+ * * ***Cleans parsed JSON data based on provided options.***
787
+ * --------------------------------------------------
788
+ *
789
+ * @template T - Expected output type.
790
+ * @param {unknown} data - The parsed JSON data.
791
+ * @param {ParseParsedDataOptions} options - Cleaning options.
792
+ * @returns {T | undefined}-The cleaned data.
793
+ *
794
+ * ***⚠️ Notice:*** _If data is JSON string, we recommend use **`safeJsonParse`** for more safe._
795
+ *
796
+ * ***⚠️ Note:*** _If using `convertDates`, result may contain Date objects. You may need type assertions in strict TypeScript settings._
797
+ *
798
+ * @example
799
+ * ```ts
800
+ * // Convert numbers and remove nulls
801
+ * const result = cleanParsedData({ age: "25", name: null }, {
802
+ * convertNumbers: true,
803
+ * removeNulls: true
804
+ * });
805
+ * console.log(result); // ➔ { age: 25 }
806
+ *
807
+ * // Convert boolean strings
808
+ * const result = cleanParsedData({ isActive: "true" }, {
809
+ * convertBooleans: true
810
+ * });
811
+ * console.log(result); // ➔ { isActive: true }
812
+ * ```
813
+ */
814
+ declare const cleanParsedData:<T=unknown>(data:T,options?:ParseParsedDataOptions)=>T|undefined|null;
815
+ /** --------------------------------------------------
816
+ * * ***Parses custom date formats like "DD/MM/YYYY" or "MM/DD/YYYY".***
817
+ * --------------------------------------------------
818
+ *
819
+ * @param {string} dateString - Date string to parse.
820
+ * @param {string} format - Date format to match.
821
+ * @returns {Date | null} - Returns a Date object if valid, otherwise null.
822
+ */
823
+ declare const parseCustomDate:(dateString:string,format:string)=>Date|null;
824
+ /** --------------------------------------------------
825
+ * * ***Safely parses JSON while handling errors and applying transformations.***
826
+ * --------------------------------------------------
827
+ *
828
+ * - ✅ **Supports generics** to ensure accurate return type inference.
829
+ * - Always provide both `<TData, TInput>` for best results.
830
+ * - ***Scroll down for full generic behavior explanation.***
831
+ * - ✅ Automatically parses valid JSON strings into `objects`, `arrays`, `numbers`, etc.
832
+ * - ✅ Supports data transformation via options (e.g., convert strings to `numbers`, `booleans`, or `dates`).
833
+ * - ✅ Returns:
834
+ * 1. `null` ➔ if input is explicitly `null`.
835
+ * 2. `undefined` ➔ if input is `undefined`, not a `string`, or if parsing fails.
836
+ * 3. Parsed and cleaned result (`TData`) ➔ if input is a valid JSON string.
837
+ *
838
+ * ⚠️ **JSON.stringify note**: _If the input JSON string was created using `JSON.stringify()`, any properties with
839
+ * `undefined` values would have been automatically removed or converted to `null` depending on the serializer, example:_
840
+ * ```ts
841
+ * JSON.stringify({ a: undefined, b: 1 }); // ➔ '{"b":1}'
842
+ * JSON.parse('{"a": undefined, "b": 1}') // ❌ invalid JSON
843
+ * ```
844
+ * _Therefore, if you see `undefined` in raw input, it will likely throw unless pre-cleaned or replaced with `null`._
845
+ *
846
+ * ```ts
847
+ * safeJsonParse('{"name": "John", "score": undefined}');
848
+ * // result ➔ { name: "John", score: null } <- because `undefined` is not valid JSON, gets replaced to null.
849
+ * ```
850
+ *
851
+ * ℹ️ **Additionally,** this function normalizes single quotes (`'`) to double quotes (`"`) before parsing,
852
+ * so JSON strings using single quotes will be converted to valid JSON format, example:
853
+ * ```ts
854
+ * safeJsonParse("{'name': 'John', 'age': 30}");
855
+ * // result ➔ { name: "John", age: 30 }
856
+ *
857
+ * safeJsonParse("{'string\\'s': 'abc', \"quote's\": 'It\\'s awesome!', 'aNumber\\'s': 123, 'keyWith\\'Backslash\\'s': 'value\\'s'}");
858
+ * // result ➔ { "string's": "abc", "quote's": "It's awesome!", "aNumber's": 123, "keyWith'Backslash's": "value's" }
859
+ * ```
860
+ * @template TData - The expected output type after parsing and cleaning.
861
+ * @template TInput - The input value type, used for advanced type inference and return typing.
862
+ *
863
+ * @param {TInput} [value] - The JSON string or value to parse.
864
+ * @param {ParseParsedDataOptions} [options] - Options to clean, convert types, enable strict mode,
865
+ * support custom date formats, enable logging, or handle errors via callback.
866
+ *
867
+ * @returns {SafeJsonParseResult<TData, TInput>} Parsed and optionally cleaned result, or `null`/`undefined`.
868
+ *
869
+ * @throws {TypeError} If `options` is provided but not a valid object.
870
+ *
871
+ * @example
872
+ * 1. ***Basic parse with number & boolean conversion:***
873
+ * ```ts
874
+ * const result = safeJsonParse(30);
875
+ * // result ➔ undefined
876
+ * const result = safeJsonParse(30, {
877
+ * convertNumbers: true
878
+ * });
879
+ * // result ➔ 30
880
+ *
881
+ * const result = safeJsonParse('{"age": "30", "isActive": "true"}', {
882
+ * convertNumbers: true,
883
+ * convertBooleans: true
884
+ * });
885
+ * // result ➔ { age: 30, isActive: true }
886
+ * ```
887
+ * 2. ***Handling `undefined` in input string (manually written, not JSON.stringify):***
888
+ * ```ts
889
+ * const result = safeJsonParse('{"score": undefined}');
890
+ * // result ➔ { score: null } <- because `undefined` is not valid JSON, gets replaced
891
+ * ```
892
+ *
893
+ * 3. ***Handling `NaN` in input string (manually written, not JSON.stringify):***
894
+ * ```ts
895
+ * const value = NaN; // <- value is NaN or "NaN";
896
+ * const result = safeJsonParse(value);
897
+ * // result ➔ undefined <- will return as undefined, because options `convertNaN` is false (default),
898
+ * const result2 = safeJsonParse(value, { convertNaN: true });
899
+ * // result2 ➔ NaN <- will return as undefined because options `convertNaN` is false,
900
+ *
901
+ * const result4 = safeJsonParse('{"strNan": "NaN", "pureNan": NaN}');
902
+ * // NaN will convert to string (NaN ➔ "NaN") because options `convertNaN` is false (default),
903
+ * // result4 ➔ { strNan: "NaN", pureNan: "NaN" }
904
+ *
905
+ * const result3 = safeJsonParse('{"strNan": "NaN", "pureNan": NaN}', {
906
+ * convertNaN: true
907
+ * });
908
+ * // String "NaN" will convert to NaN ("NaN" ➔ NaN) because options `convertNaN` is true,
909
+ * // result3 ➔ { strNan: NaN, pureNan: NaN }
910
+ * ```
911
+ *
912
+ * 4. ***Strict mode (removes invalid values):***
913
+ * ```ts
914
+ * const result = safeJsonParse('{"name": " ", "score": "99abc"}', {
915
+ * convertNumbers: true,
916
+ * strictMode: true
917
+ * });
918
+ * // result ➔ {}
919
+ *
920
+ * const result2 = safeJsonParse('{"name": " ", "score": undefined}');
921
+ * // result2 ➔ { name: "",score: null }
922
+ * ```
923
+ *
924
+ * 5. ***Custom date format parsing:***
925
+ * ```ts
926
+ * const result = safeJsonParse('{"birthday": "25/12/2000"}', {
927
+ * convertDates: true,
928
+ * customDateFormats: ["DD/MM/YYYY"]
929
+ * });
930
+ * // result ➔ { birthday: new Date("2000-12-25T00:00:00.000Z") }
931
+ * ```
932
+ *
933
+ * 6. ***Invalid JSON with custom error handling:***
934
+ * ```ts
935
+ * safeJsonParse("{invalid}", {
936
+ * loggingOnFail: true,
937
+ * onError: (err) => console.log("Custom handler:", err.message)
938
+ * });
939
+ * // ➔ Logs parsing error and invokes handler
940
+ * ```
941
+ *
942
+ * 7. ***Null or non-string input returns null/undefined (default options):***
943
+ * ```ts
944
+ * safeJsonParse(123); // ➔ undefined
945
+ * safeJsonParse(null); // ➔ null
946
+ * safeJsonParse(undefined); // ➔ undefined
947
+ * ```
948
+ *
949
+ * 8. ***Generic usage: Provide both output and input type to ensure correct return typing:***
950
+ * ```ts
951
+ * type UserType = { name: string };
952
+ *
953
+ * const obj = JSON.stringify({
954
+ * name: "John"
955
+ * });
956
+ *
957
+ * const toParse = isAuth() ? obj : null;
958
+ * const toParse2 = isAuth() ? obj : undefined;
959
+ *
960
+ * // * `Without Generic`:
961
+ * const parsed = safeJsonParse(toParse);
962
+ * //- runtime: { name: "John" } | undefined | null
963
+ * //- type: Record<string, unknown> | undefined | null
964
+ * const parsed2 = safeJsonParse(toParse);
965
+ * //- runtime: { name: "John" } | undefined
966
+ * //- type: Record<string, unknown> | undefined
967
+ *
968
+ * // * `With Generic`:
969
+ * const parsed = safeJsonParse<UserType>(toParse);
970
+ * //- runtime: { name: "John" } | undefined | null
971
+ * //- type: undefined <- (⚠️ unexpected!)
972
+ * const parsed2 = safeJsonParse<UserType>(toParse);
973
+ * //- runtime: { name: "John" } | undefined
974
+ * //- type: undefined <- (⚠️ unexpected!)
975
+ * const parsed = safeJsonParse<UserType, typeof toParse>(toParse);
976
+ * //- runtime: { name: "John" } | null | undefined
977
+ * //- type: UserType | null | undefined
978
+ * const parsed2 = safeJsonParse<UserType, typeof toParse>(toParse);
979
+ * //- runtime: { name: "John" } | undefined
980
+ * //- type: UserType | undefined
981
+ * ```
982
+ * @note
983
+ * ⚠️ **Generic Behavior:**
984
+ * - This function supports advanced generic inference for clean, type-safe return values.
985
+ * - If only the first generic (`TData`) is provided and the second (`TInput`) is omitted,
986
+ * then `TInput` defaults to `undefined`, resulting in a return type of `undefined`.
987
+ * - To ensure correct return typing, **always pass both generics** when `value` is dynamic,
988
+ * nullable, or unioned: `safeJsonParse<TData, typeof value>(value)`.
989
+ * - This makes the returned type exactly match your expectation: `TData | null | undefined`.
990
+ */
991
+ declare function safeJsonParse<TData extends Record<string,any>=Record<string,unknown>,TInput extends UnknownValue=UnknownValue>(value:TInput,options?:ParseParsedDataOptions):IsAny<TInput>extends true?TData|null|undefined:undefined;declare function safeJsonParse<TData extends Record<string,any>=Record<string,unknown>,TInput extends string|null|undefined|unknown=undefined>(value:TInput,options?:ParseParsedDataOptions):SafeJsonParseResult<TData,TInput>;
992
+ /** ----------------------------------------------------------
993
+ * * ***Extracts digits from a string or number input.***
994
+ * ----------------------------------------------------------
995
+ *
996
+ * Converts the input to a string, trims whitespace, and removes any characters
997
+ * that are not digits (`0-9`).
998
+ *
999
+ * Returns the cleaned numeric value as a `number`.
1000
+ *
1001
+ * If the input is a `null`, `undefined`, results in no digits, or not a `string` or `number`,
1002
+ * it safely returns `0`.
1003
+ *
1004
+ * @param {string | number | null | undefined} [value]
1005
+ * The value to process.
1006
+ * - Accepts a string, number, `null`, or `undefined`.
1007
+ *
1008
+ * @returns {number}
1009
+ * - The numeric value after extracting digits.
1010
+ * - Returns `0` if input is invalid or contains no digits.
1011
+ *
1012
+ * @example
1013
+ * extractDigits(12345); // ➔ 12345
1014
+ * extractDigits("9A8B7C6X1"); // ➔ 98761
1015
+ * extractDigits("123abc456"); // ➔ 123456
1016
+ * extractDigits("$1,234.56"); // ➔ 123456
1017
+ * extractDigits(NaN); // ➔ 0
1018
+ * extractDigits(null); // ➔ 0
1019
+ * extractDigits(undefined); // ➔ 0
1020
+ * extractDigits(Infinity); // ➔ 0
1021
+ * extractDigits(-Infinity); // ➔ 0
1022
+ * extractDigits({}); // ➔ 0
1023
+ * extractDigits([]); // ➔ 0
1024
+ * extractDigits("abc"); // ➔ 0
1025
+ * extractDigits(" 00a "); // ➔ 0
1026
+ */
1027
+ declare const extractDigits:(value:unknown)=>number;type Prev=[never,NumberRangeUnion<1,30>];type DotPath<T,Prefix extends string="",Depth extends number=NumberRangeUnion<1,30>>=Depth extends never?never:T extends(infer U)[]?U extends object?DotPath<U,`${Prefix}`,Prev[Depth]>:never:T extends object?{[K in Extract<keyof T,string>]:T[K] extends object?DotPath<T[K],`${Prefix}${K}.`,Prev[Depth]>|`${Prefix}${K}`:`${Prefix}${K}`;}[Extract<keyof T,string>]:never;type ConfigRemoveObjectPaths<T>={
1028
+ /**
1029
+ * The dot-notation path to the property that should be removed.
1030
+ * Can target deeply nested properties (e.g., `"left.data.sensitive"`).
1031
+ *
1032
+ * This is resolved relative to the root object `T`, and supports
1033
+ * any valid {@link DotPath} path within it.
1034
+ *
1035
+ * @type {DotPath<T>}
1036
+ *
1037
+ * @example
1038
+ * const obj = {
1039
+ * left: { data: { sensitive: "secret", id: 1 } },
1040
+ * right: { data: { debug: true, keep: "yes" } },
1041
+ * };
1042
+ *
1043
+ * // Removes "left.data.sensitive" and "right.data.debug"
1044
+ * const result = removeObjectPaths(obj, [
1045
+ * { key: "left.data.sensitive" },
1046
+ * { key: "right.data.debug" },
1047
+ * ]);
1048
+ * console.log(result);
1049
+ * // {
1050
+ * // left: { data: { id: 1 } },
1051
+ * // right: { data: { keep: "yes" } },
1052
+ * // };
1053
+ */
1054
+ key:DotPath<T>;
1055
+ /**
1056
+ * When `true`, removes the specified property from **all matching nested levels**,
1057
+ * including occurrences inside arrays. Defaults to `false` for single-level removal.
1058
+ *
1059
+ * Useful if the target property might appear multiple times across different
1060
+ * branches or array elements.
1061
+ *
1062
+ * @default false
1063
+ *
1064
+ * @example
1065
+ * const obj = {
1066
+ * items: [
1067
+ * { data: { sensitive: "one", keep: true } },
1068
+ * { data: { sensitive: "two", keep: true } },
1069
+ * { other: { sensitive: "other" } },
1070
+ * ]
1071
+ * };
1072
+ *
1073
+ * // Removes all "data.sensitive" occurrences inside items[]
1074
+ * const result = removeObjectPaths(obj, [{ key: "items.data.sensitive", deep: true }]);
1075
+ * console.log(result);
1076
+ * // {
1077
+ * // items: [
1078
+ * // { data: { keep: true } },
1079
+ * // { data: { keep: true } },
1080
+ * // { other: { sensitive: "other" } },
1081
+ * // ]
1082
+ * // };
1083
+ */
1084
+ deep?:boolean;};type KeysToRemove<T,K extends readonly ConfigRemoveObjectPaths<T>[]>=K[number] extends{key:infer Key;}?(Key extends string?Key:never):never;type RemoveNested<T,K extends string>=T extends Array<infer U>?RemoveNested<U,K>[]:T extends object?K extends`${infer Head}.${infer Rest}`?Head extends keyof T?{[P in keyof T]:P extends Head?RemoveNested<T[P],Rest>:T[P];}:T:SafeRemove<T,K>:T;type SafeRemove<T,K extends string>=K extends keyof T?Omit<T,K>:T;type ChangeNeverArrayToArrayDeep<T>=T extends never[]?[]:T extends Array<infer U>?ChangeNeverArrayToArrayDeep<U>[]:T extends object?{[K in keyof T]:ChangeNeverArrayToArrayDeep<T[K]>;}:T;type ResultRemoveObjectPaths<T,K extends readonly ConfigRemoveObjectPaths<T>[]>=Prettify<RemoveNested<ChangeNeverArrayToArrayDeep<T>,KeysToRemove<T,K>>,{recursive:true;}>extends never?T:Prettify<RemoveNested<ChangeNeverArrayToArrayDeep<T>,KeysToRemove<T,K>>,{recursive:true;}>;
1085
+ /** ------------------------------------------------------------------------
1086
+ * * ***Deletes multiple keys (shallow or deeply nested) from an object.***
1087
+ * ------------------------------------------------------------------------
1088
+ *
1089
+ * - Features:
1090
+ * - Removes one or more keys from an object based on their paths (supports dot notation for nested properties).
1091
+ * - Can delete deeply from all matching nested levels (even inside arrays) when `deep: true`.
1092
+ * - By default does **not mutate** the original object. Clones it first.
1093
+ * Set `deepClone = false` to mutate in place (useful for performance on large data).
1094
+ * - Ensures type safety on `key` paths via `DotPath<T>`, reducing accidental invalid paths.
1095
+ *
1096
+ * - Behavior:
1097
+ * - When `deep: false` (default), only deletes the direct property at the specified path.
1098
+ * - When `deep: true`, searches deeply and recursively deletes the key from all levels,
1099
+ * including inside arrays of objects (applies the *same* path repeatedly).
1100
+ * - Skips deletion if the specified path does not exist — no error is thrown.
1101
+ *
1102
+ * - Edge Handling:
1103
+ * - If `object` is `null` or not an object, returns an empty object.
1104
+ * - If `keysToDelete` is not an array of `{ key, deep? }` objects, throws a `TypeError`.
1105
+ * - Ignores invalid intermediate paths (will skip those branches without throwing).
1106
+ *
1107
+ * @template T - The shape of the input object, used for type-safe dot paths.
1108
+ *
1109
+ * @param {T} object - The object to remove keys from. Must be an object or will return `{}`.
1110
+ * @param {Array<{ key: DotPath<T>, deep?: boolean }>} keysToDelete
1111
+ * An array of instructions:
1112
+ * - `key`: A string path using dot notation (e.g. `"user.profile.name"`).
1113
+ * - `deep`: If `true`, will recursively remove all instances of the key path at any depth, defaultValue: `false`.
1114
+ * @param {boolean} [deepClone=true]
1115
+ * Whether to deep clone the original object before modifying.
1116
+ * - `true` (default): returns a *new object* with the specified keys removed.
1117
+ * - `false`: modifies the original object in place and returns it.
1118
+ *
1119
+ * @returns {Partial<T>}
1120
+ * - A new object with specified keys removed if `deepClone` is `true`.
1121
+ * - The *same mutated object* if `deepClone` is `false`.
1122
+ *
1123
+ * @throws {TypeError}
1124
+ * - If `keysToDelete` is not an array of `{ key, deep? }` objects.
1125
+ *
1126
+ * @example
1127
+ * // Shallow deletion
1128
+ * removeObjectPaths(
1129
+ * { a: 1, b: 2, c: { d: 3 } },
1130
+ * [{ key: "b" }]
1131
+ * );
1132
+ * // ➔ { a: 1, c: { d: 3 } }
1133
+ *
1134
+ * @example
1135
+ * // Nested deletion (shallow, removes only exact path)
1136
+ * removeObjectPaths(
1137
+ * { user: { profile: { name: "Alice", age: 30 } } },
1138
+ * [{ key: "user.profile.age" }]
1139
+ * );
1140
+ * // ➔ { user: { profile: { name: "Alice" } } }
1141
+ *
1142
+ * @example
1143
+ * // Deep deletion (recursively removes key from all levels and arrays)
1144
+ * removeObjectPaths(
1145
+ * { items: [{ price: 10 }, { price: 20, details: { price: 30 } }] },
1146
+ * [{ key: "price", deep: true }]
1147
+ * );
1148
+ * // ➔ { items: [{}, { details: {} }] }
1149
+ *
1150
+ * @example
1151
+ * // Without cloning: mutates original object
1152
+ * const obj = { x: 1, y: 2 };
1153
+ * removeObjectPaths(obj, [{ key: "y" }], false);
1154
+ * console.log(obj); // ➔ { x: 1 }
1155
+ *
1156
+ * @example
1157
+ * // No matching path — returns unchanged object
1158
+ * removeObjectPaths({}, [{ key: "a" }]);
1159
+ * // ➔ {}
1160
+ *
1161
+ * @example
1162
+ * // 🚫 Invalid usage — `keysToDelete` is not an array
1163
+ * removeObjectPaths({}, "a");
1164
+ * // ➔ throws TypeError
1165
+ *
1166
+ * @example
1167
+ * // 🚫 Invalid usage — missing `key` property in array element
1168
+ * removeObjectPaths({}, [{ deep: true }]);
1169
+ * // ➔ throws TypeError
1170
+ */
1171
+ declare function removeObjectPaths<T extends Record<string,unknown>,K extends ConfigRemoveObjectPaths<T>[]>(object:T,keysToDelete:K,deepClone?:boolean):ResultRemoveObjectPaths<T,K>;
1172
+ /** -------------------------------------------------
1173
+ * * ***Options for `safeStableStringify`.***
1174
+ * -------------------------------------------------
1175
+ */
1176
+ type SafeStableStringifyOptions={
1177
+ /** Whether to sort **object keys** alphabetically (recursively).
1178
+ *
1179
+ * - `true` (default): object keys are sorted to ensure stable output.
1180
+ * - `false`: preserves original insertion order of keys.
1181
+ *
1182
+ * @default true
1183
+ */
1184
+ sortKeys?:boolean;
1185
+ /** Whether to sort **primitive values inside arrays**.
1186
+ *
1187
+ * - `true`: primitive values in arrays are sorted to ensure stable output.
1188
+ * - `false` (default): arrays retain their original order; objects and nested arrays are not reordered.
1189
+ *
1190
+ * @default false
1191
+ */
1192
+ sortArray?:boolean;
1193
+ /** Whether to pretty-print JSON output with 2-space indentation.
1194
+ *
1195
+ * - `true`: output is formatted with indentation and newlines.
1196
+ * - `false` (default): produces compact single-line JSON.
1197
+ *
1198
+ * @default false
1199
+ */
1200
+ pretty?:boolean;};
1201
+ /** --------------------------------------------
1202
+ * * ***Safely converts a JavaScript value into a stable, JSON-compatible string.***
1203
+ * --------------------------------------------
1204
+ *
1205
+ * This function is an enhanced version of `JSON.stringify` with additional guarantees:
1206
+ *
1207
+ * - Features:
1208
+ * - Recursively sorts object keys **only if** `sortKeys` is `true` (default: `true`), to ensure stable key order.
1209
+ * - If `sortKeys` is `false`, preserves the original insertion order of object keys.
1210
+ * - Optionally sorts array primitive values **only if** `sortArray` is `true` (default: `false`).
1211
+ * - Only primitive values in arrays are sorted.
1212
+ * - Objects and nested arrays keep their original position and are appended after sorted primitives.
1213
+ * - If `sortArray` is `false`, arrays retain their original order.
1214
+ * - Converts JavaScript special values for JSON safety:
1215
+ * - `undefined`, `NaN`, `Infinity`, `-Infinity` ➔ `null`
1216
+ * - `BigInt` ➔ string (JSON does not support BigInt)
1217
+ * - Converts boxed primitives box into their primitive equivalents:
1218
+ * - `new Number(42)` ➔ `Number(42)` ➔ `42`.
1219
+ * - `new String("hi")` ➔ `String("hi")` ➔ `"hi"`.
1220
+ * - `new Boolean(true)` ➔ `Boolean(true)` ➔ `true`.
1221
+ * - Functions and Symbols are removed.
1222
+ * - Circular references are replaced with the string `"[Circular]"`.
1223
+ * - Serializes:
1224
+ * - `Date` ➔ ISO string (`date.toISOString()`)
1225
+ * - `Set` ➔ `{ set: [values...] }` (values are recursively processed)
1226
+ * - `Map` ➔ `{ map: [ [key, value], ... ] }` (values are recursively processed)
1227
+ *
1228
+ * - Compared to `JSON.stringify`, this ensures **stable output**:
1229
+ * - Same object structure always produces the same string.
1230
+ * - Useful for deep equality checks, hashing, caching keys, or snapshot tests.
1231
+ *
1232
+ * @param {unknown} value
1233
+ * - Any JavaScript value to serialize. Can be:
1234
+ * - Primitives (`number`, `string`, `boolean`, `bigint`, `null`, `undefined`)
1235
+ * - Boxed primitives (`new Number()`, `new String()`, `new Boolean()`)
1236
+ * - Arrays, plain objects, nested structures
1237
+ * - Date, Map, Set
1238
+ * - Circular structures
1239
+ *
1240
+ * @param {SafeStableStringifyOptions} [options]
1241
+ * - Configuration options for `safeStableStringify`:
1242
+ * - `sortKeys` (boolean) – Whether to sort object keys alphabetically (recursively). Default: `true`.
1243
+ * - `sortArray` (boolean) – Whether to sort primitive values inside arrays. Default: `false`.
1244
+ * - `pretty` (boolean) – Whether to pretty-print JSON output with 2-space indentation. Default: `false`.
1245
+ *
1246
+ * @returns {string}
1247
+ * A stable JSON string representation of the input value.
1248
+ *
1249
+ * @throws {TypeError}
1250
+ * Throws if `sortKeys`, `sortArray`, or `pretty` are not strictly boolean.
1251
+ *
1252
+ * @example
1253
+ * ```ts
1254
+ * // Basic object key sorting
1255
+ * safeStableStringify({ b: 2, a: 1 });
1256
+ * // ➔ '{"a":1,"b":2}'
1257
+ *
1258
+ * // Disable key sorting (preserve insertion order)
1259
+ * safeStableStringify({ b: 2, a: 1 }, {
1260
+ * sortKeys:false
1261
+ * });
1262
+ * // ➔ '{"b":2,"a":1}'
1263
+ *
1264
+ * // Sorting arrays with sortArray
1265
+ * safeStableStringify([3, 1, 2], {
1266
+ * sortArray:true
1267
+ * });
1268
+ * // ➔ '[1,2,3]'
1269
+ *
1270
+ * // Nested object + sortArray=true
1271
+ * safeStableStringify({ z: [3, 1, 2], x: { d: 4, c: 3 } }, {
1272
+ * sortKeys:true,
1273
+ * sortArray:true
1274
+ * });
1275
+ * // ➔ '{"x":{"c":3,"d":4},"z":[1,2,3]}'
1276
+ *
1277
+ * // sortKeys=false and sortArray=true
1278
+ * safeStableStringify({ z: [3, 1, 2], x: { d: 4, c: 3 } }, {
1279
+ * sortKeys:false,
1280
+ * sortArray:true
1281
+ * });
1282
+ * // ➔ '{"z":[1,2,3],"x":{"d":4,"c":3}}'
1283
+ *
1284
+ * // Pretty print output
1285
+ * safeStableStringify([3, 1, 2], {
1286
+ * sortArray:true,
1287
+ * pretty:true
1288
+ * });
1289
+ * // ➔ `[
1290
+ * // 1,
1291
+ * // 2,
1292
+ * // 3
1293
+ * // ]`
1294
+ *
1295
+ * // Boxed primitives converted to primitive
1296
+ * safeStableStringify({ n: new Number(42), s: new String("hi"), b: new Boolean(true) });
1297
+ * // ➔ '{"n":42,"s":"hi","b":true}'
1298
+ *
1299
+ * // Handles Date, BigInt, Map and Set
1300
+ * safeStableStringify({
1301
+ * time: new Date("2025-01-01"),
1302
+ * big: BigInt(9007199254740991),
1303
+ * data: new Map([["key", new Set([1, 2])]])
1304
+ * });
1305
+ * // ➔ '{"big":"9007199254740991","data":{"map":[["key",{"set":[1,2]}]]},"time":"2025-01-01T00:00:00.000Z"}'
1306
+ *
1307
+ * // Functions and symbols are removed
1308
+ * safeStableStringify({ f: () => {}, s: Symbol("wow") });
1309
+ * // ➔ '{}'
1310
+ *
1311
+ * // undefined, NaN, Infinity convert to null
1312
+ * safeStableStringify([undefined, NaN, Infinity, -Infinity]);
1313
+ * // ➔ '[null,null,null,null]'
1314
+ *
1315
+ * // Circular reference
1316
+ * const obj = { name: "A" };
1317
+ * obj.self = obj;
1318
+ * safeStableStringify(obj);
1319
+ * // ➔ '{"name":"A","self":"[Circular]"}'
1320
+ *
1321
+ * // Complex nested sortArray with objects
1322
+ * const arr = [9, 7, [4, 2, 3], { z: [5, 1, 6] }];
1323
+ * safeStableStringify(arr, { sortArray:true, sortKeys:true });
1324
+ * // ➔ '[7,9,[2,3,4],{"z":[1,5,6]}]'
1325
+ * ```
1326
+ */
1327
+ declare const safeStableStringify:(value:unknown,options?:SafeStableStringifyOptions)=>string;
1328
+ /** ----------------------------------------------------------
1329
+ * * ***Recursively converts a value into a string based on the `forceToString` option.***
1330
+ * ----------------------------------------------------------
1331
+ *
1332
+ * - `"stringOrNumber"`: Converts strings and numbers to strings.
1333
+ * - `"primitives"`: Converts all primitives (number, string, boolean, bigint, undefined, null, NaN) to strings.
1334
+ * - `"all"`: Converts everything, including symbols, functions, Dates, RegExp, Maps, Sets, Errors, Promises,
1335
+ * and deeply all object properties, to strings.
1336
+ * - `false` (default): Leaves everything unchanged.
1337
+ *
1338
+ * Special behaviors:
1339
+ * - `NaN` ➔ `"NaN"` only in `"primitives"` or `"all"` mode.
1340
+ * - `Date` ➔ ISO string only in `"all"` mode.
1341
+ * - `RegExp` ➔ Source string (e.g. `/abc/i`) only in `"all"` mode.
1342
+ * - `Symbol` ➔ `Symbol(description)` string only in `"all"` mode.
1343
+ * - `Map` ➔ Array of [key, value] pairs with keys/values stringified deeply (only in `"all"` mode).
1344
+ * - `Set` ➔ Array of values stringified deeply (only in `"all"` mode).
1345
+ * - `Function` ➔ Source code string (e.g. `"() => 1"`) only in `"all"` mode.
1346
+ * - `Error`, `Promise` ➔ Stringified via `.toString()` only in `"all"` mode.
1347
+ *
1348
+ *
1349
+ * @param {unknown} value - The value to process. Can be anything: primitive, array, object, function, etc.
1350
+ * @param {false | "stringOrNumber" | "primitives" | "all"} forceToString - The mode of string conversion.
1351
+ * @returns {unknown} A new value with the conversion applied based on `forceToString`.
1352
+ *
1353
+ * @example
1354
+ * toStringDeepForce(42, "stringOrNumber");
1355
+ * // ➔ "42"
1356
+ *
1357
+ * @example
1358
+ * toStringDeepForce(true, "primitives");
1359
+ * // ➔ "true"
1360
+ *
1361
+ * @example
1362
+ * toStringDeepForce(null, "primitives");
1363
+ * // ➔ "null"
1364
+ *
1365
+ * @example
1366
+ * toStringDeepForce(Symbol("x"), "all");
1367
+ * // ➔ "Symbol(x)"
1368
+ *
1369
+ * @example
1370
+ * toStringDeepForce({ a: 1, b: [2, NaN] }, "primitives");
1371
+ * // ➔ { a: "1", b: ["2", "NaN"] }
1372
+ *
1373
+ * @example
1374
+ * toStringDeepForce(new Date("2025-01-01"), "all");
1375
+ * // ➔ "2025-01-01T00:00:00.000Z"
1376
+ *
1377
+ * @example
1378
+ * toStringDeepForce(() => 1, "all");
1379
+ * // ➔ "() => 1"
1380
+ *
1381
+ * @example
1382
+ * toStringDeepForce(/abc/i, "all");
1383
+ * // ➔ "/abc/i"
1384
+ *
1385
+ * @example
1386
+ * toStringDeepForce(new Map([["a", 1], ["b", 2]]), "all");
1387
+ * // ➔ [["a", "1"], ["b", "2"]]
1388
+ *
1389
+ * @example
1390
+ * toStringDeepForce(new Set([1, 2, 3]), "all");
1391
+ * // ➔ ["1", "2", "3"]
1392
+ *
1393
+ * @example
1394
+ * toStringDeepForce(new Error("Oops"), "all");
1395
+ * // ➔ "Error: Oops"
1396
+ *
1397
+ * @example
1398
+ * toStringDeepForce(Promise.resolve(1), "all");
1399
+ * // ➔ "[object Promise]"
1400
+ *
1401
+ * @example
1402
+ * toStringDeepForce({ func: () => 123 }, "all");
1403
+ * // ➔ { func: "() => 123" }
1404
+ *
1405
+ * @example
1406
+ * toStringDeepForce([1, "a", { b: 2 }], false);
1407
+ * // ➔ [1, "a", { b: 2 }]
1408
+ */
1409
+ declare function toStringDeepForce(value:unknown,forceToString:false|"stringOrNumber"|"primitives"|"all"):unknown;
1410
+ /** ----------------------------------------------------------
1411
+ * * Normalize leaked `never[]` into literal empty array `[]`.
1412
+ * ----------------------------------------------------------
1413
+ */
1414
+ type FixNeverArray$1<T>=[T] extends [never[]]?[]:T;
1415
+ /** ----------------------------------------------------------
1416
+ * * Simplify object type to remove unnecessary TypeScript wrappers.
1417
+ * ----------------------------------------------------------
1418
+ */
1419
+ type Simplify$1<T>=T extends object?{[K in keyof T]:T[K];}:T;
1420
+ /** ----------------------------------------------------------
1421
+ * * Deeply convert all numbers and strings to `number | undefined`,
1422
+ * * recursively handling arrays, tuples, Sets, Maps, TypedArrays,
1423
+ * * and objects. Special types like Date remain unchanged.
1424
+ * ----------------------------------------------------------
1425
+ *
1426
+ * @template T - Input type to convert
1427
+ * @template RemoveEmptyObjects - Whether to remove empty objects
1428
+ * @template RemoveEmptyArrays - Whether to remove empty arrays
1429
+ * @template IsRoot - Internal flag for root level
1430
+ */
1431
+ type ConvertedDeepNumberInternal<T,RemoveEmptyObjects extends boolean,RemoveEmptyArrays extends boolean,IsRoot extends boolean>=[ T] extends [null|undefined]?IsRoot extends true?undefined:never:T extends number|`${number}`|string?number|undefined:T extends readonly(infer E)[]?FixNeverArray$1<T extends readonly [any,...any[]]?_MapTuple$1<T,RemoveEmptyObjects,RemoveEmptyArrays>:ConvertedDeepNumberInternal<E,RemoveEmptyObjects,RemoveEmptyArrays,false>[]>:T extends Set<infer V>?FixNeverArray$1<ConvertedDeepNumberInternal<V,RemoveEmptyObjects,RemoveEmptyArrays,false>[]>:T extends Map<infer K,infer V>?FixNeverArray$1<[ ConvertedDeepNumberInternal<K,RemoveEmptyObjects,RemoveEmptyArrays,false>,ConvertedDeepNumberInternal<V,RemoveEmptyObjects,RemoveEmptyArrays,false>][]>:T extends Buffer?RemoveEmptyArrays extends true?IsRoot extends true?(number|undefined)[]:never:(number|undefined)[]:T extends TypedArray?FixNeverArray$1<ConvertedDeepNumberInternal<number,RemoveEmptyObjects,RemoveEmptyArrays,false>[]>:T extends Date?_ConvertedObjectInternal$1<number,RemoveEmptyObjects,RemoveEmptyArrays,IsRoot>:T extends RegExp|WebApiObjects|IntlObjects|{[Symbol.toStringTag]:"Proxy";}|typeof Reflect?RemoveEmptyObjects extends true?IsRoot extends true?{}:never:{}:T extends Record<string|number|symbol,unknown>?_ConvertedObjectInternal$1<T,RemoveEmptyObjects,RemoveEmptyArrays,IsRoot>:never;
1432
+ /** ----------------------------------------------------------
1433
+ * * Recursively map tuples while preserving `never` removals.
1434
+ * ----------------------------------------------------------
1435
+ */
1436
+ type _MapTuple$1<Arr extends readonly unknown[],RemoveEmptyObjects extends boolean,RemoveEmptyArrays extends boolean>=Arr extends readonly [infer H,...infer R]?Exclude<ConvertedDeepNumberInternal<H,RemoveEmptyObjects,RemoveEmptyArrays,false>,undefined>extends infer H2?[H2] extends [never]?_MapTuple$1<R,RemoveEmptyObjects,RemoveEmptyArrays>:[H2,..._MapTuple$1<R,RemoveEmptyObjects,RemoveEmptyArrays>]:never:[];
1437
+ /** ----------------------------------------------------------
1438
+ * * Internal object conversion utility.
1439
+ * * Removes empty objects/arrays based on flags.
1440
+ * ----------------------------------------------------------
1441
+ */
1442
+ type _ConvertedObjectInternal$1<O extends Record<string|number|symbol,unknown>|number,RemoveEmptyObjects extends boolean,RemoveEmptyArrays extends boolean,IsRoot extends boolean>={[K in keyof O as Exclude<ConvertedDeepNumberInternal<O[K],RemoveEmptyObjects,RemoveEmptyArrays,false>,undefined>extends infer Convert?[Convert] extends [never]?never:undefined extends ConvertedDeepNumberInternal<O[K],RemoveEmptyObjects,RemoveEmptyArrays,false>?never:RemoveEmptyArrays extends true?Convert extends readonly unknown[]?[Convert] extends [[]]?O[K] extends TypedArray|Set<any>|Map<any,any>?K:never:K:K:K:never]:Exclude<ConvertedDeepNumberInternal<O[K],RemoveEmptyObjects,RemoveEmptyArrays,false>,undefined>;}&{[K in keyof O as Exclude<ConvertedDeepNumberInternal<O[K],RemoveEmptyObjects,RemoveEmptyArrays,false>,undefined>extends infer Convert?[Convert] extends [never]?never:undefined extends ConvertedDeepNumberInternal<O[K],RemoveEmptyObjects,RemoveEmptyArrays,false>?RemoveEmptyArrays extends true?Convert extends readonly unknown[]?[Convert] extends [[]]?O[K] extends TypedArray|Set<any>|Map<any,any>?K:never:K:K:K:never:never]?:Exclude<ConvertedDeepNumberInternal<O[K],RemoveEmptyObjects,RemoveEmptyArrays,false>,undefined>;}extends infer M?RemoveEmptyObjects extends true?keyof M extends never?IsRoot extends true?{}:never:Simplify$1<M>:Simplify$1<M>:never;
1443
+ /** ----------------------------------------------------------
1444
+ * * Public type: Deeply converts numbers/strings to `number | undefined`,
1445
+ * * applies empty object/array removal, preserves special types.
1446
+ * ----------------------------------------------------------
1447
+ */
1448
+ type ConvertedDeepNumber<T,RemoveEmptyObjects extends boolean=false,RemoveEmptyArrays extends boolean=false>=[unknown] extends [T]?unknown:FixNeverArray$1<ConvertedDeepNumberInternal<T,RemoveEmptyObjects,RemoveEmptyArrays,true>>;type ToNumberDeepOptions<RemoveEmptyObjects extends boolean=false,RemoveEmptyArrays extends boolean=false>={
1449
+ /** Whether to remove empty objects (`{}`) from the result.
1450
+ *
1451
+ * - `true` ➔ remove empty objects recursively.
1452
+ * - `false` **(default)** ➔ keep empty objects as-is.
1453
+ *
1454
+ * @default false
1455
+ */
1456
+ removeEmptyObjects?:RemoveEmptyObjects;
1457
+ /** Whether to remove empty arrays (`[]`) from the result.
1458
+ *
1459
+ * - `true` ➔ remove empty arrays recursively.
1460
+ * - `false` **(default)** ➔ keep empty arrays as-is.
1461
+ *
1462
+ * @default false
1463
+ */
1464
+ removeEmptyArrays?:RemoveEmptyArrays;};
1465
+ /** --------------------------------------------------
1466
+ * * ***Converts deeply nested arrays, objects, buffers, sets, maps, or typed arrays into numbers while preserving structure.***
1467
+ * --------------------------------------------------
1468
+ *
1469
+ * Features:
1470
+ * - Removes `null`, `undefined`, `NaN`, `Infinity`, `-Infinity`, empty-string, non-numeric strings, and functions.
1471
+ * - Recursively processes nested objects, arrays, buffers, sets, maps, and typed arrays.
1472
+ * - Converts numeric strings to numbers (e.g., `"3.5"` ➔ `3.5`).
1473
+ * - Keeps empty objects `{}` unless `removeEmptyObjects: true`.
1474
+ * - Keeps empty arrays `[]` unless `removeEmptyArrays: true`.
1475
+ * - Buffers and TypedArrays are converted into arrays of numbers.
1476
+ * - Date objects are converted into their timestamp (`number`).
1477
+ *
1478
+ * @template T - The input type.
1479
+ * @template RemoveEmptyObjects - Whether to remove empty objects.
1480
+ * @template RemoveEmptyArrays - Whether to remove empty arrays.
1481
+ *
1482
+ * @param {T} input - The input value to convert.
1483
+ * @param {ToNumberDeepOptions<RemoveEmptyObjects, RemoveEmptyArrays>} [options] - Conversion options.
1484
+ * @returns {ConvertedDeepNumber<T, RemoveEmptyObjects, RemoveEmptyArrays>} The converted value.
1485
+ * - `undefined` if the input is entirely empty or filtered out by options.
1486
+ *
1487
+ * @example
1488
+ * ```ts
1489
+ * toNumberDeep("123");
1490
+ * // ➔ 123
1491
+ *
1492
+ * toNumberDeep("abc");
1493
+ * // ➔ undefined
1494
+ *
1495
+ * toNumberDeep([NaN, "10", "xyz"]);
1496
+ * // ➔ [10]
1497
+ *
1498
+ * toNumberDeep({ a: "1", b: [null, "2"] });
1499
+ * // ➔ { a: 1, b: [2] }
1500
+ *
1501
+ * toNumberDeep(Buffer.from([0, 1, 2]));
1502
+ * // ➔ [0, 1, 2]
1503
+ *
1504
+ * toNumberDeep(new Set(["1", "2"]));
1505
+ * // ➔ [1, 2]
1506
+ *
1507
+ * toNumberDeep(new Map([["a", "1"], ["b", "2"]]));
1508
+ * // ➔ [["a", 1], ["b", 2]]
1509
+ *
1510
+ * toNumberDeep(new Int16Array([1, 2, 3]));
1511
+ * // ➔ [1, 2, 3]
1512
+ *
1513
+ * toNumberDeep(new Date("2025-08-16T00:00:00Z"));
1514
+ * // ➔ 1755552000000
1515
+ *
1516
+ * toNumberDeep({ a: {}, b: [] }, { removeEmptyObjects: true });
1517
+ * // ➔ { b: [] }
1518
+ *
1519
+ * toNumberDeep({ a: {}, b: [] }, { removeEmptyArrays: true });
1520
+ * // ➔ { a: {} }
1521
+ *
1522
+ * toNumberDeep({ x: {}, y: [], z: [{ a: {}, b: [] }] }, {
1523
+ * removeEmptyObjects: true, removeEmptyArrays: true
1524
+ * });
1525
+ * // ➔ { z: [] }
1526
+ * ```
1527
+ */
1528
+ declare function toNumberDeep(input?:null|undefined,options?:ToNumberDeepOptions<boolean,boolean>):undefined;declare function toNumberDeep<T,RemoveEmptyObjects extends boolean=false,RemoveEmptyArrays extends boolean=false>(input:T,options?:ToNumberDeepOptions<RemoveEmptyObjects,RemoveEmptyArrays>):ConvertedDeepNumber<T,RemoveEmptyObjects,RemoveEmptyArrays>;
1529
+ /** ----------------------------------------------------------
1530
+ * * Normalize leaked `never[]` into literal empty array `[]`.
1531
+ * ---------------------------------------------------------- */
1532
+ type FixNeverArray<T,RemoveEmptyArrays extends boolean>=[T] extends [never[]]?RemoveEmptyArrays extends true?T extends undefined?undefined:never:[]:T;
1533
+ /** ----------------------------------------------------------
1534
+ * * Simplify object type to remove unnecessary TypeScript wrappers.
1535
+ * ---------------------------------------------------------- */
1536
+ type Simplify<T>=T extends object?{[K in keyof T]:T[K];}:T;
1537
+ /** ----------------------------------------------------------
1538
+ * * Deeply convert all numbers and numeric strings to `string`,
1539
+ * * recursively handling arrays, tuples, Sets, Maps, TypedArrays,
1540
+ * * Buffer, and objects. Special types like Date remain unchanged.
1541
+ * ---------------------------------------------------------- */
1542
+ type ConvertedDeepStringInternal<T,RemoveEmptyObjects extends boolean,RemoveEmptyArrays extends boolean,IsRoot extends boolean>=[T] extends [null|undefined]?IsRoot extends true?undefined:never:T extends number|string|Date|RegExp|WebApiObjects|IntlObjects|{[Symbol.toStringTag]:"Proxy";}|typeof Reflect?string:T extends readonly(infer E)[]?FixNeverArray<T extends readonly [any,...any[]]?_MapTuple<T,RemoveEmptyObjects,RemoveEmptyArrays>:ConvertedDeepStringInternal<E,RemoveEmptyObjects,RemoveEmptyArrays,false>[],RemoveEmptyArrays>:T extends Set<infer V>?FixNeverArray<ConvertedDeepStringInternal<V,RemoveEmptyObjects,RemoveEmptyArrays,false>[],RemoveEmptyArrays>:T extends Map<infer K,infer V>?FixNeverArray<[ ConvertedDeepStringInternal<K,RemoveEmptyObjects,RemoveEmptyArrays,false>,ConvertedDeepStringInternal<V,RemoveEmptyObjects,RemoveEmptyArrays,false>][],RemoveEmptyArrays>:T extends Buffer?FixNeverArray<ConvertedDeepStringInternal<string,RemoveEmptyObjects,RemoveEmptyArrays,false>[],RemoveEmptyArrays>:T extends TypedArray?FixNeverArray<ConvertedDeepStringInternal<string,RemoveEmptyObjects,RemoveEmptyArrays,false>[],RemoveEmptyArrays>:T extends Record<string|number|symbol,unknown>?_ConvertedObjectInternal<T,RemoveEmptyObjects,RemoveEmptyArrays,IsRoot>:never;
1543
+ /** ----------------------------------------------------------
1544
+ * * Remove undefined and keep only items for tuples
1545
+ * ---------------------------------------------------------- */
1546
+ type _MapTuple<Arr extends readonly unknown[],RemoveEmptyObjects extends boolean,RemoveEmptyArrays extends boolean>=Arr extends readonly [infer H,...infer R]?Exclude<ConvertedDeepStringInternal<H,RemoveEmptyObjects,RemoveEmptyArrays,false>,undefined>extends infer H2?[H2] extends [never]?_MapTuple<R,RemoveEmptyObjects,RemoveEmptyArrays>:[H2,..._MapTuple<R,RemoveEmptyObjects,RemoveEmptyArrays>]:never:[];
1547
+ /** ----------------------------------------------------------
1548
+ * * Internal object conversion utility.
1549
+ * * Removes empty objects/arrays based on flags.
1550
+ * ---------------------------------------------------------- */
1551
+ type _ConvertedObjectInternal<O extends Record<string|number|symbol,unknown>|string,RemoveEmptyObjects extends boolean,RemoveEmptyArrays extends boolean,IsRoot extends boolean>={[K in keyof O as Exclude<ConvertedDeepStringInternal<O[K],RemoveEmptyObjects,RemoveEmptyArrays,false>,undefined>extends infer Convert?[Convert] extends [never]?never:undefined extends ConvertedDeepStringInternal<O[K],RemoveEmptyObjects,RemoveEmptyArrays,false>?never:RemoveEmptyArrays extends true?Convert extends readonly unknown[]?[Convert] extends [[]]?never:K:K:K:never]:Exclude<ConvertedDeepStringInternal<O[K],RemoveEmptyObjects,RemoveEmptyArrays,false>,undefined>;}&{[K in keyof O as Exclude<ConvertedDeepStringInternal<O[K],RemoveEmptyObjects,RemoveEmptyArrays,false>,undefined>extends infer Convert?[Convert] extends [never]?never:undefined extends ConvertedDeepStringInternal<O[K],RemoveEmptyObjects,RemoveEmptyArrays,false>?RemoveEmptyArrays extends true?Convert extends readonly unknown[]?[Convert] extends [[]]?never:K:K:K:never:never]?:Exclude<ConvertedDeepStringInternal<O[K],RemoveEmptyObjects,RemoveEmptyArrays,false>,undefined>;}extends infer M?RemoveEmptyObjects extends true?keyof M extends never?IsRoot extends true?{}:never:Simplify<M>:Simplify<M>:never;
1552
+ /** ----------------------------------------------------------
1553
+ * * Public type: Deeply converts numbers/strings to `string`,
1554
+ * * applies empty object/array removal, preserves special types.
1555
+ * ---------------------------------------------------------- */
1556
+ type ConvertedDeepString<T,RemoveEmptyObjects extends boolean=false,RemoveEmptyArrays extends boolean=false>=[unknown] extends [T]?unknown:FixNeverArray<Simplify<ConvertedDeepStringInternal<T,RemoveEmptyObjects,RemoveEmptyArrays,true>>,RemoveEmptyArrays>;type ToStringDeepOptions<RemoveEmptyObjects extends boolean=false,RemoveEmptyArrays extends boolean=false>={
1557
+ /** Whether to remove empty objects (`{}`) from the result.
1558
+ *
1559
+ * - `true` ➔ remove empty objects recursively.
1560
+ * - `false` **(default)** ➔ keep empty objects as-is.
1561
+ *
1562
+ * @default false
1563
+ */
1564
+ removeEmptyObjects?:RemoveEmptyObjects;
1565
+ /** Whether to remove empty arrays (`[]`) from the result.
1566
+ *
1567
+ * - `true` ➔ remove empty arrays recursively.
1568
+ * - `false` **(default)** ➔ keep empty arrays as-is.
1569
+ *
1570
+ * @default false
1571
+ */
1572
+ removeEmptyArrays?:RemoveEmptyArrays;};
1573
+ /** --------------------------------------------------
1574
+ * * ***Converts all values in an array, object, Set, Map, or deeply nested structure to string.***
1575
+ * --------------------------------------------------
1576
+ *
1577
+ * Features:
1578
+ * - Converts numbers and strings to string (e.g., `123` ➔ `"123"`).
1579
+ * - Converts Date to ISO string (`Date ➔ string`).
1580
+ * - Converts RegExp to string (e.g., `/abc/ ➔ "/abc/"`).
1581
+ * - Converts Buffer, TypedArray, Set, Map, and arrays recursively to arrays of strings.
1582
+ * - Removes `null`, `undefined`, `NaN`, `Infinity`, `-Infinity`.
1583
+ * - Removes unsupported types like functions, symbols, and BigInt.
1584
+ * - Recursively processes nested objects, arrays, Sets, and Maps.
1585
+ * - Can optionally remove empty arrays (`[]`) and/or empty objects (`{}`) **recursively**.
1586
+ *
1587
+ * @template T - The input data type (primitive, object, array, Set, Map, or any nested combination).
1588
+ * @template RemoveEmptyObjects - If `true`, empty objects `{}` will be removed recursively.
1589
+ * @template RemoveEmptyArrays - If `true`, empty arrays `[]` will be removed recursively (including arrays nested in objects/arrays/Sets/Maps).
1590
+ *
1591
+ * @param {T} input - The data to convert.
1592
+ * @param {ToStringDeepOptions<RemoveEmptyObjects, RemoveEmptyArrays>} [options] - Conversion options.
1593
+ * @returns {ConvertedDeepString<T, RemoveEmptyObjects, RemoveEmptyArrays>}
1594
+ * The transformed data, or `undefined` if the entire structure becomes empty after processing.
1595
+ *
1596
+ * @example
1597
+ * ```ts
1598
+ * // Simple array conversion
1599
+ * toStringDeep([1, "2", 3]);
1600
+ * // ➔ ["1", "2", "3"]
1601
+ *
1602
+ * // Nested arrays
1603
+ * toStringDeep([1, ["2", [3, [null, "4"]]]]);
1604
+ * // ➔ ["1", ["2", ["3", ["4"]]]]
1605
+ *
1606
+ * // Object with nested values
1607
+ * toStringDeep({ a: 1, b: "2", c: { d: 3, e: null } });
1608
+ * // ➔ { a: "1", b: "2", c: { d: "3" } }
1609
+ *
1610
+ * // Removing empty objects
1611
+ * toStringDeep({ a: {}, b: "1" }, { removeEmptyObjects: true });
1612
+ * // ➔ { b: "1" }
1613
+ *
1614
+ * // Removing empty arrays recursively
1615
+ * toStringDeep(["1", [], { a: [] }], { removeEmptyArrays: true });
1616
+ * // ➔ ["1", { a: [] }]
1617
+ *
1618
+ * // Removing both empty objects and arrays recursively
1619
+ * toStringDeep({ a: {}, b: [], c: [{ d: {}, e: [] }, "1"] }, {
1620
+ * removeEmptyObjects: true,
1621
+ * removeEmptyArrays: true
1622
+ * });
1623
+ * // ➔ { c: ["1"] }
1624
+ *
1625
+ * // Fully empty structure becomes undefined
1626
+ * toStringDeep([null, undefined, {}], {
1627
+ * removeEmptyObjects: true,
1628
+ * removeEmptyArrays: true
1629
+ * });
1630
+ * // ➔ undefined
1631
+ * ```
1632
+ */
1633
+ declare function toStringDeep(input?:null|undefined,options?:ToStringDeepOptions<boolean,boolean>):undefined;declare function toStringDeep<T,RemoveEmptyObjects extends boolean=false,RemoveEmptyArrays extends boolean=false>(input:T,options?:ToStringDeepOptions<RemoveEmptyObjects,RemoveEmptyArrays>):ConvertedDeepString<T,RemoveEmptyObjects,RemoveEmptyArrays>;export{cleanParsedData,convertType,dedupeArray,extractDigits,filterNilArray,filterNullArray,parseCurrencyString,parseCustomDate,removeObjectPaths,safeJsonParse,safeStableStringify,toBooleanContent,toBooleanContentDeep,toBooleanExplicit,toBooleanLoose,toNumberArrayUnRecursive,toNumberDeep,toStringArrayUnRecursive,toStringDeep,toStringDeepForce};