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