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

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