@rzl-zone/utils-js 3.2.6-beta.0 → 3.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (173) hide show
  1. package/README.md +82 -51
  2. package/dist/NumberRangeUnion-B6bhM2s7.d.ts +33 -0
  3. package/dist/{any-BmdI8UbK.d.ts → any-v4TsK9ES.d.ts} +25 -26
  4. package/dist/{arrays-normalize-recursive-CnjYJ9xg.d.ts → arrays-normalize-recursive-BqmVuFlD.d.ts} +20 -20
  5. package/dist/assertions/index.cjs +1 -1
  6. package/dist/assertions/index.d.ts +96 -70
  7. package/dist/assertions/index.js +1 -1
  8. package/dist/chunk-2CQX5CBG.js +1 -0
  9. package/dist/chunk-2IOOEY45.cjs +1 -0
  10. package/dist/chunk-3IBQ5MOM.js +1 -0
  11. package/dist/{chunk-OGPPP2S3.js → chunk-3VA554KW.js} +1 -1
  12. package/dist/{chunk-FV7SEBKD.cjs → chunk-5757UBXJ.cjs} +1 -1
  13. package/dist/{chunk-MTUBDVJ2.js → chunk-5IGC6PBH.js} +1 -1
  14. package/dist/{chunk-O7UT5AN3.cjs → chunk-5KJFVIQT.cjs} +1 -1
  15. package/dist/chunk-6JFCSH7J.js +1 -0
  16. package/dist/{chunk-VHAPTHEA.cjs → chunk-6JFZL7YE.cjs} +1 -1
  17. package/dist/chunk-7ODAAXX5.cjs +1 -0
  18. package/dist/{chunk-6C3ATUGM.cjs → chunk-CAH33WOQ.cjs} +1 -1
  19. package/dist/{chunk-ECRNH4FW.js → chunk-CKTLUNWX.js} +1 -1
  20. package/dist/chunk-CMW2TBOQ.js +1 -0
  21. package/dist/chunk-D3ENH7H6.cjs +1 -0
  22. package/dist/{chunk-3YCFMGRB.js → chunk-DEZZUYE2.js} +1 -1
  23. package/dist/chunk-DWF2R5GD.cjs +1 -0
  24. package/dist/chunk-E55EQK2U.cjs +1 -0
  25. package/dist/chunk-E74U6CYP.cjs +1 -0
  26. package/dist/{chunk-XC3QHAK2.cjs → chunk-EL6A35UR.cjs} +1 -1
  27. package/dist/chunk-F6IPNNSJ.cjs +1 -0
  28. package/dist/chunk-FJZGG54N.cjs +1 -0
  29. package/dist/chunk-FWCKOJZM.js +1 -0
  30. package/dist/{chunk-IMCLPT5V.cjs → chunk-FWHNWL2P.cjs} +1 -1
  31. package/dist/chunk-GGEADHZO.js +1 -0
  32. package/dist/{chunk-IRGE5W7L.js → chunk-GQR4R5WY.js} +1 -1
  33. package/dist/chunk-H66AC7GK.cjs +1 -0
  34. package/dist/{chunk-M47QIBXI.cjs → chunk-HQWOFR56.cjs} +1 -1
  35. package/dist/{chunk-VCFXNV3Q.cjs → chunk-HYRQMTRH.cjs} +1 -1
  36. package/dist/{chunk-EUANTHVN.js → chunk-IRFL4MAX.js} +1 -1
  37. package/dist/{chunk-GGWPB23G.cjs → chunk-IVL7CKVH.cjs} +1 -1
  38. package/dist/chunk-IZPBKKPO.js +1 -0
  39. package/dist/chunk-JBQMXC5I.cjs +1 -0
  40. package/dist/chunk-JEQEF5WD.js +1 -0
  41. package/dist/chunk-JMJQCN74.js +1 -0
  42. package/dist/chunk-JYQTCICM.js +1 -0
  43. package/dist/chunk-KVAL5PAG.cjs +1 -0
  44. package/dist/chunk-LS6U7FAY.cjs +1 -0
  45. package/dist/chunk-NBZWMBO6.js +1 -0
  46. package/dist/chunk-NRF6LWBC.cjs +1 -0
  47. package/dist/chunk-OI5XKNZO.js +1 -0
  48. package/dist/chunk-OYTYSY7G.js +1 -0
  49. package/dist/chunk-PET42Z7W.js +1 -0
  50. package/dist/chunk-PZQ6I4JJ.cjs +1 -0
  51. package/dist/chunk-QBKAEVYG.js +1 -0
  52. package/dist/{chunk-YV3K2EKJ.js → chunk-RIPKY4RU.js} +1 -1
  53. package/dist/chunk-RZW35UN5.cjs +1 -0
  54. package/dist/chunk-SBFNXGTJ.js +1 -0
  55. package/dist/{chunk-T4CIAKEK.js → chunk-SBKGWRS5.js} +1 -1
  56. package/dist/{chunk-5Z2G23WP.js → chunk-SIM77PU4.js} +1 -1
  57. package/dist/chunk-T2T7K3KR.js +1 -0
  58. package/dist/chunk-T7PU2V7X.cjs +1 -0
  59. package/dist/chunk-V45XJKHW.cjs +1 -0
  60. package/dist/chunk-W2WNBUDE.js +1 -0
  61. package/dist/chunk-XABCB3Y7.cjs +1 -0
  62. package/dist/chunk-XEDXFSGI.js +1 -0
  63. package/dist/chunk-YKPSRP5G.js +1 -0
  64. package/dist/chunk-YLA3DURS.cjs +1 -0
  65. package/dist/chunk-ZETAZZLD.cjs +1 -0
  66. package/dist/conversions/index.cjs +1 -1
  67. package/dist/conversions/index.d.ts +515 -321
  68. package/dist/conversions/index.js +1 -1
  69. package/dist/events/index.cjs +1 -1
  70. package/dist/events/index.d.ts +25 -20
  71. package/dist/events/index.js +1 -1
  72. package/dist/{extends-Bk_SBGdT.d.ts → extends-DtdRjDyU.d.ts} +63 -87
  73. package/dist/{formatting → formatters}/index.cjs +1 -1
  74. package/dist/formatters/index.d.ts +2106 -0
  75. package/dist/formatters/index.js +1 -0
  76. package/dist/generators/index.cjs +1 -0
  77. package/dist/{generator → generators}/index.d.ts +57 -59
  78. package/dist/generators/index.js +1 -0
  79. package/dist/{if-CvT4R7Kh.d.ts → if-ChM35c_q.d.ts} +6 -5
  80. package/dist/index.d.ts +14 -0
  81. package/dist/{is-array--YjXV-Wx.d.ts → is-array-BJeHxPM3.d.ts} +287 -542
  82. package/dist/{isPlainObject-BVhBAPHX.d.ts → isPlainObject-DGJkcFYw.d.ts} +6 -6
  83. package/dist/{never-BfayMBF9.d.ts → never-D89PbPh5.d.ts} +10 -19
  84. package/dist/next/index.cjs +1 -1
  85. package/dist/next/index.d.ts +15 -12
  86. package/dist/next/index.js +1 -1
  87. package/dist/next/server/index.cjs +1 -1
  88. package/dist/next/server/index.d.ts +1 -1
  89. package/dist/next/server/index.js +1 -1
  90. package/dist/{nils-DMz3kU7M.d.ts → nils-CO8zLHSB.d.ts} +39 -65
  91. package/dist/operations/index.cjs +1 -1
  92. package/dist/operations/index.d.ts +4 -4
  93. package/dist/operations/index.js +1 -1
  94. package/dist/or-C6qzKt2I.d.ts +82 -0
  95. package/dist/override-CL2olHE5.d.ts +59 -0
  96. package/dist/parsers/index.cjs +1 -1
  97. package/dist/parsers/index.js +1 -1
  98. package/dist/pick-BSMX6Xe2.d.ts +15 -0
  99. package/dist/predicates/index.cjs +1 -1
  100. package/dist/predicates/index.d.ts +425 -106
  101. package/dist/predicates/index.js +1 -1
  102. package/dist/prettify-3o8_Kw6b.d.ts +564 -0
  103. package/dist/promises/index.cjs +1 -0
  104. package/dist/promises/index.d.ts +107 -0
  105. package/dist/promises/index.js +1 -0
  106. package/dist/promises-LU7K00H0.d.ts +72 -0
  107. package/dist/rzl-utils.global.js +1 -1
  108. package/dist/{string-XA-til3C.d.ts → string-B1jlOnws.d.ts} +82 -121
  109. package/dist/strings/index.cjs +1 -1
  110. package/dist/strings/index.d.ts +209 -210
  111. package/dist/strings/index.js +1 -1
  112. package/dist/tailwind/index.cjs +1 -1
  113. package/dist/tailwind/index.d.ts +23 -17
  114. package/dist/tailwind/index.js +1 -1
  115. package/dist/types/index.d.ts +899 -1181
  116. package/dist/urls/index.cjs +1 -1
  117. package/dist/urls/index.d.ts +113 -108
  118. package/dist/urls/index.js +1 -1
  119. package/package.json +33 -40
  120. package/dist/NumberRangeUnion-DC-C3_Kq.d.ts +0 -26
  121. package/dist/chunk-2HSNUPEO.cjs +0 -1
  122. package/dist/chunk-4Z75R3IT.cjs +0 -1
  123. package/dist/chunk-AJ25PWXX.cjs +0 -1
  124. package/dist/chunk-BHIBDDQF.js +0 -1
  125. package/dist/chunk-CE4JI2YB.js +0 -1
  126. package/dist/chunk-CMJ6UYWW.cjs +0 -1
  127. package/dist/chunk-D3VSHABU.cjs +0 -1
  128. package/dist/chunk-DG2GWBTS.cjs +0 -1
  129. package/dist/chunk-EKS4IZJR.cjs +0 -1
  130. package/dist/chunk-EOZKYR5S.cjs +0 -1
  131. package/dist/chunk-EW3I4O7X.js +0 -1
  132. package/dist/chunk-F3E77L46.js +0 -1
  133. package/dist/chunk-G5LXIEFO.js +0 -0
  134. package/dist/chunk-GVWGQNLF.js +0 -1
  135. package/dist/chunk-H3FXL4DU.cjs +0 -1
  136. package/dist/chunk-HHPDLSX2.cjs +0 -1
  137. package/dist/chunk-JARPXKBM.cjs +0 -1
  138. package/dist/chunk-JFJUPYDT.cjs +0 -1
  139. package/dist/chunk-JLP56WSM.js +0 -1
  140. package/dist/chunk-K3MV4AIN.cjs +0 -1
  141. package/dist/chunk-KOVO72OM.js +0 -1
  142. package/dist/chunk-LJ4M3VGE.js +0 -1
  143. package/dist/chunk-LJVGJLP4.js +0 -1
  144. package/dist/chunk-MISCBZJC.js +0 -1
  145. package/dist/chunk-MMSYCIJ2.cjs +0 -1
  146. package/dist/chunk-OLPKAX7F.cjs +0 -1
  147. package/dist/chunk-ORZFHBEY.js +0 -1
  148. package/dist/chunk-OWV2P376.js +0 -1
  149. package/dist/chunk-RV2WK5E6.js +0 -1
  150. package/dist/chunk-SBF43G3B.cjs +0 -1
  151. package/dist/chunk-X74TUJSE.cjs +0 -1
  152. package/dist/chunk-XLDAIZRK.js +0 -1
  153. package/dist/chunk-XZJ7C4N6.js +0 -1
  154. package/dist/chunk-ZHV5ZYVN.cjs +0 -1
  155. package/dist/chunk-ZL7J6GTP.js +0 -1
  156. package/dist/chunk-ZTCLKKMB.js +0 -1
  157. package/dist/env/index.cjs +0 -1
  158. package/dist/env/index.d.ts +0 -16
  159. package/dist/env/index.js +0 -1
  160. package/dist/formatting/index.d.ts +0 -950
  161. package/dist/formatting/index.js +0 -1
  162. package/dist/generator/index.cjs +0 -1
  163. package/dist/generator/index.js +0 -1
  164. package/dist/omit-VvmIsZmX.d.ts +0 -28
  165. package/dist/prettify-C4xLcYOP.d.ts +0 -353
  166. package/dist/promise/index.cjs +0 -1
  167. package/dist/promise/index.d.ts +0 -31
  168. package/dist/promise/index.js +0 -1
  169. package/dist/type-data-DDs-u2kq.d.ts +0 -261
  170. /package/dist/{chunk-5C2SMIGX.cjs → chunk-BAV5T2E3.cjs} +0 -0
  171. /package/dist/{chunk-MC3LXMCQ.js → chunk-L5RDAVVH.js} +0 -0
  172. /package/dist/{chunk-J2RGTPGK.cjs → chunk-VJDDGRIK.cjs} +0 -0
  173. /package/dist/{chunk-FIAAX3UE.js → chunk-YWHHVDT4.js} +0 -0
@@ -1,144 +1,4 @@
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
- /** ----------------------------------------------------------
3
- * * ***Element extractor***
4
- * ----------------------------------------------------------
5
- */
6
- type ElementOf<A extends readonly unknown[]>=A extends readonly(infer U)[]?U:never;
7
- /** ----------------------------------------------------------
8
- * * ***Compute `FilterNilArray`***
9
- * ----------------------------------------------------------
10
- *
11
- * for a tuple/array A by using the element type (without null|undefined).
12
- *
13
- */
14
- type FilterNilArrayFromTuple<A extends readonly unknown[]>=FilterNilArray<ExcludeNil<ElementOf<A>>>;
15
- /** ----------------------------------------------------------
16
- * ***Preserve `mutability`: if A is mutable (extends unknown[]), keep B; otherwise make B readonly***. */
17
- type PreserveMutability<A extends readonly unknown[],B>=A extends unknown[]?B:Readonly<B>;type IsDeepEmptyArray<T>=T extends readonly []?true:T extends readonly(infer U)[]?IsDeepEmptyArray<U>:false;type FilterNilRecursive<T>=T extends readonly(infer U)[]?T extends(infer U)[]?FilterNilRecursive<ExcludeEmptyArray<U>>[]:readonly FilterNilRecursive<ExcludeEmptyArray<U>>[]:Exclude<T,null|undefined>;type ExcludeEmptyArray<T>=T extends []?never:T;type NormalizerArrays<T>=NormalizeEmptyArraysRecursive<RemoveEmptyArrayElements<FilterNilRecursive<T[]>>>;type FilterNilArray<T>=IsDeepEmptyArray<NormalizerArrays<T>>extends true?[]:FixNeverArrayRecursive<NormalizerArrays<T>>;type ResUnFTN<Force extends false|"stringOrNumber"|"primitives"|"all"=false>=Force extends"all"?Array<unknown[]|Record<string,unknown>|string>:Force extends"stringOrNumber"?Array<string|boolean|bigint|symbol|null|undefined|Record<string,unknown>|AnyFunction|unknown[]|Date|RegExp|Map<unknown,unknown>|Set<unknown>|Promise<unknown>>:Force extends"primitives"?Array<string|symbol|Record<string,unknown>|AnyFunction|unknown[]|Date|RegExp|Map<unknown,unknown>|Set<unknown>|Promise<unknown>>:Force extends false?Array<string|number|bigint|boolean|symbol|RegExp|Record<string,unknown>|AnyFunction|Date|Map<unknown,unknown>|Set<unknown>|Promise<unknown>|unknown[]|null|undefined>:unknown[];type ResFTN<Force extends false|"stringOrNumber"|"primitives"|"all"=false>=Force extends"all"?Array<string|Record<string,unknown>>:Force extends"stringOrNumber"?Array<string|boolean|bigint|symbol|null|undefined|Record<string,unknown>|AnyFunction|Date|RegExp|Promise<unknown>>:Force extends"primitives"?Array<string|symbol|RegExp|Record<string,unknown>|AnyFunction|Date|Promise<unknown>>:Force extends false?Array<string|number|bigint|boolean|symbol|RegExp|Record<string,unknown>|AnyFunction|Date|Promise<unknown>|null|undefined>:unknown[];type DedupeResult<Force extends ForceToStringOptions=false,FTN extends boolean=false>=FTN extends false?ResUnFTN<Force>:ResFTN<Force>;type ForceToStringOptions=false|"stringOrNumber"|"primitives"|"all";type DedupeArrayOptions<F extends ForceToStringOptions,Fl extends boolean>={
18
- /** Enables string conversion for comparison, default is `false`.
19
- *
20
- * @default false
21
- * @type {ForceToStringOptions}
22
- */
23
- forceToString?:F;
24
- /** If true, deeply flattens arrays, Maps, and Sets before deduplication, default is `false`.
25
- *
26
- * @default false
27
- */
28
- flatten?:Fl;};
29
- /** ----------------------------------------------------------
30
- * * ***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
- 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
- /** ----------------------------------------------------------
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
- 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>;
1
+ import{h as Nullish,a as KeepNull,b as KeepUndef}from'../nils-CO8zLHSB.js';import{A as AnyFunction,P as Prettify,T as TypedArray,W as WebApiObjects,j as IntlObjects}from'../prettify-3o8_Kw6b.js';import{N as NormalizeEmptyArraysRecursive,R as RemoveEmptyArrayElements,F as FixNeverArrayRecursive}from'../arrays-normalize-recursive-BqmVuFlD.js';import{I as IsAny}from'../any-v4TsK9ES.js';import{i as IfNotExtends,I as IfExtends,E as Extends}from'../extends-DtdRjDyU.js';import{N as NumberRangeUnion}from'../NumberRangeUnion-B6bhM2s7.js';import{O as OrArr,a as AndArr}from'../or-C6qzKt2I.js';import'../if-ChM35c_q.js';import'../never-D89PbPh5.js';type NormalizeInputToNumberArrayUnRecursive<T>=T extends string|bigint|boolean|number|Nullish?T:HasNonNumberLikeNonNullish<T>;
142
2
  /** Detects whether `T` contains any number-like type (`string | number | bigint`).
143
3
  *
144
4
  * @template T Input type.
@@ -159,13 +19,16 @@ type HasString<T>=[Extract<T,string>] extends [never]?false:true;
159
19
  * @returns `true` if such types exist, otherwise `false`.
160
20
  */
161
21
  type HasNonNumberLikeNonNullish<T>=[ Exclude<T,string|bigint|number|Nullish>] extends [never]?false:true;
162
- /** Computes the return type of `toNumberArrayUnRecursive` based on input type `T` and option `R`.
22
+ /** -------------------------------------------------------
23
+ * * ***Computes the return type of {@link toNumberArrayUnRecursive|`toNumberArrayUnRecursive`}
24
+ * based on input type `T` and option `R`.***
25
+ * -------------------------------------------------------
163
26
  *
164
27
  * **Behavior:**
165
28
  * - 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 `[]`.
29
+ * - If `T` is only `null | undefined` returns `[]`.
30
+ * - If `T` contains number-like (`string | number | bigint`) returns `number[]`.
31
+ * - Otherwise returns `[]`.
169
32
  * - If `R = false` (`removeInvalidValueNumber: false`):
170
33
  * - Preserves `null[]` or `undefined[]` if input is purely nullish.
171
34
  * - Otherwise returns an array of:
@@ -177,7 +40,9 @@ type HasNonNumberLikeNonNullish<T>=[ Exclude<T,string|bigint|number|Nullish>] ex
177
40
  *
178
41
  */
179
42
  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
- /** Options object for `toNumberArrayUnRecursive`.
43
+ /** -------------------------------------------------------
44
+ * * ***Options for {@link toNumberArrayUnRecursive|`toNumberArrayUnRecursive`}.***
45
+ * -------------------------------------------------------
181
46
  *
182
47
  * @template T Flag indicating whether invalid values should be removed.
183
48
  */
@@ -195,14 +60,14 @@ removeInvalidValueNumber?:T;};
195
60
  * - Only supports **flat arrays** (non-recursive).
196
61
  * - Valid inputs: `string`, `number`, `null`, `undefined`.
197
62
  * - `BigInt` will be converted to `number`.
198
- * - Other values coerced into `undefined`.
63
+ * - Other values coerced into `undefined`.
199
64
  * - Invalid values can be **removed** (`removeInvalidValueNumber: true`) or **kept** (`false`).
200
65
  * - **ℹ️ Note:**
201
66
  * - _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 }`.
67
+ * @template T - Element type of the input array.
68
+ * @template R - Whether invalid values should be removed (`true`) or kept (`false`).
69
+ * @param {Array<T> | readonly T[] | null | undefined} [array] - The array to convert, returns `undefined` if not an array.
70
+ * @param {ToNumberArrayUnRecursiveOptions<RemoveInvalidValue>} [options] - Options to control transformation behavior, defaults to `{ removeInvalidValueNumber: true }`.
206
71
  * @returns {ToNumberArrayUnRecursiveReturn<NormalizeInput<T>, RemoveInvalidValue>} A new array of string representations, with invalid values optionally removed.
207
72
  * @example
208
73
  * ```ts
@@ -237,12 +102,15 @@ type HasAllowed<T>=[Extract<T,AllowedToString>] extends [never]?false:true;
237
102
  * @template T Input type to check.
238
103
  */
239
104
  type HasDisallowedNonNullish<T>=[Exclude<T,AllowedToString|Nullish>] extends [never]?false:true;
240
- /** Computes the resulting type of `toStringArrayUnRecursive` based on input type `T` and option `R`.
105
+ /** -------------------------------------------------------
106
+ * * ***Computes the return type of {@link toStringArrayUnRecursive|`toStringArrayUnRecursive`}
107
+ * based on input type `T` and option `R`.***
108
+ * -------------------------------------------------------
241
109
  *
242
110
  * **Behavior:**
243
111
  * - If `R = true` (`removeInvalidValue = true`):
244
- * - If `T` contains any allowed values `string[]`.
245
- * - If `T` contains only nullish or disallowed types `[]`.
112
+ * - If `T` contains any allowed values `string[]`.
113
+ * - If `T` contains only nullish or disallowed types `[]`.
246
114
  *
247
115
  * - If `R = false` (`removeInvalidValue = false`):
248
116
  * - Include `string` if `T` has allowed values.
@@ -252,7 +120,9 @@ type HasDisallowedNonNullish<T>=[Exclude<T,AllowedToString|Nullish>] extends [ne
252
120
  * @template R Flag indicating whether invalid values should be removed (`true`) or kept (`false`).
253
121
  */
254
122
  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
- /** Options object for `toStringArrayUnRecursive`.
123
+ /** -------------------------------------------------------
124
+ * * ***Options for {@link toStringArrayUnRecursive|`toStringArrayUnRecursive`}.***
125
+ * -------------------------------------------------------
256
126
  *
257
127
  * @template T Flag indicating whether invalid values should be removed.
258
128
  */
@@ -276,11 +146,11 @@ removeInvalidValue?:T;};
276
146
  * if `removeInvalidValue=true`).
277
147
  * - **ℹ️ Note:**
278
148
  * - _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`.
149
+ * @template T - Element type of the input array.
150
+ * @template R - Whether invalid values should be removed (`true`) or kept (`false`).
151
+ * @param {Array<string | number | bigint | boolean | null | undefined> | null | undefined} [array] - The array to convert, returns `undefined` if not an array.
152
+ * @param {ToStringArrayUnRecursiveOptions<RemoveInvalidValue>} [options] - Options to control transformation behavior, defaults to `{ removeInvalidValue: true }`.
153
+ * @param {RemoveInvalidValue extends true ? boolean : boolean} [options.removeInvalidValue=true] Whether to remove invalid values (`null`, `undefined`, or unsupported types), default: `true`.
284
154
  * @returns {RemoveInvalidValue extends true ? string[] : (string | null | undefined)[]} A new array of string representations, with invalid values optionally removed.
285
155
  * @example
286
156
  * ```ts
@@ -300,7 +170,7 @@ removeInvalidValue?:T;};
300
170
  * // Convert boolean and bigint
301
171
  * toStringArrayUnRecursive([true, false, 10n]);
302
172
  * // ➔ ['true', 'false', '10']
303
- * // Not an array returns undefined
173
+ * // Not an array returns undefined
304
174
  * toStringArrayUnRecursive(null);
305
175
  * // ➔ undefined
306
176
  * toStringArrayUnRecursive(undefined);
@@ -311,7 +181,146 @@ removeInvalidValue?:T;};
311
181
  * // ➔ undefined
312
182
  * ```
313
183
  */
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;
184
+ 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;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>={
185
+ /** Enables string conversion for comparison, default is `false`.
186
+ *
187
+ * @default false
188
+ * @type {ForceToStringOptions}
189
+ */
190
+ forceToString?:F;
191
+ /** If true, deeply flattens `Arrays`, `Maps`, and `Sets` before deduplication, default is `false`.
192
+ *
193
+ * @default false
194
+ */
195
+ flatten?:Fl;};
196
+ /** ----------------------------------------------------------
197
+ * * ***Utility: `dedupeArray`.***
198
+ * ---------------------------------------------
199
+ * **Deduplicates values in an array (with optional flattening and deep stringification).**
200
+ * - Supports various modes for converting values to strings before deduplication:
201
+ * - `"stringOrNumber"`: Converts strings and numbers to strings.
202
+ * - `"primitives"`: Converts all primitives (string, number, boolean, bigint, null, undefined, NaN) to strings.
203
+ * - `"all"`: Converts all values (primitives, objects, Maps, Sets, Symbols, RegExp, Dates, Errors, Promises, functions)
204
+ * to strings, including nested object properties.
205
+ * - `false` (default): No conversion applied.
206
+ * - Options:
207
+ * - `forceToString`: Enables string conversion for comparison, default is `false`.
208
+ * - `flatten`: If true, deeply flattens arrays, Maps, and Sets before deduplication, default is `false`.
209
+ * @template ForceToString - `forceToString` mode.
210
+ * @template Flattening - `flatten` mode.
211
+ * @param {unknown[]} inputArray - The array to deduplicate, can be deeply nested and contain any mix of types.
212
+ * @param {DedupeArrayOptions<ForceToString, Flattening>|undefined} [options] - Options to control string conversion.
213
+ * @returns {DedupeResult<ForceToString, Flattening>} Deduplicated array with optional transformations.
214
+ * @throws {TypeError} If the input is not an array, or options is not an object, or if `forceToString` is invalid.
215
+ * @example
216
+ * ```ts
217
+ * dedupeArray(["apple", "banana", "apple"]);
218
+ * // ➔ ["apple", "banana"]
219
+ * dedupeArray([[1, 2], [1, 2]], { flatten: true });
220
+ * // ➔ [1, 2]
221
+ * dedupeArray([new Set([1, 2]), new Set([2, 3])], { flatten: true });
222
+ * // ➔ [1, 2, 3]
223
+ * dedupeArray([1, "1", 2, "2"], {
224
+ * forceToString: "stringOrNumber"
225
+ * }); // ➔ ["1", "2"]
226
+ * dedupeArray([true, "true", false, undefined], {
227
+ * forceToString: "primitives"
228
+ * }); // ➔ ["true", "false", "undefined"]
229
+ * dedupeArray([1, "1", { a: 1 }], {
230
+ * forceToString: "all"
231
+ * }); // ➔ ["1", { a: "1" }]
232
+ * dedupeArray([1, 1, [2, 2, [3, 3]]]);
233
+ * // ➔ [1, [2, [3]]]
234
+ * dedupeArray([null, undefined, null]);
235
+ * // ➔ [null, undefined]
236
+ * dedupeArray([[], [[]], [[[]]], [[]], [[[]]]]);
237
+ * // ➔ [[], [[]], [[[]]]]
238
+ * const fn = () => 1;
239
+ * dedupeArray([fn, fn, () => 1]);
240
+ * // ➔ [fn, () => 1] cause: ref () => 1 and fn is different but ref const `fn` and `fn` is same ref.
241
+ * dedupeArray([Symbol("x"), Symbol("x")]);
242
+ * // ➔ [Symbol("x")] (symbols are same by identity, so dedupe
243
+ * dedupeArray([NaN, NaN, 1, "1"]);
244
+ * // ➔ [NaN, 1, "1"]
245
+ * dedupeArray([NaN, NaN, 1, "1"], {
246
+ * forceToString: "primitives"
247
+ * }); // ➔ ["NaN", "1"]
248
+ * dedupeArray([new Date("2025-01-01"), new Date("2025-01-01")]);
249
+ * // ➔ [Date("2025-01-01")] (same time, deduped)
250
+ * dedupeArray([new Date("2025-01-01"), new Date("2025-01-01")], {
251
+ * forceToString: "all"
252
+ * }); // ➔ ["2025-01-01T00:00:00.000Z"]
253
+ * dedupeArray([/abc/, /abc/], {
254
+ * forceToString: "all"
255
+ * }); // ➔ ["/abc/"]
256
+ * dedupeArray([new Map(), new Set(), new Error("err")], {
257
+ * forceToString: "all"
258
+ * }); // ➔ ["[object Map]", "[object Set]", "Error: err"]
259
+ * dedupeArray([Promise.resolve(1), Promise.resolve(1)], {
260
+ * forceToString: "all"
261
+ * }); // ➔ ["[object Promise]"]
262
+ * dedupeArray([{ a: 1 }, { a: 1 }, { a: 2 }], {
263
+ * forceToString: "primitives"
264
+ * }); // ➔ [{ a: "1" }, { a: "2" }]
265
+ * dedupeArray([{ a: { b: 1 } }, { a: { b: 1 } }], {
266
+ * forceToString: "all"
267
+ * }); // ➔ [{ a: { b: "1" } }]
268
+ * dedupeArray("not an array");
269
+ * // ➔ Throws TypeError
270
+ * dedupeArray([1, 2, 3], {
271
+ * forceToString: "invalid"
272
+ * }); // ➔ Throws TypeError
273
+ * ```
274
+ */
275
+ declare const dedupeArray:<ForceToString extends ForceToStringOptions=false,Flattening extends boolean=false>(inputArray:unknown[],options?:DedupeArrayOptions<ForceToString,Flattening>)=>DedupeResult<ForceToString,Flattening>;type ExcludeNil<T>=Exclude<T,null|undefined>;
276
+ /** ----------------------------------------------------------
277
+ * * ***Element extractor***
278
+ * ----------------------------------------------------------
279
+ */
280
+ type ElementOf<A extends readonly unknown[]>=A extends readonly(infer U)[]?U:never;
281
+ /** ----------------------------------------------------------
282
+ * * ***Compute `FilterNilArray`***
283
+ * ----------------------------------------------------------
284
+ *
285
+ * for a tuple/array A by using the element type (without null|undefined).
286
+ *
287
+ */
288
+ type FilterNilArrayFromTuple<A extends readonly unknown[]>=FilterNilArray<ExcludeNil<ElementOf<A>>>;
289
+ /** ----------------------------------------------------------
290
+ * ***Preserve `mutability`: if A is mutable (extends unknown[]), keep B; otherwise make B readonly***. */
291
+ 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>>;
292
+ /** ----------------------------------------------------------
293
+ * * ***Utility: `filterNilArray`.***
294
+ * ---------------------------------------------
295
+ * **Removes `null` and `undefined` values from an array, including nested arrays.**
296
+ * - **Behavior:**
297
+ * - Returns `undefined` if the input is explicitly `undefined` or `null`.
298
+ * - Returns `[]` if input is empty or all elements are removed after filtering.
299
+ * - Recursively filters nested arrays while preserving structure.
300
+ * - Ensures proper type inference for safer downstream operations.
301
+ * @template A - The type of elements in the array.
302
+ * @param {T[]|null|undefined} input - The array to be filtered.
303
+ * @returns {T[] | undefined} A new array with `null` and `undefined` values removed,
304
+ * or `undefined` if the input is explicitly `undefined` or `null`.
305
+ * @example
306
+ * ```ts
307
+ * filterNilArray([1, null, 2, undefined, 3]);
308
+ * // ➔ [1, 2, 3]
309
+ * filterNilArray([null, undefined]);
310
+ * // ➔ []
311
+ * filterNilArray(undefined);
312
+ * // ➔ undefined
313
+ * filterNilArray(null);
314
+ * // ➔ undefined
315
+ * filterNilArray([]); // or
316
+ * filterNilArray([[[]]]); // or
317
+ * filterNilArray([[[],undefined,null]]);
318
+ * // ➔ []
319
+ * filterNilArray([1, [null, 2, [undefined, 3]]]);
320
+ * // ➔ [1, [2, [3]]]
321
+ * ```
322
+ */
323
+ 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[];
315
324
  /** ---------------------------------
316
325
  * * ***Utility: `toBooleanContent`.***
317
326
  * ---------------------------------------------
@@ -324,7 +333,7 @@ declare function toStringArrayUnRecursive(array?:undefined|null,options?:ToStrin
324
333
  * - Arrays: `[]` is `false`, non-empty is `true`.
325
334
  * - Objects: `{}` is `false`, object with keys is `true`.
326
335
  * @param {*} value - The value to be converted.
327
- * @returns {boolean} `true` if the value is considered non-empty, otherwise `false`.
336
+ * @returns {boolean} Return `true` if the value is considered non-empty, otherwise `false`.
328
337
  * @example
329
338
  * toBooleanContent(null); // ➔ false
330
339
  * toBooleanContent(undefined); // ➔ false
@@ -357,7 +366,7 @@ declare const toBooleanContent:(value:unknown)=>boolean;
357
366
  * - Empty arrays `[]` or empty objects `{}` return `false`
358
367
  * - Checks deeply nested arrays/objects — if any value inside is "non-empty", returns `true`
359
368
  * @param {*} value - The value to check.
360
- * @returns {boolean} `true` if the value or anything nested inside is non-empty, otherwise `false`.
369
+ * @returns {boolean} Return `true` if the value or anything nested inside is non-empty, otherwise `false`.
361
370
  * @example
362
371
  * toBooleanContentDeep(null); // ➔ false
363
372
  * toBooleanContentDeep(""); // ➔ false
@@ -411,7 +420,7 @@ includeIndeterminate?:boolean;};
411
420
  * @param {ToBooleanExplicitOptions["caseInsensitive"]} [options.caseInsensitive=false] - Whether string comparison ignores case, default: `false`.
412
421
  * @param {ToBooleanExplicitOptions["trimString"]} [options.trimString=true] - Whether to trim whitespace before comparison, default: `true`.
413
422
  * @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`.
423
+ * @returns {boolean} Return `true` if the value matches a truthy representation, otherwise `false`.
415
424
  * @throws {TypeError} Throws if any option provided is not a boolean.
416
425
  * @example
417
426
  * toBooleanExplicit(1);
@@ -458,7 +467,7 @@ declare const toBooleanExplicit:(value:unknown,options?:ToBooleanExplicitOptions
458
467
  * - Arrays: `[]` is `false`, non-empty is `true`.
459
468
  * - Other objects: uses `Boolean(value)`, so `{}` is `true`.
460
469
  * @param {*} value - The value to be converted.
461
- * @returns {boolean} `true` if the value is truthy, otherwise `false`.
470
+ * @returns {boolean} Return `true` if the value is truthy, otherwise `false`.
462
471
  * @example
463
472
  * toBooleanLoose(null); // ➔ false
464
473
  * toBooleanLoose(""); // ➔ false
@@ -507,14 +516,13 @@ declare const toBooleanLoose:(value:unknown)=>boolean;
507
516
  * - You can use this function as a first step to **sanitize currency inputs**
508
517
  * before storing into database or doing math.
509
518
  * - 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.
519
+ * @param {string|null|undefined} input
520
+ * ***Any messy currency string, may contain:***
521
+ * * Currency symbols (`Rp`,`$`, `CHF`, `EUR`).
522
+ * * Thousands separators (`.`, `,`, `'`, `space`, `\u00A0`, `\u202F`).
523
+ * * Various decimal formats (`,` or `.`).
524
+ * * Bracket negative: `"(15.000,10)"`.
525
+ * @returns {number} JavaScript float representation, will return `0` for invalid, empty, or non-string input.
518
526
  * @example
519
527
  * ```ts
520
528
  * parseCurrencyString("Rp 15.300.000,21");
@@ -570,81 +578,111 @@ declare const parseCurrencyString:(input:string|null|undefined)=>number;
570
578
  * convertType(NaN); // ➔ NaN
571
579
  * convertType({}); // ➔ {}
572
580
  */
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;
581
+ declare const convertType:(value:unknown)=>unknown;
574
582
  /** --------------------------------------------------
575
583
  * * ***Options for cleaning and transforming parsed JSON data.***
576
584
  * --------------------------------------------------
585
+ *
586
+ * @private Type Options Validation for Function: {@link cleanParsedData | `cleanParsedData`}, {@link parseCustomDate | `parseCustomDate`} and {@link safeJsonParse | `safeJsonParse`}.
577
587
  */
578
588
  type ParseParsedDataOptions={
579
- /** Convert numeric strings to numbers (e.g., `"42"` ➔ `42`), defaultValue: `false`.
589
+ /** --------------------------------------------------
590
+ * * ***Convert numeric strings to numbers (e.g., `"42"` ➔ `42`), defaultValue: `false`.***
591
+ * --------------------------------------------------
580
592
  *
581
593
  * @default false
582
594
  */
583
595
  convertNumbers?:boolean;
584
- /** Convert numeric strings "NaN" to NaN (e.g., `"NaN"` ➔ `NaN`), defaultValue: `false`.
596
+ /** --------------------------------------------------
597
+ * * ***Convert numeric strings `"NaN"` to `NaN` (e.g., `"NaN"` ➔ `NaN`), defaultValue: `false`.***
598
+ * --------------------------------------------------
585
599
  *
586
600
  * @default false
587
601
  */
588
602
  convertNaN?:boolean;
589
- /** Convert `"true"` / `"false"` strings to boolean values, defaultValue: `false`.
603
+ /** --------------------------------------------------
604
+ * * ***Convert `"true"` / `"false"` strings to boolean values, defaultValue: `false`.***
605
+ * --------------------------------------------------
590
606
  *
591
607
  * @default false
592
608
  */
593
609
  convertBooleans?:boolean;
594
- /** Convert valid date strings into `Date` objects, defaultValue: `false`.
610
+ /** --------------------------------------------------
611
+ * * ***Convert valid date strings into `Date` objects, defaultValue: `false`.***
612
+ * --------------------------------------------------
595
613
  *
596
614
  * @default false
597
615
  */
598
616
  convertDates?:boolean;
599
- /** Custom date formats to be parsed (e.g., `["DD/MM/YYYY", "MM/DD/YYYY"]`), defaultValue: `[]`.
617
+ /** --------------------------------------------------
618
+ * * ***Custom date formats to be parsed (e.g., `["DD/MM/YYYY", "MM/DD/YYYY"]`), defaultValue: `[]`.***
619
+ * --------------------------------------------------
600
620
  *
601
621
  * @default []
602
622
  */
603
623
  customDateFormats?:string[];
604
- /** Remove `null` values from objects and arrays, defaultValue: `false`.
624
+ /** --------------------------------------------------
625
+ * * ***Remove `null` values from objects and arrays, defaultValue: `false`.***
626
+ * --------------------------------------------------
605
627
  *
606
628
  * @default false
607
629
  */
608
630
  removeNulls?:boolean;
609
- /** Remove `undefined` values from objects and arrays, defaultValue: `false`.
631
+ /** --------------------------------------------------
632
+ * * ***Remove `undefined` values from objects and arrays, defaultValue: `false`.***
633
+ * --------------------------------------------------
610
634
  *
611
- * - `false` (default): replaces `undefined` with `null`
612
- * - `true`: removes keys with `undefined` values
635
+ * - ***Behavior:***
636
+ * - `false` (**default**): replaces `undefined` with `null`.
637
+ * - `true`: removes keys with `undefined` values.
613
638
  *
614
639
  * @default false
615
640
  */
616
641
  removeUndefined?:boolean;
617
- /** Remove empty objects `{}` from the final output, defaultValue: `false`.
642
+ /** --------------------------------------------------
643
+ * * ***Remove empty objects `{}` from the final output, defaultValue: `false`.***
644
+ * --------------------------------------------------
618
645
  *
619
646
  * @default false
620
647
  */
621
648
  removeEmptyObjects?:boolean;
622
- /** Remove empty arrays `[]` from the final output, defaultValue: `false`.
649
+ /** --------------------------------------------------
650
+ * * ***Remove empty arrays `[]` from the final output, defaultValue: `false`.***
651
+ * --------------------------------------------------
623
652
  *
624
653
  * @default false
625
654
  */
626
655
  removeEmptyArrays?:boolean;
627
- /** Strict mode: Removes values that do not match selected conversions, defaultValue: `false`.
656
+ /** --------------------------------------------------
657
+ * * ***Removes values that do not match selected conversions, defaultValue: `false`.***
658
+ * --------------------------------------------------
628
659
  *
629
660
  * @default false
630
661
  */
631
662
  strictMode?:boolean;
632
- /** Enable error logging if JSON parsing fails, defaultValue: `false`.
663
+ /** --------------------------------------------------
664
+ * * ***Enable error logging if JSON parsing fails, defaultValue: `false`.***
665
+ * --------------------------------------------------
633
666
  *
634
667
  * @default false
635
668
  */
636
669
  loggingOnFail?:boolean;
637
- /** Custom error handler function.
638
- *
639
- * - If provided, it will be called with the error.
670
+ /** --------------------------------------------------
671
+ * * ***Custom error handler function.***
672
+ * --------------------------------------------------
640
673
  *
641
- * - If not provided, defaults to `undefined` in type, but internally a no-op function is used.
674
+ * - ***Behavior:***
675
+ * - If provided, it will be called with the error.
676
+ * - If not provided, defaults to `undefined` in type, but internally a no-op function is used.
642
677
  *
678
+ * @param error - Error instance thrown during fail on execution.
643
679
  * @default undefined
644
680
  */
645
681
  onError?:(error:Error)=>void;
646
- /**
647
- * Whether to check symbol properties when checking empty objects.
682
+ /** --------------------------------------------------
683
+ * * ***Whether to check symbol properties when checking empty objects.***
684
+ * --------------------------------------------------
685
+ *
648
686
  * @default false
649
687
  */
650
688
  checkSymbols?:boolean;};
@@ -654,7 +692,7 @@ checkSymbols?:boolean;};
654
692
  * **Cleans parsed JSON data based on provided options.**
655
693
  * @template T - Expected output type.
656
694
  * @param {*} data - The parsed JSON data.
657
- * @param {ParseParsedDataOptions} [options] - Cleaning options.
695
+ * @param {ParseParsedDataOptions} [options] - The cleaning options.
658
696
  * @returns {T | null | undefined} The cleaned data.
659
697
  * - ***⚠️ Notice:*** _If data is JSON string, we recommend use **{@link safeJsonParse | `safeJsonParse`}** for more safe._
660
698
  * - ***⚠️ Note:*** _If using **`convertDates`** **options**, result may contain Date objects, you may need type assertions in strict TypeScript settings._
@@ -703,7 +741,11 @@ declare const cleanParsedData:<T=unknown>(data:T,options?:ParseParsedDataOptions
703
741
  * parseCustomDate(123, "DD/MM/YYYY");
704
742
  * // ➔ TypeError: Parameter `dateString` and `format` must be of type `string`...
705
743
  */
706
- declare const parseCustomDate:(dateString:string,format:string)=>Date|null;
744
+ declare const parseCustomDate:(dateString:string,format:string)=>Date|null;type NonJsonParsableType=Omit<Exclude<unknown,string|null|undefined>,string>;type Contains<T,U>=[Extract<T,U>] extends [never]?false:true;
745
+ /** @private ***The value type for the overload function {@link safeJsonParse | `safeJsonParse`}.*** */
746
+ type UnknownValue={undefined:true;};
747
+ /** @private ***The narrows type result for {@link safeJsonParse | `safeJsonParse`}.*** */
748
+ 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;
707
749
  /** --------------------------------------------------
708
750
  * * ***Utility: `safeJsonParse`.***
709
751
  * ---------------------------------------------
@@ -877,11 +919,9 @@ declare function safeJsonParse<TData extends Record<string,any>=Record<string,un
877
919
  * - Returns the cleaned numeric value as a `number`.
878
920
  * - 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
921
  * @param {*} [value]
880
- * The value to process.
922
+ * **The value to process.**
881
923
  * - 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.
924
+ * @returns {number} The numeric value after extracting digits (returns `0` if input is invalid or contains no digits).
885
925
  * @example
886
926
  * extractDigits(12345); // ➔ 12345
887
927
  * extractDigits("9A8B7C6X1"); // ➔ 98761
@@ -899,13 +939,16 @@ declare function safeJsonParse<TData extends Record<string,any>=Record<string,un
899
939
  * extractDigits("abc"); // ➔ 0
900
940
  * extractDigits(" 00a "); // ➔ 0
901
941
  */
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
- /** The dot-notation path to the property that should be removed.
904
- * Can target deeply nested properties (e.g., `"left.data.sensitive"`).
942
+ 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 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;
943
+ /** @private ***Types options for {@link removeObjectPaths | `removeObjectPaths`}.*** */
944
+ type ConfigRemoveObjectPaths<T>={
945
+ /** ------------------------------------------------------------------------
946
+ * * ***The dot-notation path to the property that should be removed.
947
+ * Can target deeply nested properties (e.g., `"left.data.sensitive"`).***
948
+ * ------------------------------------------------------------------------
949
+ * **This is resolved relative to the root object `T`, and supports
950
+ * any valid **{@link DotPath | `DotPath`}** path within it.**
905
951
  *
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
952
  * @example
910
953
  * const obj = {
911
954
  * left: { data: { sensitive: "secret", id: 1 } },
@@ -924,11 +967,12 @@ declare const extractDigits:(value:unknown)=>number;type Prev=[never,NumberRange
924
967
  * // };
925
968
  */
926
969
  key:DotPath<T>;
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.
970
+ /** ------------------------------------------------------------------------
971
+ * * ***When `true`, removes the specified property from **all matching nested levels**,
972
+ * including occurrences inside arrays, defaults to `false` for single-level removal.***
973
+ * ------------------------------------------------------------------------
974
+ * **Useful if the target property might appear multiple times across different
975
+ * branches or array elements.**
932
976
  * @default false
933
977
  * @example
934
978
  * const obj = {
@@ -950,7 +994,9 @@ key:DotPath<T>;
950
994
  * // ]
951
995
  * // };
952
996
  */
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;}>;
997
+ deep?:boolean;};
998
+ /** @private ***Narrows types result for {@link removeObjectPaths | `removeObjectPaths`}.*** */
999
+ 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
1000
  /** ------------------------------------------------------------------------
955
1001
  * * ***Utility: `removeObjectPaths`.***
956
1002
  * ------------------------------------------------------------------------
@@ -971,13 +1017,13 @@ deep?:boolean;};type KeysToRemove<T,K extends readonly ConfigRemoveObjectPaths<T
971
1017
  * - If `keysToDelete` is not an array of `{ key, deep? }` objects, throws a `TypeError`.
972
1018
  * - Ignores invalid intermediate paths (will skip those branches without throwing).
973
1019
  * @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 `{}`.
1020
+ * @param {Record<string, unknown>} object - ***The object to remove keys from, must be an object or will return `{}`.***
975
1021
  * @param {ConfigRemoveObjectPaths<T>[]} keysToDelete
976
- * An array of instructions:
1022
+ * ***An array of instructions:***
977
1023
  * - `key`: A string path using dot notation (e.g. `"user.profile.name"`).
978
1024
  * - `deep`: If `true`, will recursively remove all instances of the key path at any depth, defaultValue: `false`.
979
1025
  * @param {boolean|undefined} [deepClone=true]
980
- * Whether to deep clone the original object before modifying.
1026
+ * ***Whether to deep clone the original object before modifying.***
981
1027
  * - `true` (default): returns a *new object* with the specified keys removed.
982
1028
  * - `false`: modifies the original object in place and returns it.
983
1029
  * @returns {Partial<T>}
@@ -1026,11 +1072,13 @@ deep?:boolean;};type KeysToRemove<T,K extends readonly ConfigRemoveObjectPaths<T
1026
1072
  */
1027
1073
  declare function removeObjectPaths<T extends Record<string,unknown>,K extends ConfigRemoveObjectPaths<T>[]>(object:T,keysToDelete:K,deepClone?:boolean):ResultRemoveObjectPaths<T,K>;
1028
1074
  /** -------------------------------------------------
1029
- * * ***Options for **{@link safeStableStringify | `safeStableStringify`}**.***
1075
+ * * ***Type Options for **{@link safeStableStringify | `safeStableStringify`}**.***
1030
1076
  * -------------------------------------------------
1031
1077
  */
1032
1078
  type SafeStableStringifyOptions={
1033
- /** Whether to sort **object keys** alphabetically (recursively).
1079
+ /** -------------------------------------------------
1080
+ * * ***Whether to sort **object keys** alphabetically (recursively).***
1081
+ * -------------------------------------------------
1034
1082
  *
1035
1083
  * - `true` (default): object keys are sorted to ensure stable output.
1036
1084
  * - `false`: preserves original insertion order of keys.
@@ -1038,7 +1086,9 @@ type SafeStableStringifyOptions={
1038
1086
  * @default true
1039
1087
  */
1040
1088
  sortKeys?:boolean;
1041
- /** Whether to sort **primitive values inside arrays**.
1089
+ /** -------------------------------------------------
1090
+ * * ***Whether to sort **primitive values inside arrays**.***
1091
+ * -------------------------------------------------
1042
1092
  *
1043
1093
  * - `true`: primitive values in arrays are sorted to ensure stable output.
1044
1094
  * - `false` (default): arrays retain their original order; objects and nested arrays are not reordered.
@@ -1046,14 +1096,46 @@ sortKeys?:boolean;
1046
1096
  * @default false
1047
1097
  */
1048
1098
  sortArray?:boolean;
1049
- /** Whether to pretty-print JSON output with 2-space indentation.
1099
+ /** -------------------------------------------------
1100
+ * * ***Whether to pretty-print JSON output with 2-space indentation.***
1101
+ * -------------------------------------------------
1050
1102
  *
1051
1103
  * - `true`: output is formatted with indentation and newlines.
1052
1104
  * - `false` (default): produces compact single-line JSON.
1053
1105
  *
1054
1106
  * @default false
1055
1107
  */
1056
- pretty?:boolean;};
1108
+ pretty?:boolean;
1109
+ /** -------------------------------------------------
1110
+ * * ***Preserve `undefined` values instead of converting them to `null`.***
1111
+ * -------------------------------------------------
1112
+ * **Controls how the internal `deepProcess` step rewrites values
1113
+ * **before** the final `JSON.stringify` call.**
1114
+ * - **Default (`false`):**
1115
+ * * Every `undefined` value (object properties **and** array elements)
1116
+ * is replaced with `null` **before** serialization, because this happens
1117
+ * first, the key is **not removed** by `JSON.stringify`.
1118
+ * - **`true`** – Leaves `undefined` untouched so the final
1119
+ * `JSON.stringify` call behaves natively:
1120
+ * * Object properties with `undefined` are **removed**.
1121
+ * * Array elements that are `undefined` become `null`.
1122
+ * @default false
1123
+ * @example
1124
+ * // ✅ keepUndefined = true: behaves like native JSON.stringify
1125
+ * safeStableStringify({ a: undefined }, { keepUndefined: true });
1126
+ * // ➔ '{}' // key removed
1127
+ *
1128
+ * // ✅ Default (false): convert undefined to null, key kept
1129
+ * safeStableStringify({ a: undefined });
1130
+ * // ➔ '{"a":null}' // key present, value null
1131
+ *
1132
+ * // Arrays
1133
+ * safeStableStringify([undefined]);
1134
+ * // ➔ '[null]' // same, but via pre-replacement
1135
+ * safeStableStringify([undefined], { keepUndefined: true });
1136
+ * // ➔ '[null]' // element becomes null
1137
+ */
1138
+ keepUndefined?:boolean;};
1057
1139
  /** --------------------------------------------
1058
1140
  * * ***Utility: `safeStableStringify`.***
1059
1141
  * ---------------------------------------------
@@ -1068,8 +1150,8 @@ pretty?:boolean;};
1068
1150
  * - Objects and nested arrays keep their original position and are appended after sorted primitives.
1069
1151
  * - If `sortArray` is `false`, arrays retain their original order.
1070
1152
  * - Converts JavaScript special values for JSON safety:
1071
- * - `undefined`, `NaN`, `Infinity`, `-Infinity` ➔ `null`
1072
- * - `BigInt` ➔ string (JSON does not support BigInt)
1153
+ * - `undefined`, `NaN`, `Infinity`, `-Infinity` ➔ `null`.
1154
+ * - `BigInt` ➔ string (JSON does not support BigInt).
1073
1155
  * - Converts boxed primitives box into their primitive equivalents:
1074
1156
  * - `new Number(42)` ➔ `Number(42)` ➔ `42`.
1075
1157
  * - `new String("hi")` ➔ `String("hi")` ➔ `"hi"`.
@@ -1077,21 +1159,32 @@ pretty?:boolean;};
1077
1159
  * - Functions and Symbols are removed.
1078
1160
  * - Circular references are replaced with the string `"[Circular]"`.
1079
1161
  * - Serializes:
1080
- * - `Date` ➔ ISO string (`date.toISOString()`)
1081
- * - `Set` ➔ `{ set: [values...] }` (values are recursively processed)
1082
- * - `Map` ➔ `{ map: [ [key, value], ... ] }` (values are recursively processed)
1162
+ * - `Date` ➔ ISO string (`date.toISOString()`).
1163
+ * - `Set` ➔ `{ set: [values...] }` (values are recursively processed).
1164
+ * - `Map` ➔ `{ map: [ [key, value], ... ] }` (values are recursively processed).
1083
1165
  * - Compared to `JSON.stringify`, this ensures **stable output**:
1084
1166
  * - Same object structure always produces the same string.
1085
1167
  * - Useful for deep equality checks, hashing, caching keys, or snapshot tests.
1168
+ * - Controls how `undefined` is handled **before** the final `JSON.stringify` call, by `keepUndefined`
1169
+ * options, default: `false`.
1170
+ * - **false**: All `undefined` values (object properties and array elements) are replaced
1171
+ * with `null`, so object keys remain.
1172
+ * - **true**: Leaves `undefined` values as-is, and handling by native `JSON.stringify` then:
1173
+ * 1. Removes object properties that are `undefined`.
1174
+ * 2. Converts `undefined` array elements to `null`.
1175
+ * - Use `true` when you need native removal of keys or to preserve sparse arrays
1176
+ * exactly as `JSON.stringify` would.
1086
1177
  * @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
1178
+ * ***Any JavaScript value to serialize, can be:***
1179
+ * - Primitives (`number`, `string`, `boolean`, `bigint`, `null`, `undefined`).
1180
+ * - Boxed primitives (`new Number()`, `new String()`, `new Boolean()`).
1181
+ * - Arrays, plain objects, nested structures.
1182
+ * - Date, Map, Set.
1183
+ * - Circular structures.
1093
1184
  * @param {SafeStableStringifyOptions} [options]
1094
- * - Configuration options for `safeStableStringify`:
1185
+ * ***Configuration options for `safeStableStringify`:***
1186
+ * - `keepUndefined` (boolean) – Control how `undefined` is handled **before** the final `JSON.stringify`
1187
+ * call, default: `false`.
1095
1188
  * - `sortKeys` (boolean) – Whether to sort object keys alphabetically (recursively), default: `true`.
1096
1189
  * - `sortArray` (boolean) – Whether to sort primitive values inside arrays, default: `false`.
1097
1190
  * - `pretty` (boolean) – Whether to pretty-print JSON output with 2-space indentation, default: `false`.
@@ -1117,6 +1210,14 @@ pretty?:boolean;};
1117
1210
  * });
1118
1211
  * // ➔ '[1,2,3]'
1119
1212
  *
1213
+ * // keepUndefined = true (native removal of keys)
1214
+ * safeStableStringify({ a: undefined }, { keepUndefined: true });
1215
+ * // ➔ '{}' // key `a` is removed, like native JSON.stringify
1216
+ *
1217
+ * // Default keepUndefined = false (convert to null, keep key)
1218
+ * safeStableStringify({ a: undefined });
1219
+ * // ➔ '{"a":null}'
1220
+ *
1120
1221
  * // Nested object + sortArray=true
1121
1222
  * safeStableStringify({ z: [3, 1, 2], x: { d: 4, c: 3 } }, {
1122
1223
  * sortKeys:true,
@@ -1158,7 +1259,7 @@ pretty?:boolean;};
1158
1259
  * safeStableStringify({ f: () => {}, s: Symbol("wow") });
1159
1260
  * // ➔ '{}'
1160
1261
  *
1161
- * // undefined, NaN, Infinity convert to null
1262
+ * // undefined, NaN, Infinity convert to null (keepUndefined = false or keepUndefined = true)
1162
1263
  * safeStableStringify([undefined, NaN, Infinity, -Infinity]);
1163
1264
  * // ➔ '[null,null,null,null]'
1164
1265
  *
@@ -1175,64 +1276,11 @@ pretty?:boolean;};
1175
1276
  * ```
1176
1277
  */
1177
1278
  declare const safeStableStringify:(value:unknown,options?:SafeStableStringifyOptions)=>string;
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
- */
1230
- declare function toStringDeepForce(value:unknown,forceToString:false|"stringOrNumber"|"primitives"|"all"):unknown;
1231
1279
  /** ----------------------------------------------------------
1232
1280
  * * Normalize leaked `never[]` into literal empty array `[]`.
1233
1281
  * ----------------------------------------------------------
1234
1282
  */
1235
- type FixNeverArray$1<T>=[T] extends [never[]]?[]:T;
1283
+ type FixNeverArray$1<T,RemoveEmptyArrays extends boolean>=[T] extends [never[]]?RemoveEmptyArrays extends true?OrArr<[Extends<T,undefined>,Extends<undefined,T>]>extends true?undefined:never:[]:T;
1236
1284
  /** ----------------------------------------------------------
1237
1285
  * * Simplify object type to remove unnecessary TypeScript wrappers.
1238
1286
  * ----------------------------------------------------------
@@ -1249,24 +1297,22 @@ type Simplify$1<T>=T extends object?{[K in keyof T]:T[K];}:T;
1249
1297
  * @template RemoveEmptyArrays - Whether to remove empty arrays
1250
1298
  * @template IsRoot - Internal flag for root level
1251
1299
  */
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
- /** ----------------------------------------------------------
1254
- * * Recursively map tuples while preserving `never` removals.
1255
- * ----------------------------------------------------------
1256
- */
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:[];
1300
+ type ConvertedDeepNumberInternal<T,RemoveEmptyObjects extends boolean,RemoveEmptyArrays extends boolean,IsRoot extends boolean>=[T] extends [null|undefined]?IsRoot extends true?undefined:never:T extends Date|boolean|Boolean?number:T extends string|String|Number|number|`${number}`?number|undefined:AndArr<[Extends<RemoveEmptyArrays,true>,Extends<T,undefined[]>]>extends true?never:T extends readonly(infer E)[]?OrArr<[ Extends<RemoveEmptyArrays,true>,AndArr<[Extends<RemoveEmptyArrays,true>,Extends<IsRoot,true>]>]>extends true?FixNeverArray$1<Exclude<ConvertedDeepNumberInternal<E,RemoveEmptyObjects,RemoveEmptyArrays,IsRoot>,undefined>,RemoveEmptyArrays>[]|undefined:FixNeverArray$1<Exclude<ConvertedDeepNumberInternal<E,RemoveEmptyObjects,RemoveEmptyArrays,IsRoot>,undefined>[],RemoveEmptyArrays>:T extends Set<infer V>?AndArr<[Extends<RemoveEmptyArrays,true>]>extends true?FixNeverArray$1<Exclude<ConvertedDeepNumberInternal<V,RemoveEmptyObjects,RemoveEmptyArrays,IsRoot>,undefined>[],RemoveEmptyArrays>:FixNeverArray$1<Exclude<ConvertedDeepNumberInternal<V,RemoveEmptyObjects,RemoveEmptyArrays,IsRoot>,undefined>[],RemoveEmptyArrays>:T extends Map<infer K,infer V>?FixNeverArray$1<[ Exclude<ConvertedDeepNumberInternal<K,RemoveEmptyObjects,RemoveEmptyArrays,IsRoot>,undefined>,Exclude<ConvertedDeepNumberInternal<V,RemoveEmptyObjects,RemoveEmptyArrays,IsRoot>,undefined>][],RemoveEmptyArrays>:T extends Buffer?FixNeverArray$1<Exclude<ConvertedDeepNumberInternal<string,RemoveEmptyObjects,RemoveEmptyArrays,IsRoot>,undefined>[],RemoveEmptyArrays>:T extends TypedArray?FixNeverArray$1<Exclude<ConvertedDeepNumberInternal<string,RemoveEmptyObjects,RemoveEmptyArrays,IsRoot>,undefined>[],RemoveEmptyArrays>:T extends Record<PropertyKey,unknown>?_ConvertedObjectInternal$1<T,RemoveEmptyObjects,RemoveEmptyArrays,IsRoot>:never;
1258
1301
  /** ----------------------------------------------------------
1259
1302
  * * Internal object conversion utility.
1260
1303
  * * Removes empty objects/arrays based on flags.
1261
1304
  * ----------------------------------------------------------
1262
1305
  */
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;
1306
+ type _ConvertedObjectInternal$1<O extends Record<PropertyKey,unknown>|string|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,IsRoot>?never:RemoveEmptyArrays extends true?Convert extends readonly unknown[]?[Convert] extends [[]]?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,IsRoot>?RemoveEmptyArrays extends true?Convert extends readonly unknown[]?[Convert] extends [[]]?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:_ProcessedObject$1<M,RemoveEmptyObjects,RemoveEmptyArrays,IsRoot>:Simplify$1<M>:never;type AllPropsAreNumber$1<O>={[K in keyof O]:O[K] extends number|Number?true:O[K] extends Record<string,unknown>?AllPropsAreNumber$1<O[K]>:false;}[keyof O] extends false?false:true;type _ProcessedObject$1<M,RemoveEmptyObjects extends boolean,RemoveEmptyArrays extends boolean,IsRoot extends boolean>=M extends unknown[]?ConvertedDeepNumberInternal<M,RemoveEmptyObjects,RemoveEmptyArrays,IsRoot>:Prettify<Simplify$1<{[K in keyof M]:M[K] extends Record<string,unknown>?AllPropsAreNumber$1<M[K]>extends true?{[ChildKey in keyof M[K]]:M[K][ChildKey] extends number|Number?M[K][ChildKey]|undefined:_ProcessedObject$1<M[K][ChildKey],RemoveEmptyObjects,RemoveEmptyArrays,IsRoot>;}|undefined:AndArr<[ Extends<RemoveEmptyArrays,true>,Extends<RemoveEmptyObjects,true>]>extends true?{[ChildKey in keyof M[K]]:_ProcessChild$1<M[K][ChildKey],RemoveEmptyObjects,RemoveEmptyArrays,IsRoot>;}|undefined:{[ChildKey in keyof M[K]]:_ProcessChild$1<M[K][ChildKey],RemoveEmptyObjects,RemoveEmptyArrays,IsRoot>;}:M[K] extends unknown[]?ConvertedDeepNumberInternal<M[K],RemoveEmptyObjects,RemoveEmptyArrays,false>:_ProcessedObject$1<M[K],RemoveEmptyObjects,RemoveEmptyArrays,IsRoot>;}>,{recursive:true;}>;type _ProcessChild$1<T,RemoveEmptyObjects extends boolean,RemoveEmptyArrays extends boolean,IsRoot extends boolean>=T extends number|number[]?ConvertedDeepNumberInternal<T,RemoveEmptyObjects,RemoveEmptyArrays,IsRoot>:T extends Record<string,unknown>?_ProcessedObject$1<T,RemoveEmptyObjects,RemoveEmptyArrays,IsRoot>:_ProcessedObject$1<T,RemoveEmptyObjects,RemoveEmptyArrays,IsRoot>;
1264
1307
  /** ----------------------------------------------------------
1265
1308
  * * Public type: Deeply converts numbers/strings to `number | undefined`,
1266
1309
  * * applies empty object/array removal, preserves special types.
1267
1310
  * ----------------------------------------------------------
1311
+ * @private ***Narrows types result for {@link toNumberDeep | `toNumberDeep`}.***
1268
1312
  */
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>={
1313
+ type ConvertedDeepNumber<T,RemoveEmptyObjects extends boolean=false,RemoveEmptyArrays extends boolean=false>=[unknown] extends [T]?unknown:FixNeverArray$1<ConvertedDeepNumberInternal<T,RemoveEmptyObjects,RemoveEmptyArrays,true>,RemoveEmptyArrays>;
1314
+ /** @private ***Types options for {@link toNumberDeep | `toNumberDeep`}.*** */
1315
+ type ToNumberDeepOptions<RemoveEmptyObjects extends boolean=false,RemoveEmptyArrays extends boolean=false>={
1270
1316
  /** Whether to remove empty objects (`{}`) from the result.
1271
1317
  *
1272
1318
  * - `true` ➔ remove empty objects recursively.
@@ -1288,13 +1334,45 @@ removeEmptyArrays?:RemoveEmptyArrays;};
1288
1334
  * ---------------------------------------------------
1289
1335
  * **Converts deeply nested arrays, objects, buffers, sets, maps, or typed arrays into numbers while preserving structure.**
1290
1336
  * - **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`).
1337
+ * - Converts numeric strings, number to numbers:
1338
+ * - `3.5` `3.5`.
1339
+ * - `"3.5"` ➔ `3.5`.
1340
+ * - Converts boolean to number:
1341
+ * - `true` `1`.
1342
+ * - `false` `0`.
1343
+ * - Converts Date to getTime (timestamp) `Date number`, if invalid Date value will return `0`:
1344
+ * - `new Date("invalid")` ➔ `0`.
1345
+ * - `new Date("11-09-2025 22:04:11")` ➔ `1762700651000`.
1346
+ * - Converts `Buffer`, `TypedArray`, `Set`, `Map`, and `arrays` recursively to `arrays of numbers`.
1347
+ * - Converts boxed primitives box into their primitive equivalents then convert to number:
1348
+ * - For `new String` we convert everything to number (behavior JS of new String):
1349
+ * - `new String(123)` ➔ `.valueOf()` ➔ `"123"` ➔ `Number("123")` ➔ `123`.
1350
+ * - `new String("123")` ➔ `.valueOf()` ➔ `"123"` ➔ `Number("123")` ➔ `123`.
1351
+ * - `new String(true)` ➔ `.valueOf()` ➔ `"true"` ➔ `Number(true)` ➔ `1`.
1352
+ * - `new String(false)` ➔ `.valueOf()` ➔ `"false"` ➔ `Number(false)` ➔ `0`.
1353
+ * - If result from `valueOf()` is `NaN` or `Infinity` ***(will removing)***:
1354
+ * - `new String("hi")` ➔ `.valueOf()` ➔ `"hi"` ➔ `Number("hi")` ➔ `NaN` ***(remove)***.
1355
+ * - `new String(()=>{})` ➔ `.valueOf()` ➔ `"()=>{}"` ➔ `Number("()=>{}")` ➔ `NaN` ***(remove)***.
1356
+ * - For `new Boolean` we convert to boolean (behavior JS of new Boolean) then convert to number:
1357
+ * - `new Boolean(true)` ➔ `.valueOf()` ➔ `true` ➔ `Number(true)` ➔ `1`.
1358
+ * - `new Boolean(false)` ➔ `.valueOf()` ➔ `false` ➔ `Number(false)` ➔ `0`.
1359
+ * - Special behavior JS of new Boolean, return `false` **(convert to number: `0`)**
1360
+ * for `false`, (`0` / `-0`), `""` (empty-string),
1361
+ * `null`, `undefined`, `NaN`, otherwise `true` **(convert to number: `1`)**.
1362
+ * - For `new Number`:
1363
+ * - `new Number(42)` ➔ `.valueOf()` ➔ `42`.
1364
+ * - `new Number("42")` ➔ `.valueOf()` ➔ `42`.
1365
+ * - `new Number(null)` ➔ `.valueOf()` ➔ `0` (`null` is `0` behavior JS of new Number).
1366
+ * - If result from `valueOf()` is `NaN` or `Infinity` ***(will removing)***:
1367
+ * - `new Number(NaN)` ➔ `.valueOf()` ➔ `NaN` ***(remove)***.
1368
+ * - `new Number(undefined)` ➔ `.valueOf()` ➔ `NaN` ***(remove)***.
1369
+ * - `new Number(Infinity)` ➔ `.valueOf()` ➔ `Infinity` ***(remove)***.
1370
+ * - `new Number(-Infinity)` ➔ `.valueOf()` ➔ `-Infinity` ***(remove)***.
1371
+ * - Recursively processes `nested objects`, `arrays`, `buffers`, `sets`, `maps`, and `typed arrays`.
1372
+ * - Removes `empty-string`, `non-numeric strings`.
1373
+ * - Removes `null`, `undefined`, `NaN`, `Infinity`, `-Infinity`.
1374
+ * - Removes `unsupported` types like `functions` , `RegExp`, `symbols`, and `BigInt`.
1375
+ * - Can optionally remove empty arrays (`[]`) and/or empty objects (`{}`) **recursively**.
1298
1376
  * @template T - The input type.
1299
1377
  * @template RemoveEmptyObjects - Whether to remove empty objects.
1300
1378
  * @template RemoveEmptyArrays - Whether to remove empty arrays.
@@ -1335,7 +1413,7 @@ declare function toNumberDeep(input?:null|undefined,options?:ToNumberDeepOptions
1335
1413
  /** ----------------------------------------------------------
1336
1414
  * * Normalize leaked `never[]` into literal empty array `[]`.
1337
1415
  * ---------------------------------------------------------- */
1338
- type FixNeverArray<T,RemoveEmptyArrays extends boolean>=[T] extends [never[]]?RemoveEmptyArrays extends true?T extends undefined?undefined:never:[]:T;
1416
+ type FixNeverArray<T,RemoveEmptyArrays extends boolean>=[T] extends [never[]]?RemoveEmptyArrays extends true?OrArr<[Extends<T,undefined>,Extends<undefined,T>]>extends true?undefined:never:[]:T;
1339
1417
  /** ----------------------------------------------------------
1340
1418
  * * Simplify object type to remove unnecessary TypeScript wrappers.
1341
1419
  * ---------------------------------------------------------- */
@@ -1345,21 +1423,21 @@ type Simplify<T>=T extends object?{[K in keyof T]:T[K];}:T;
1345
1423
  * * recursively handling arrays, tuples, Sets, Maps, TypedArrays,
1346
1424
  * * Buffer, and objects. Special types like Date remain unchanged.
1347
1425
  * ---------------------------------------------------------- */
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
- /** ----------------------------------------------------------
1350
- * * Remove undefined and keep only items for tuples
1351
- * ---------------------------------------------------------- */
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:[];
1426
+ type ConvertedDeepStringInternal<T,RemoveEmptyObjects extends boolean,RemoveEmptyArrays extends boolean,IsRoot extends boolean>=[T] extends [null|undefined]?IsRoot extends true?undefined:never:T extends string|boolean|String|Boolean|Date|RegExp|WebApiObjects|IntlObjects|{[Symbol.toStringTag]:"Proxy";}|typeof Reflect?string:T extends Number|number|`${number}`?string|undefined:AndArr<[Extends<RemoveEmptyArrays,true>,Extends<T,undefined[]>]>extends true?never:T extends readonly(infer E)[]?OrArr<[ Extends<RemoveEmptyArrays,true>,AndArr<[Extends<RemoveEmptyArrays,true>,Extends<IsRoot,true>]>]>extends true?FixNeverArray<Exclude<ConvertedDeepStringInternal<E,RemoveEmptyObjects,RemoveEmptyArrays,IsRoot>,undefined>,RemoveEmptyArrays>[]|undefined:FixNeverArray<Exclude<ConvertedDeepStringInternal<E,RemoveEmptyObjects,RemoveEmptyArrays,IsRoot>,undefined>[],RemoveEmptyArrays>:T extends Set<infer V>?AndArr<[Extends<RemoveEmptyArrays,true>]>extends true?FixNeverArray<Exclude<ConvertedDeepStringInternal<V,RemoveEmptyObjects,RemoveEmptyArrays,IsRoot>,undefined>,RemoveEmptyArrays>:FixNeverArray<Exclude<ConvertedDeepStringInternal<V,RemoveEmptyObjects,RemoveEmptyArrays,IsRoot>,undefined>[],RemoveEmptyArrays>:T extends Map<infer K,infer V>?FixNeverArray<[ Exclude<ConvertedDeepStringInternal<K,RemoveEmptyObjects,RemoveEmptyArrays,IsRoot>,undefined>,Exclude<ConvertedDeepStringInternal<V,RemoveEmptyObjects,RemoveEmptyArrays,IsRoot>,undefined>][],RemoveEmptyArrays>:T extends Buffer?FixNeverArray<Exclude<ConvertedDeepStringInternal<string,RemoveEmptyObjects,RemoveEmptyArrays,IsRoot>,undefined>[],RemoveEmptyArrays>:T extends TypedArray?FixNeverArray<Exclude<ConvertedDeepStringInternal<string,RemoveEmptyObjects,RemoveEmptyArrays,IsRoot>,undefined>[],RemoveEmptyArrays>:T extends Record<PropertyKey,unknown>?_ConvertedObjectInternal<T,RemoveEmptyObjects,RemoveEmptyArrays,IsRoot>:never;
1353
1427
  /** ----------------------------------------------------------
1354
1428
  * * Internal object conversion utility.
1355
1429
  * * Removes empty objects/arrays based on flags.
1356
1430
  * ---------------------------------------------------------- */
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;
1431
+ 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:_ProcessedObject<M,RemoveEmptyObjects,RemoveEmptyArrays,IsRoot>:Simplify<M>:never;type AllPropsAreNumber<O>={[K in keyof O]:O[K] extends number|Number?true:O[K] extends Record<string,unknown>?AllPropsAreNumber<O[K]>:false;}[keyof O] extends false?false:true;type _ProcessedObject<M,RemoveEmptyObjects extends boolean,RemoveEmptyArrays extends boolean,IsRoot extends boolean>=M extends unknown[]?ConvertedDeepStringInternal<M,RemoveEmptyObjects,RemoveEmptyArrays,IsRoot>:Prettify<Simplify<{[K in keyof M]:M[K] extends Record<string,unknown>?AllPropsAreNumber<M[K]>extends true?{[ChildKey in keyof M[K]]:M[K][ChildKey] extends number|Number?M[K][ChildKey]|undefined:_ProcessedObject<M[K][ChildKey],RemoveEmptyObjects,RemoveEmptyArrays,IsRoot>;}|undefined:AndArr<[ Extends<RemoveEmptyArrays,true>,Extends<RemoveEmptyObjects,true>]>extends true?{[ChildKey in keyof M[K]]:_ProcessChild<M[K][ChildKey],RemoveEmptyObjects,RemoveEmptyArrays,IsRoot>;}|undefined:{[ChildKey in keyof M[K]]:_ProcessChild<M[K][ChildKey],RemoveEmptyObjects,RemoveEmptyArrays,IsRoot>;}:M[K] extends unknown[]?ConvertedDeepStringInternal<M[K],RemoveEmptyObjects,RemoveEmptyArrays,IsRoot>:_ProcessedObject<M[K],RemoveEmptyObjects,RemoveEmptyArrays,IsRoot>;}>,{recursive:true;}>;type _ProcessChild<T,RemoveEmptyObjects extends boolean,RemoveEmptyArrays extends boolean,IsRoot extends boolean>=T extends number|Number[]?ConvertedDeepStringInternal<T,RemoveEmptyObjects,RemoveEmptyArrays,IsRoot>:T extends Record<string,unknown>?_ProcessedObject<T,RemoveEmptyObjects,RemoveEmptyArrays,IsRoot>:_ProcessedObject<T,RemoveEmptyObjects,RemoveEmptyArrays,IsRoot>;
1358
1432
  /** ----------------------------------------------------------
1359
1433
  * * Public type: Deeply converts numbers/strings to `string`,
1360
1434
  * * applies empty object/array removal, preserves special types.
1361
- * ---------------------------------------------------------- */
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>={
1435
+ * ----------------------------------------------------------
1436
+ * @private ***Narrows types result for {@link toStringDeep | `toStringDeep`}.***
1437
+ */
1438
+ type ConvertedDeepString<T,RemoveEmptyObjects extends boolean=false,RemoveEmptyArrays extends boolean=false>=[unknown] extends [T]?unknown:FixNeverArray<Simplify<ConvertedDeepStringInternal<T,RemoveEmptyObjects,RemoveEmptyArrays,true>>,RemoveEmptyArrays>;
1439
+ /** @private ***Types options for {@link toStringDeep | `toStringDeep`}.*** */
1440
+ type ToStringDeepOptions<RemoveEmptyObjects extends boolean=false,RemoveEmptyArrays extends boolean=false>={
1363
1441
  /** Whether to remove empty objects (`{}`) from the result.
1364
1442
  *
1365
1443
  * - `true` ➔ remove empty objects recursively.
@@ -1381,15 +1459,39 @@ removeEmptyArrays?:RemoveEmptyArrays;};
1381
1459
  * ---------------------------------------------------
1382
1460
  * **Converts all values in an array, object, Set, Map, or deeply nested structure to string.**
1383
1461
  * - **Features:**
1384
- * - Converts numbers and strings to string (e.g., `123` ➔ `"123"`).
1462
+ * - Converts numbers and strings to string:
1463
+ * - `3.5` ➔ `"3.5"`.
1464
+ * - `"3.5"` ➔ `"3.5"`.
1465
+ * - Converts boolean to string:
1466
+ * - `true` ➔ `"true"`.
1467
+ * - `false` ➔ `"false"`.
1385
1468
  * - Converts Date to ISO string (`Date ➔ string`).
1386
1469
  * - Converts RegExp to string (e.g., `/abc/ ➔ "/abc/"`).
1387
- * - Converts Buffer, TypedArray, Set, Map, and arrays recursively to arrays of strings.
1470
+ * - Converts `Buffer`, `TypedArray`, `Set`, `Map`, and `arrays` recursively to `arrays of strings`.
1471
+ * - Converts boxed primitives box into their primitive equivalents then convert to string:
1472
+ * - For `new String` we convert everything to string (behavior JS of new String):
1473
+ * - `new String("hi")` ➔ `.valueOf()` ➔ `"hi"`.
1474
+ * - `new String(true)` ➔ `.valueOf()` ➔ `"true"`.
1475
+ * - For `new Boolean` we convert to boolean (behavior JS of new Boolean) then convert to string:
1476
+ * - `new Boolean(true)` ➔ `.valueOf()` ➔ `true` ➔ `true.toString()` ➔ `"true"`.
1477
+ * - Special behavior JS of new Boolean, return `false` **(convert to string: `"false"`)**
1478
+ * for `false`, (`0` / `-0`), `""` (empty-string), `null`, `undefined`, `NaN`, otherwise
1479
+ * `true` **(convert to string: `"true"`)**.
1480
+ * - For `new Number`:
1481
+ * - `new Number(42)` ➔ `.valueOf()` ➔ `42` ➔ `42.toString()` ➔ `"42"`.
1482
+ * - `new Number("42")` ➔ `.valueOf()` ➔ `42` ➔ `42.toString()` ➔ `"42"`.
1483
+ * - `new Number(null)` ➔ `.valueOf()` ➔ `0` (`null` is `0` behavior JS of new Number) ➔ `0.toString()` ➔ `"0"`.
1484
+ * - If result from `valueOf()` is `NaN` or `Infinity` ***(will removing)***:
1485
+ * - `new Number(NaN)` ➔ `.valueOf()` ➔ `NaN` ***(remove)***.
1486
+ * - `new Number("abc")` ➔ `.valueOf()` ➔ `NaN` ***(remove)***.
1487
+ * - `new Number(undefined)` ➔ `.valueOf()` ➔ `NaN` ***(remove)***.
1488
+ * - `new Number(Infinity)` ➔ `.valueOf()` ➔ `Infinity` ***(remove)***.
1489
+ * - `new Number(-Infinity)` ➔ `.valueOf()` ➔ `-Infinity` ***(remove)***.
1490
+ * - Recursively processes `nested objects`, `arrays`, `buffers`, `sets`, `maps`, and `typed arrays`.
1388
1491
  * - Removes `null`, `undefined`, `NaN`, `Infinity`, `-Infinity`.
1389
- * - Removes unsupported types like functions, symbols, and BigInt.
1390
- * - Recursively processes nested objects, arrays, Sets, and Maps.
1492
+ * - Removes `unsupported` types like `functions`, `symbols`, and `BigInt`.
1391
1493
  * - 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).
1494
+ * @template T - The input data type (`primitive`, `object`, `array`, `Set`, `Map`, or `any nested combination`).
1393
1495
  * @template RemoveEmptyObjects - If `true`, empty objects `{}` will be removed recursively.
1394
1496
  * @template RemoveEmptyArrays - If `true`, empty arrays `[]` will be removed recursively (including arrays nested in `objects` / `arrays` / `Sets` / `Maps`).
1395
1497
  * @param {*} input - The data to convert.
@@ -1402,13 +1504,23 @@ removeEmptyArrays?:RemoveEmptyArrays;};
1402
1504
  * toStringDeep([1, "2", 3]);
1403
1505
  * // ➔ ["1", "2", "3"]
1404
1506
  *
1507
+ * // Simple top-level conversion
1508
+ * toStringDeep(123);
1509
+ * // ➔ "123"
1510
+ * toStringDeep("123");
1511
+ * // ➔ "123"
1512
+ * toStringDeep(true);
1513
+ * // ➔ "true"
1514
+ * toStringDeep(false);
1515
+ * // ➔ "false"
1516
+ *
1405
1517
  * // Nested arrays
1406
- * toStringDeep([1, ["2", [3, [null, "4"]]]]);
1407
- * // ➔ ["1", ["2", ["3", ["4"]]]]
1518
+ * toStringDeep([1, ["2", [3, [null, "4", true, false]]]]);
1519
+ * // ➔ ["1", ["2", ["3", ["4", "true", "false"]]]]
1408
1520
  *
1409
1521
  * // Object with nested values
1410
- * toStringDeep({ a: 1, b: "2", c: { d: 3, e: null } });
1411
- * // ➔ { a: "1", b: "2", c: { d: "3" } }
1522
+ * toStringDeep({ a: 1, b: "2", c: { d: 3, e: null, f: true, g: false } });
1523
+ * // ➔ { a: "1", b: "2", c: { d: "3", f: "true", g: "false" } }
1412
1524
  *
1413
1525
  * // Removing empty objects
1414
1526
  * toStringDeep({ a: {}, b: "1" }, { removeEmptyObjects: true });
@@ -1433,4 +1545,86 @@ removeEmptyArrays?:RemoveEmptyArrays;};
1433
1545
  * // ➔ undefined
1434
1546
  * ```
1435
1547
  */
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};
1548
+ 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>;
1549
+ /** ----------------------------------------------------------
1550
+ * * ***Utility: `toStringDeepForce`.***
1551
+ * ---------------------------------------------
1552
+ * **Recursively converts a value into a string based on the `forceToString` options.**
1553
+ * - **Rules `forceToString` options:**
1554
+ * - `"stringOrNumber"`: Converts strings and numbers to strings.
1555
+ * - `"primitives"`: Converts all primitives (number, string, boolean, bigint, undefined, null, NaN) to strings.
1556
+ * - `"all"`: Converts everything, including symbols, functions, Dates, RegExp, Maps, Sets, Errors, Promises,
1557
+ * boxed primitives box (new Number, new String, new Boolean), and deeply all object properties, to strings.
1558
+ * - `false`: Leaves everything unchanged.
1559
+ * - **Special behaviors:**
1560
+ * - `NaN` ➔ `"NaN"` only in `"primitives"` or `"all"` mode.
1561
+ * - `Date` ➔ ISO string only in `"all"` mode.
1562
+ * - ***Primitives Boxed*** (`new Number`, `new String`, `new Boolean`):
1563
+ * - For `new String` we convert everything to string (behavior JS of new String):
1564
+ * - `new String("hi")` ➔ `.valueOf()` ➔ `"hi"`.
1565
+ * - `new String(true)` ➔ `.valueOf()` ➔ `"true"`.
1566
+ * - For `new Boolean` we convert to boolean (behavior JS of new Boolean) then convert to string:
1567
+ * - `new Boolean(true)` ➔ `.valueOf()` ➔ `true` ➔ `true.toString()` ➔ `"true"`.
1568
+ * - Special behavior JS of new Boolean, return `false` **(convert to string: `"false"`)**
1569
+ * for `false`, (`0` / `-0`), `""` (empty-string), `null`, `undefined`, `NaN`, otherwise
1570
+ * `true` **(convert to string: `"true"`)**.
1571
+ * - For `new Number`:
1572
+ * - `new Number(42)` ➔ `.valueOf()` ➔ `42` ➔ `42.toString()` ➔ `"42"`.
1573
+ * - `new Number(NaN)` ➔ `.valueOf()` ➔ `NaN` ➔ `NaN.toString()` ➔ `"NaN"`.
1574
+ * - `new Number(null)` ➔ `.valueOf()` ➔ `0` (`null` is `0` behavior JS of new Number) ➔ `0.toString()` ➔ `"0"`.
1575
+ * - `new Number(undefined)` ➔ `.valueOf()` ➔ `NaN` ➔ `NaN.toString()` ➔ `"NaN"`.
1576
+ * - `new Number(Infinity)` ➔ `Infinity` ➔ `Infinity` ➔ `Infinity.toString()` ➔ `"Infinity"`.
1577
+ * - `new Number(-Infinity)` ➔ `-Infinity` ➔ `-Infinity` ➔ `-Infinity.toString()` ➔ `"-Infinity"`.
1578
+ * - `RegExp` ➔ Source string (e.g. `/abc/i`) only in `"all"` mode.
1579
+ * - `Symbol` ➔ `Symbol(description)` string only in `"all"` mode.
1580
+ * - `Map` ➔ Array of [key, value] pairs with keys/values stringified deeply (only in `"all"` mode).
1581
+ * - `Set` ➔ Array of values stringified deeply (only in `"all"` mode).
1582
+ * - `Function` ➔ Source code string (e.g. `"() => 1"`) only in `"all"` mode.
1583
+ * - `Error`, `Promise` ➔ Stringified via `.toString()` only in `"all"` mode.
1584
+ * @param {*} value
1585
+ * * ***The value to process.***
1586
+ * - ***Can be anything:***
1587
+ * - `primitive`.
1588
+ * - `array`.
1589
+ * - `object`.
1590
+ * - `function`.
1591
+ * - `etc`.
1592
+ * @param {false | "stringOrNumber" | "primitives" | "all"} forceToString - ***The mode of string conversion.***
1593
+ * @returns {unknown} A new value with the conversion applied based on `forceToString`.
1594
+ * @example
1595
+ * toStringDeepForce(42, "stringOrNumber");
1596
+ * // ➔ "42"
1597
+ * toStringDeepForce(true, "primitives");
1598
+ * // ➔ "true"
1599
+ * toStringDeepForce(null, "primitives");
1600
+ * // ➔ "null"
1601
+ * toStringDeepForce(Symbol("x"), "all");
1602
+ * // ➔ "Symbol(x)"
1603
+ * toStringDeepForce(new String("hi"), "all");
1604
+ * // ➔ "hi"
1605
+ * toStringDeepForce(new Number(42), "all");
1606
+ * // ➔ "42"
1607
+ * toStringDeepForce(new Boolean(true), "all");
1608
+ * // ➔ "true"
1609
+ * toStringDeepForce({ a: 1, b: [2, NaN] }, "primitives");
1610
+ * // ➔ { a: "1", b: ["2", "NaN"] }
1611
+ * toStringDeepForce(new Date("2025-01-01"), "all");
1612
+ * // ➔ "2025-01-01T00:00:00.000Z"
1613
+ * toStringDeepForce(() => 1, "all");
1614
+ * // ➔ "() => 1"
1615
+ * toStringDeepForce(/abc/i, "all");
1616
+ * // ➔ "/abc/i"
1617
+ * toStringDeepForce(new Map([["a", 1], ["b", 2]]), "all");
1618
+ * // ➔ [["a", "1"], ["b", "2"]]
1619
+ * toStringDeepForce(new Set([1, 2, 3]), "all");
1620
+ * // ➔ ["1", "2", "3"]
1621
+ * toStringDeepForce(new Error("Oops"), "all");
1622
+ * // ➔ "Error: Oops"
1623
+ * toStringDeepForce(Promise.resolve(1), "all");
1624
+ * // ➔ "[object Promise]"
1625
+ * toStringDeepForce({ func: () => 123 }, "all");
1626
+ * // ➔ { func: "() => 123" }
1627
+ * toStringDeepForce([1, "a", { b: 2 }], false);
1628
+ * // ➔ [1, "a", { b: 2 }]
1629
+ */
1630
+ declare function toStringDeepForce<T>(value:unknown,forceToString:false|"stringOrNumber"|"primitives"|"all"):T;export{cleanParsedData,convertType,dedupeArray,extractDigits,filterNilArray,parseCurrencyString,parseCustomDate,removeObjectPaths,safeJsonParse,safeStableStringify,toBooleanContent,toBooleanContentDeep,toBooleanExplicit,toBooleanLoose,toNumberArrayUnRecursive,toNumberDeep,toStringArrayUnRecursive,toStringDeep,toStringDeepForce};