toolbox-x 1.0.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 (190) hide show
  1. package/LICENSE +201 -0
  2. package/dist/Color-B3mgF9Dh.d.cts +486 -0
  3. package/dist/Color-D38Xrw65.d.mts +486 -0
  4. package/dist/Stylog-Df7eq3-j.d.cts +519 -0
  5. package/dist/Stylog-jvlLcMQq.d.mts +519 -0
  6. package/dist/array-DvW0zIu6.d.mts +130 -0
  7. package/dist/array-rUnEVisO.d.cts +130 -0
  8. package/dist/basics-D_eSv0cu.cjs +132 -0
  9. package/dist/basics-Dp_aEK81.mjs +115 -0
  10. package/dist/basics-WEYWlnRO.d.cts +95 -0
  11. package/dist/basics-uBSfkBEI.d.mts +95 -0
  12. package/dist/case-BWIt8Ash.mjs +449 -0
  13. package/dist/case-C-S-b5YP.d.cts +327 -0
  14. package/dist/case-CS8Ii3A7.cjs +526 -0
  15. package/dist/case-CybASFPD.d.mts +327 -0
  16. package/dist/change-case.cjs +32 -0
  17. package/dist/change-case.d.cts +18 -0
  18. package/dist/change-case.d.mts +18 -0
  19. package/dist/change-case.mjs +19 -0
  20. package/dist/colors.cjs +574 -0
  21. package/dist/colors.d.cts +355 -0
  22. package/dist/colors.d.mts +355 -0
  23. package/dist/colors.mjs +547 -0
  24. package/dist/constants-2gAw23_7.mjs +144 -0
  25. package/dist/constants-B34K0QPi.d.cts +21 -0
  26. package/dist/constants-BIBDKY1u.cjs +924 -0
  27. package/dist/constants-BWT-810U.cjs +158 -0
  28. package/dist/constants-BwbHnXlM.mjs +662 -0
  29. package/dist/constants-BxN9l5el.cjs +74 -0
  30. package/dist/constants-CLS_bgKD.d.mts +847 -0
  31. package/dist/constants-D73iFu8g.mjs +171 -0
  32. package/dist/constants-DAfRxaa8.mjs +62 -0
  33. package/dist/constants-DQYeCjlx.cjs +207 -0
  34. package/dist/constants-Deeie-iH.d.mts +21 -0
  35. package/dist/constants-DpTG9RP6.d.mts +29 -0
  36. package/dist/constants-DqwnkJ_d.cjs +740 -0
  37. package/dist/constants-DvRUY_FY.cjs +150 -0
  38. package/dist/constants-VcRtQu0K.d.cts +29 -0
  39. package/dist/constants-X5hm1UtB.mjs +912 -0
  40. package/dist/constants-eNd-iYsV.mjs +134 -0
  41. package/dist/constants-qm8FafmD.d.cts +847 -0
  42. package/dist/constants.cjs +415 -0
  43. package/dist/constants.d.cts +184 -0
  44. package/dist/constants.d.mts +184 -0
  45. package/dist/constants.mjs +378 -0
  46. package/dist/convert-BOCgUv2D.cjs +252 -0
  47. package/dist/convert-Bn4jFomQ.mjs +169 -0
  48. package/dist/convert-BrzlG-m_.cjs +475 -0
  49. package/dist/convert-DhaUoPVU.mjs +368 -0
  50. package/dist/converter-1P90_RcP.d.mts +402 -0
  51. package/dist/converter-CmkcAppi.d.cts +402 -0
  52. package/dist/converter.cjs +780 -0
  53. package/dist/converter.d.cts +29 -0
  54. package/dist/converter.d.mts +29 -0
  55. package/dist/converter.mjs +771 -0
  56. package/dist/countries-CIpmtEzV.cjs +1469 -0
  57. package/dist/countries-Cy0xiqS3.mjs +1463 -0
  58. package/dist/css-colors-Bx947Ng3.d.cts +179 -0
  59. package/dist/css-colors-CXCDqQbG.cjs +186 -0
  60. package/dist/css-colors-CXTp1vvy.d.mts +179 -0
  61. package/dist/css-colors-DfUW3nTR.mjs +180 -0
  62. package/dist/date.cjs +332 -0
  63. package/dist/date.d.cts +213 -0
  64. package/dist/date.d.mts +213 -0
  65. package/dist/date.mjs +298 -0
  66. package/dist/dom.cjs +461 -0
  67. package/dist/dom.d.cts +228 -0
  68. package/dist/dom.d.mts +228 -0
  69. package/dist/dom.mjs +429 -0
  70. package/dist/form-BMFVGUrN.d.mts +118 -0
  71. package/dist/form-DRFbryvK.d.cts +118 -0
  72. package/dist/guards-3kaUX66g.mjs +157 -0
  73. package/dist/guards-C8gkvIHb.cjs +240 -0
  74. package/dist/guards-DdyU4h4o.mjs +110 -0
  75. package/dist/guards-Efhp1mNy.cjs +151 -0
  76. package/dist/guards.cjs +172 -0
  77. package/dist/guards.d.cts +399 -0
  78. package/dist/guards.d.mts +399 -0
  79. package/dist/guards.mjs +75 -0
  80. package/dist/hash-B6JPEyAz.d.mts +131 -0
  81. package/dist/hash-NTpeKYB_.d.cts +131 -0
  82. package/dist/hash.cjs +2126 -0
  83. package/dist/hash.d.cts +1239 -0
  84. package/dist/hash.d.mts +1239 -0
  85. package/dist/hash.mjs +2095 -0
  86. package/dist/http-status-BAZdtr7-.d.mts +65 -0
  87. package/dist/http-status-U_3MtoGb.d.cts +65 -0
  88. package/dist/http-status.cjs +173 -0
  89. package/dist/http-status.d.cts +142 -0
  90. package/dist/http-status.d.mts +142 -0
  91. package/dist/http-status.mjs +171 -0
  92. package/dist/index.cjs +2551 -0
  93. package/dist/index.d.cts +1493 -0
  94. package/dist/index.d.mts +1493 -0
  95. package/dist/index.mjs +2357 -0
  96. package/dist/object-B0TV3eHx.d.mts +8052 -0
  97. package/dist/object-Blq0Amdv.d.cts +8052 -0
  98. package/dist/objectify-CDs0Fbr1.mjs +417 -0
  99. package/dist/objectify-DIJ-OBmo.cjs +524 -0
  100. package/dist/paginator.cjs +245 -0
  101. package/dist/paginator.d.cts +144 -0
  102. package/dist/paginator.d.mts +144 -0
  103. package/dist/paginator.mjs +243 -0
  104. package/dist/parse-2ubxXZRp.cjs +211 -0
  105. package/dist/parse-N7g942uy.mjs +164 -0
  106. package/dist/pluralizer-BjMIc6uT.d.mts +42 -0
  107. package/dist/pluralizer-Cb6ZmrDl.d.cts +42 -0
  108. package/dist/pluralizer.cjs +678 -0
  109. package/dist/pluralizer.d.cts +152 -0
  110. package/dist/pluralizer.d.mts +152 -0
  111. package/dist/pluralizer.mjs +676 -0
  112. package/dist/primitives-B26uZolQ.cjs +228 -0
  113. package/dist/primitives-KsFUp3kQ.mjs +144 -0
  114. package/dist/specials-D48_IZbd.d.mts +108 -0
  115. package/dist/specials-DzLr1ZgU.cjs +477 -0
  116. package/dist/specials-LVONlKbQ.d.cts +108 -0
  117. package/dist/specials-uhDuRg8H.mjs +292 -0
  118. package/dist/string-CBAbxaG1.d.mts +258 -0
  119. package/dist/string-CsNsm_65.d.cts +258 -0
  120. package/dist/stylog.cjs +621 -0
  121. package/dist/stylog.d.cts +49 -0
  122. package/dist/stylog.d.mts +49 -0
  123. package/dist/stylog.mjs +614 -0
  124. package/dist/timezone-B2OYK6Fh.mjs +5589 -0
  125. package/dist/timezone-Beh9IGpw.cjs +5625 -0
  126. package/dist/types/array.cjs +16 -0
  127. package/dist/types/array.d.cts +18 -0
  128. package/dist/types/array.d.mts +18 -0
  129. package/dist/types/array.mjs +17 -0
  130. package/dist/types/colors.cjs +16 -0
  131. package/dist/types/colors.d.cts +18 -0
  132. package/dist/types/colors.d.mts +18 -0
  133. package/dist/types/colors.mjs +17 -0
  134. package/dist/types/converter.cjs +16 -0
  135. package/dist/types/converter.d.cts +18 -0
  136. package/dist/types/converter.d.mts +18 -0
  137. package/dist/types/converter.mjs +17 -0
  138. package/dist/types/form.cjs +16 -0
  139. package/dist/types/form.d.cts +18 -0
  140. package/dist/types/form.d.mts +18 -0
  141. package/dist/types/form.mjs +17 -0
  142. package/dist/types/hash.cjs +16 -0
  143. package/dist/types/hash.d.cts +18 -0
  144. package/dist/types/hash.d.mts +18 -0
  145. package/dist/types/hash.mjs +17 -0
  146. package/dist/types/http-status.cjs +16 -0
  147. package/dist/types/http-status.d.cts +18 -0
  148. package/dist/types/http-status.d.mts +18 -0
  149. package/dist/types/http-status.mjs +17 -0
  150. package/dist/types/index.cjs +16 -0
  151. package/dist/types/index.d.cts +18 -0
  152. package/dist/types/index.d.mts +18 -0
  153. package/dist/types/index.mjs +17 -0
  154. package/dist/types/number.cjs +16 -0
  155. package/dist/types/number.d.cts +18 -0
  156. package/dist/types/number.d.mts +18 -0
  157. package/dist/types/number.mjs +17 -0
  158. package/dist/types/object.cjs +16 -0
  159. package/dist/types/object.d.cts +18 -0
  160. package/dist/types/object.d.mts +18 -0
  161. package/dist/types/object.mjs +17 -0
  162. package/dist/types/pluralizer.cjs +16 -0
  163. package/dist/types/pluralizer.d.cts +18 -0
  164. package/dist/types/pluralizer.d.mts +18 -0
  165. package/dist/types/pluralizer.mjs +17 -0
  166. package/dist/types/string.cjs +16 -0
  167. package/dist/types/string.d.cts +18 -0
  168. package/dist/types/string.d.mts +18 -0
  169. package/dist/types/string.mjs +17 -0
  170. package/dist/types/stylog.cjs +16 -0
  171. package/dist/types/stylog.d.cts +18 -0
  172. package/dist/types/stylog.d.mts +18 -0
  173. package/dist/types/stylog.mjs +17 -0
  174. package/dist/types/utils.cjs +16 -0
  175. package/dist/types/utils.d.cts +18 -0
  176. package/dist/types/utils.d.mts +18 -0
  177. package/dist/types/utils.mjs +17 -0
  178. package/dist/types/verbalizer.cjs +16 -0
  179. package/dist/types/verbalizer.d.cts +30 -0
  180. package/dist/types/verbalizer.d.mts +30 -0
  181. package/dist/types/verbalizer.mjs +17 -0
  182. package/dist/utilities-CLUmdQeV.cjs +140 -0
  183. package/dist/utilities-m5yFKqLd.mjs +105 -0
  184. package/dist/utils-ClW9LA6f.mjs +449 -0
  185. package/dist/utils-DLFRgXUC.cjs +568 -0
  186. package/dist/verbalizer.cjs +998 -0
  187. package/dist/verbalizer.d.cts +148 -0
  188. package/dist/verbalizer.d.mts +148 -0
  189. package/dist/verbalizer.mjs +996 -0
  190. package/package.json +249 -0
@@ -0,0 +1,1493 @@
1
+ /**
2
+ * Copyright 2026 - present Nazmul Hassan
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import { $ as Maybe, $n as ProtoMethodOptions, $t as LocaleCode, B as BasicPrimitive, Bt as ConvertOptions, Cn as ArrayOfObjectsToStringOptions, D as NumericDotKey, E as NestedPrimitiveKey, F as SanitizedData, H as ClassDetails, Ht as CurrencyCode, Kt as FrankFurterCurrency, O as Objects, P as SanitizeOptions, R as Any, U as Constructor, Ut as DecimalOptions, Vt as ConvertedDecimal, W as DelayedFn, Y as FlattenPartial, a as ConvertObjectOptions, an as RandomNumberOptions, at as OwnKeys, c as DeepKeys, cn as RomanCapital, dr as Tuple, en as LooseRomanNumeral, g as FlattenDotValue, gr as Unit, in as PercentageOptions, it as Numeric, nn as NumberType, o as ConvertedObject, on as RangeOptions, ot as PartialOrRequired, p as ExpandAll, s as CountryDetails, sn as RangedNumbers, st as Primitive, u as DotNotationKey, ut as VoidFn, v as FlattenLeafValue, w as MergeAll, wn as ArrayOfPrimitivesToStringOptions, y as GenericObject, zt as BnDigitResult } from "./object-B0TV3eHx.mjs";
18
+ import { A as MaskOptions, d as AnagramOptions, h as CharDiffResult, w as DiffResult } from "./string-CBAbxaG1.mjs";
19
+ import { n as convertStringCase, t as capitalizeString } from "./case-CybASFPD.mjs";
20
+ import { n as trimString, r as truncateString, t as generateRandomID } from "./basics-uBSfkBEI.mjs";
21
+ import { a as Flattened, c as OrderOption, l as SortByOption, n as FindOptions, s as OptionsConfig, t as FieldValue, u as SortNature } from "./array-DvW0zIu6.mjs";
22
+
23
+ //#region src/string/anagram.d.ts
24
+ /**
25
+ * * Generates unique anagrams of a given word. Optionally looks up valid anagrams inside a provided dictionary.
26
+ *
27
+ * @param word The word from which to generate anagrams. Converted to lowercase internally.
28
+ *
29
+ * @param options Controls the output limit and optional dictionary lookup.
30
+ *
31
+ * @returns A list of unique, lowercase anagrams. The original word (lowercased) is always included as the first element.
32
+ *
33
+ * @remarks
34
+ * - When a dictionary is provided, only anagrams found inside that dictionary are returned.
35
+ * - The dictionary is cached internally (with converting to lowercase) using a `WeakMap`, allowing garbage collection of unused inputs.
36
+ * - Repeated letters are handled efficiently using a per-level set to avoid duplicate permutations.
37
+ *
38
+ * @example
39
+ * generateAnagrams("east", { limit: 10 });
40
+ *
41
+ * @example
42
+ * generateAnagrams("tone", {
43
+ * dictionary: ["tone", "note", "one"],
44
+ * limit: "all"
45
+ * });
46
+ */
47
+ declare function generateAnagrams(word: string, options?: AnagramOptions): Lowercase<string>[];
48
+ //#endregion
49
+ //#region src/string/convert.d.ts
50
+ /**
51
+ * * Replaces all occurrences of a string or pattern in the given input string.
52
+ *
53
+ * - If `find` is a string, it is converted into a global regular expression (`/find/g`).
54
+ * - If `find` is a `RegExp`, the global (`g`) flag is ensured.
55
+ * - Trims the input before performing replacements.
56
+ *
57
+ * @param input - The string in which replacements should be performed.
58
+ * @param find - The substring or regex pattern to search for.
59
+ * @param replace - The string to replace matches with.
60
+ * @returns The modified/refined string with replacements applied.
61
+ */
62
+ declare const replaceAllInString: (input: string, find: string | RegExp, replace: string) => string;
63
+ /**
64
+ * * Converts a string into a URL-friendly slug.
65
+ * @param input - The string to be converted.
66
+ * @returns The slugified string.
67
+ */
68
+ declare const slugifyString: (input: string) => string;
69
+ /**
70
+ * * Masks part of a string for privacy.
71
+ * @param input - The string to mask.
72
+ * @param options - Options for masking a string.
73
+ * @returns The masked string.
74
+ */
75
+ declare const maskString: (input: string, options?: MaskOptions) => string;
76
+ /**
77
+ * * Reverses a given string.
78
+ * @param input - The string to reverse.
79
+ * @returns The reversed string.
80
+ */
81
+ declare const reverseString: (input: string) => string;
82
+ /**
83
+ * * Normalizes a string by removing diacritics (accents).
84
+ * @param str The input string.
85
+ * @returns The normalized string.
86
+ */
87
+ declare function normalizeString(str: string): string;
88
+ /**
89
+ * * Extracts all email addresses from a string.
90
+ * @param str The input string.
91
+ * @returns An array of extracted email addresses.
92
+ */
93
+ declare function extractEmails(str: string): string[];
94
+ /**
95
+ * * Extracts all URLs from a string.
96
+ * @param str The input string.
97
+ * @returns An array of extracted URLs.
98
+ */
99
+ declare function extractURLs(str: string): string[];
100
+ /**
101
+ * * Returns a grammatically correct unit string, optionally prefixed with the number.
102
+ *
103
+ * @remarks For complex and versatile pluralization, please refer to {@link https://toolbox.nazmul-nhb.dev/docs/utilities/string/pluralizer pluralizer} or {@link https://toolbox.nazmul-nhb.dev/docs/classes/Pluralizer Pluralizer Class} instead.
104
+ *
105
+ * @param count The numeric value to determine singular or plural.
106
+ * @param unit The unit name (e.g., "day", "hour").
107
+ * @param withNumber Whether to prefix the count before the unit. Defaults to `true`.
108
+ * @returns Formatted unit string like `"1 day"`, `"2 months"`, or `"hour"`.
109
+ */
110
+ declare function formatUnitWithPlural(count: number, unit: string, withNumber?: boolean): string;
111
+ //#endregion
112
+ //#region src/string/diff.d.ts
113
+ /**
114
+ * * Computes a line-based text diff between two strings using the Longest Common Subsequence (LCS) algorithm.
115
+ *
116
+ * @remarks
117
+ * - Lines are classified as `added`, `removed`, `modified`, or `unchanged`.
118
+ * - Detects and pairs similar `removed` and `added` lines as `modified` when their similarity exceeds the threshold.
119
+ *
120
+ * @param originalText The original (before) text.
121
+ * @param modifiedText The modified (after) text.
122
+ * @returns A {@link DiffResult} with the list of diff lines and summary statistics.
123
+ *
124
+ * @example
125
+ * const result = computeTextDiff('hello\nworld', 'hello\nearth');
126
+ * // result.stats → { linesAdded: 1, linesRemoved: 1, linesChanged: 0, linesUnchanged: 1 }
127
+ *
128
+ * @example
129
+ * const result = computeTextDiff('foo\nbar', 'foo\nbaz\nqux');
130
+ * result.stats.linesAdded; // 1
131
+ * result.stats.linesChanged; // 1
132
+ */
133
+ declare function computeTextDiff(originalText: string, modifiedText: string): DiffResult;
134
+ /**
135
+ * * Highlights character-level differences between two strings using the LCS algorithm.
136
+ *
137
+ * @remarks
138
+ * - The function returns two arrays of characters for the original and modified strings.
139
+ * - Each character in both strings is annotated with a `highlighted` flag indicating whether it differs from the other string.
140
+ *
141
+ * @param original The original string to compare from.
142
+ * @param modified The modified string to compare to.
143
+ * @returns A {@link CharDiffResult} with annotated character arrays for both strings.
144
+ *
145
+ * @example
146
+ * const diff = getCharacterDifferences('cat', 'car');
147
+ * diff.original; // [{ text: 'c', highlighted: false }, { text: 'a', highlighted: false }, { text: 't', highlighted: true }]
148
+ * diff.modified; // [{ text: 'c', highlighted: false }, { text: 'a', highlighted: false }, { text: 'r', highlighted: true }]
149
+ *
150
+ * @example
151
+ * // When one string is empty, all characters in the other are highlighted
152
+ * getCharacterDifferences('', 'hi');
153
+ * // { original: [], modified: [{ text: 'h', highlighted: true }, { text: 'i', highlighted: true }] }
154
+ *
155
+ * @example
156
+ * const diff = getCharacterDifferences('hello world', 'hello earth');
157
+ * // Characters unique to each string will have highlighted: true
158
+ */
159
+ declare function getCharacterDifferences(original: string, modified: string): CharDiffResult;
160
+ //#endregion
161
+ //#region src/string/utilities.d.ts
162
+ /**
163
+ * * Extracts all numbers from a string as array of numbers.
164
+ * @param input - The string to extract numbers from.
165
+ * @returns An array of numbers found in the string.
166
+ */
167
+ declare const extractNumbersFromString: (input: string) => number[];
168
+ /**
169
+ * * Computes the Levenshtein distance between two strings (space optimized).
170
+ * @param str1 - First string to compare.
171
+ * @param str2 - Second string to compare.
172
+ * @returns The Levenshtein distance between the two strings.
173
+ *
174
+ * @remarks
175
+ * - The Levenshtein distance is the minimum number of single-character edits (insertions, deletions, or substitutions) required to change one string into the other.
176
+ * - This implementation uses only O(min(len(a), len(b))) space by keeping only the current and previous rows of the distance matrix.
177
+ *
178
+ * @example
179
+ * const distance = getLevenshteinDistance('kitten', 'sitting');
180
+ * console.log(distance); // Output: 3
181
+ */
182
+ declare const getLevenshteinDistance: (str1: string, str2: string) => number;
183
+ /**
184
+ * * Counts the number of words in a string, supporting multiple languages and scripts.
185
+ *
186
+ * @param text - The input string to count words from.
187
+ * @returns Number of words (Unicode-aware).
188
+ */
189
+ declare function countWords(text: string): number;
190
+ //#endregion
191
+ //#region src/number/basics.d.ts
192
+ /**
193
+ * * Utility to generate a random number between a given range.
194
+ * * If no options are provided, it will generate a random number between `0` and `100` (inclusive).
195
+ * * If `min` is greater than `max`, it will swap the values and generate a random number.
196
+ *
197
+ * @param options - Options for configuring random number generator.
198
+ * @returns Random number.
199
+ */
200
+ declare const getRandomNumber: (options?: RandomNumberOptions) => number;
201
+ /**
202
+ * * Utility to round a number to given decimal places.
203
+ *
204
+ * @param input - Number or `stringified` number to round.
205
+ * @param options - Options for rounding behavior, including decimal places and return type.
206
+ * @returns Converted number as `number` (default) or `string` (if `isString` is `true`).
207
+ */
208
+ declare const convertToDecimal: <T extends Maybe<boolean> = false>(input: Numeric, options?: DecimalOptions<T>) => ConvertedDecimal<T>;
209
+ /**
210
+ * * Calculates the HCF/GCD of multiple numbers.
211
+ *
212
+ * @param numbers - List of numbers to find the HCF/GCD for.
213
+ * @returns The HCF/GCD of all the provided numbers.
214
+ */
215
+ declare const calculateHCF: (...numbers: Numeric[]) => number;
216
+ /**
217
+ * * Calculates the LCM/LCD of multiple numbers.
218
+ *
219
+ * @param numbers - List of numbers to find the LCM/LCD for.
220
+ * @returns The LCM/LCD of all the provided numbers.
221
+ */
222
+ declare const calculateLCM: (...numbers: Numeric[]) => number;
223
+ /**
224
+ * * Computes the factorial of a non-negative numeric value (integer).
225
+ *
226
+ * @param int - A numeric input value (integer) whose factorial should be calculated.
227
+ *
228
+ * @returns The factorial result as a number if valid, otherwise `undefined`.
229
+ *
230
+ * @example
231
+ * factorial(5); // → 120
232
+ * factorial(0); // → 1
233
+ * factorial(-3); // → undefined
234
+ * factorial(undefined); // → undefined
235
+ * factorial(5.5); // → undefined
236
+ *
237
+ * @remarks
238
+ * - Factorial of `0` and `1` is `1`.
239
+ * - Uses recursive approach internally.
240
+ * - Input is normalized via `normalizeNumber` before computation.
241
+ * - May return large values quickly due to factorial growth rate.
242
+ * - Returns `undefined` if the input is negative, not numeric, non-integer, or `undefined`.
243
+ */
244
+ declare function factorial(int: Maybe<Numeric>): Maybe<number>;
245
+ /**
246
+ * * Efficiently computes all positive integer factors (divisors) of a number.
247
+ *
248
+ * @param int - Numeric value to find factors for. Non-integer or negative values return an empty array.
249
+ *
250
+ * @returns An array of positive factors in ascending order.
251
+ *
252
+ * @example
253
+ * getFactors(12); // → [1, 2, 3, 4, 6, 12]
254
+ * getFactors(7); // → [1, 7]
255
+ * getFactors(-4); // → []
256
+ * getFactors(undefined); // → []
257
+ *
258
+ * @remarks
259
+ * - Uses the square root method for better performance (`O(√n)`).
260
+ * - Returns an empty array for invalid, negative, or non-integer input.
261
+ */
262
+ declare function getFactors(int: Maybe<Numeric>): number[];
263
+ /**
264
+ * * Sums up all digits of a number.
265
+ *
266
+ * @param num The input number.
267
+ * @returns The sum of its digits.
268
+ */
269
+ declare function sumDigits(num: Numeric): number;
270
+ /**
271
+ * * Sums up numbers.
272
+ *
273
+ * @param numbers The input numbers.
274
+ * @returns The sum of the numbers.
275
+ */
276
+ declare function sumNumbers(...numbers: Numeric[]): number;
277
+ /**
278
+ * * Reverses a number (e.g., `123` → `321`).
279
+ *
280
+ * @param num The number to reverse.
281
+ * @returns The reversed number.
282
+ */
283
+ declare function reverseNumber(num: Numeric): number;
284
+ /**
285
+ * * Calculates the average of a set of numbers.
286
+ *
287
+ * @param numbers - A list of numbers for which to calculate the average.
288
+ * @returns The average of the provided numbers. Returns `NaN` if no numbers are valid.
289
+ */
290
+ declare function getAverage(...numbers: Numeric[]): number;
291
+ /**
292
+ * * Rounds a number to a specified number of decimal places.
293
+ *
294
+ * @param number - The number to round.
295
+ * @param roundTo - The number of decimal places to round to (default is `2`).
296
+ * - If `roundTo` is negative, the number is rounded to the left of the decimal point (e.g., `-1` rounds to the nearest 10, `-2` to nearest 100 etc.).
297
+ * @returns The rounded number, either in float or integer (if a whole number).
298
+ *
299
+ * @example
300
+ * roundNumber(1234.56, -2); // 1200
301
+ * roundNumber(1234.56, 1); // 1234.6
302
+ */
303
+ declare function roundNumber(number: Numeric, roundTo?: number): number;
304
+ //#endregion
305
+ //#region src/number/Currency.d.ts
306
+ /**
307
+ * * A utility class for handling currency operations like formatting and conversion.
308
+ *
309
+ * - Supports formatting based on locale and currency code.
310
+ * - Converts between **fiat currencies supported by `api.frankfurter.app`**.
311
+ * - Automatically caches conversion rates to reduce redundant API calls.
312
+ * - Intended for use with numeric inputs (number or numeric string).
313
+ */
314
+ declare class Currency<Code extends CurrencyCode> {
315
+ #private;
316
+ /**
317
+ * * The formatted currency string (e.g., `$1,000.00`).
318
+ *
319
+ * - Generated using the `en-US` locale during construction.
320
+ * - This is a display-friendly version of the currency value.
321
+ * - For formatting with other locales, use the `format()` method.
322
+ */
323
+ readonly currency: string;
324
+ /**
325
+ * Creates an instance of the Currency class.
326
+ *
327
+ * @param amount - The numeric amount of currency (e.g., `100`, `'99.99'`).
328
+ * @param code - The ISO 4217 currency code representing the currency (e.g., `'USD'`, `'EUR'`).
329
+ */
330
+ constructor(amount: Numeric, code: Code);
331
+ /** * Clears cached rates that were fetched previously. */
332
+ static clearRateCache(): void;
333
+ /**
334
+ * @instance Formats the stored amount as a localized currency string.
335
+ *
336
+ * @param locale - Optional. A BCP 47 locale string (e.g., `'de-DE'`, `'en-US'`). Defaults to `'en-US'` if not provided.
337
+ * @param code - Optional. An ISO 4217 currency code (e.g., `'USD'`, `'EUR'`) used solely for formatting purposes.
338
+ * _This does not alter the internal currency code set during instantiation._
339
+ * @returns A string representing the formatted currency value according to the specified locale and currency code.
340
+ */
341
+ format(locale?: LocaleCode, code?: CurrencyCode): string;
342
+ /**
343
+ * @instance Converts the current currency amount to a target currency using real-time exchange rates.
344
+ *
345
+ * - Uses {@link https://api.frankfurter.app/latest api.frankfurter.app} to fetch live exchange rates.
346
+ * - Supports **only the following fiat currencies**:
347
+ * `AUD`, `BGN`, `BRL`, `CAD`, `CHF`, `CNY`, `CZK`, `DKK`, `EUR`, `GBP`, `HKD`, `HUF`, `IDR`, `ILS`, `INR`, `ISK`, `JPY`,
348
+ * `KRW`, `MXN`, `MYR`, `NOK`, `NZD`, `PHP`, `PLN`, `RON`, `SEK`, `SGD`, `THB`, `TRY`, `USD`, `ZAR`.
349
+ * - Uses cached rates unless `forceRefresh` is set to `true`.
350
+ * - If API fails or currency not supported, falls back to `fallbackRate` if provided.
351
+ * - Use {@link convertSync} method to convert to other currencies using custom exchange rate.
352
+ *
353
+ * @param to - The target currency code (must be one of the supported ones, e.g., `'EUR'`, `'USD'`).
354
+ * @param options - Optional settings:
355
+ * - `fallbackRate`: A manual exchange rate to use if the API call fails or currency is not supported.
356
+ * - `forceRefresh`: If true, ignores cached rates and fetches fresh data.
357
+ * @returns A new `Currency` instance with the converted amount in the target currency.
358
+ * @throws Will throw error if the API call fails and no `fallbackRate` is provided.
359
+ *
360
+ * @example
361
+ * await new Currency(100, 'USD').convert('EUR');
362
+ */
363
+ convert<To extends FrankFurterCurrency>(to: To, options?: ConvertOptions): Promise<Currency<To>>;
364
+ /**
365
+ * @instance Converts the current currency amount to a target currency using either a cached rate or a manual exchange rate.
366
+ *
367
+ * - This method is **synchronous** and does **not perform any network requests**.
368
+ * - If a cached rate exists for the currency pair, it is used.
369
+ * - If no cached rate is found, `rate` is used as a manual exchange rate.
370
+ * - If neither are available, the original instance is returned unchanged.
371
+ *
372
+ * @param to - The target currency code to convert to.
373
+ * @param rate - A manual exchange rate to use if no cached rate is available.
374
+ * @returns A new `Currency` instance with the converted amount, or the original instance if no rate is available.
375
+ *
376
+ * @example
377
+ * const usd = new Currency(100, 'USD');
378
+ * const eur = usd.convertSync('EUR', 0.92);
379
+ *
380
+ * console.log(eur.currency); // €92.00
381
+ */
382
+ convertSync<To extends CurrencyCode>(to: To, rate: number): Currency<To>;
383
+ }
384
+ //#endregion
385
+ //#region src/number/percent.d.ts
386
+ /**
387
+ * * Performs a percentage-related calculation based on the given mode and inputs.
388
+ *
389
+ * - `get-percent`: Calculates what percentage the `part` is of the `total`.
390
+ * - `get-value`: Calculates the value from a given `percentage` of a `total`.
391
+ * - `get-original`: Calculates the original value from a known `value` and `percentage`.
392
+ * - `get-change-percent`: Percent increase/decrease from `oldValue` to `newValue`.
393
+ * - `apply-percent-change`: Applies increase/decrease by `percentage` to `baseValue`.
394
+ * - `get-percent-difference`: Absolute percent difference between two values.
395
+ * - `inverse-percent`: What percent `total` is of `part`.
396
+ *
397
+ * @param options - The calculation mode and inputs required for the operation.
398
+ * @returns The calculated number rounded to three decimal places, or `NaN` if input is invalid.
399
+ */
400
+ declare function calculatePercentage(options: PercentageOptions): number;
401
+ //#endregion
402
+ //#region src/number/fibonacci.d.ts
403
+ /**
404
+ * * Generates the first `limit` Fibonacci numbers.
405
+ *
406
+ * @param limit The number of Fibonacci numbers to generate.
407
+ * @returns An array containing the first `limit` Fibonacci numbers.
408
+ */
409
+ declare function getFibonacciSeries(limit: Numeric): number[];
410
+ /**
411
+ * * Generates the first `limit` Fibonacci numbers using recursion with memoization.
412
+ *
413
+ * @param limit - The number of Fibonacci numbers to generate.
414
+ * @returns An array containing the first `limit` Fibonacci numbers.
415
+ */
416
+ declare function getFibonacciSeriesMemo(limit: Numeric): number[];
417
+ /**
418
+ * * Generator function for Fibonacci sequence up to a given limit.
419
+ *
420
+ * @param limit - Number of Fibonacci numbers to generate.
421
+ * @param onYield - Optional callback triggered on each yield with the current value and index.
422
+ * @returns A generator yielding Fibonacci numbers one by one.
423
+ */
424
+ declare function fibonacciGenerator(limit: Numeric, onYield?: (value: number, index: number) => void): Generator<number, void, void>;
425
+ /**
426
+ * * Calculates the `n`th Fibonacci number using optimized space.
427
+ *
428
+ * @param index - The index (0-based) of the Fibonacci number.
429
+ * @returns The index=`n`th Fibonacci number.
430
+ */
431
+ declare function getNthFibonacci(index: Numeric): number;
432
+ //#endregion
433
+ //#region src/number/convert.d.ts
434
+ /**
435
+ * * Converts a numeric value into its corresponding English word representation.
436
+ * @warning ***Supports numeric values up to `10e19` or `10^20` (one hundred quintillion).***
437
+ * @warning ***Decimal values are ignored; only the integer part is converted.***
438
+ * @param number - The number to convert into words.
439
+ * @returns The number converted in words.
440
+ */
441
+ declare function numberToWords(num: Numeric): string;
442
+ /**
443
+ * * Converts a number to an uppercase Roman numeral.
444
+ * @param value - The number to convert. Number must be an integer and `between 1 and 3999`.
445
+ * @returns The Roman numeral representation in uppercase.
446
+ *
447
+ * @example convertToRomanNumerals(29) // → "XXIX"
448
+ */
449
+ declare const convertToRomanNumerals: (value: Numeric) => RomanCapital;
450
+ /**
451
+ * * Converts a Roman numeral to its Arabic numeric representation.
452
+ * @param roman - The Roman numeral to convert. Case-insensitive but must represent a valid Roman numeral (`I`–`MMMCMXCIX`) otherwise throws runtime error.
453
+ * @returns The numeric (Arabic system) representation of the Roman numeral.
454
+ *
455
+ * @example
456
+ * romanToInteger("XXIX") // → 29
457
+ * romanToInteger("mmxxv") // → 2025
458
+ */
459
+ declare const romanToInteger: (roman: LooseRomanNumeral) => number;
460
+ /**
461
+ * * Converts a number, numeric string, or cardinal word string into its ordinal word representation.
462
+ *
463
+ * @param number - A number (e.g. `42`), numeric string (e.g. `"42"`), or cardinal word (e.g. `"forty-two"`).
464
+ * @returns The ordinal word form (always in lowercase) of the input.
465
+ *
466
+ * @example
467
+ * numberToWordsOrdinal(1); // "first"
468
+ * numberToWordsOrdinal("23"); // "twenty-third"
469
+ * numberToWordsOrdinal("twenty-three"); // "twenty-third"
470
+ */
471
+ declare function numberToWordsOrdinal(number: Numeric | string): string;
472
+ /**
473
+ * * Convert an English cardinal/ordinal word string into a number.
474
+ *
475
+ * - Accepts hyphenated words, "and", ordinals (first, second, etc.), negatives, and large scales (thousand, million etc.).
476
+ *
477
+ * @example
478
+ * wordsToNumber('forty-two') // 42
479
+ * wordsToNumber('one hundred and seven') // 107
480
+ * wordsToNumber('two thousand three hundred') // 2300
481
+ * wordsToNumber('twenty-first') // 21
482
+ * wordsToNumber('negative five') // -5
483
+ *
484
+ * @param word - A human readable number (cardinal or ordinal) in words
485
+ * @returns Numeric value of the word or NaN if cannot parse
486
+ *
487
+ * @remarks
488
+ * **NOTE** - *For very large numbers (e.g. more than quintillion) results may not always be correct.*
489
+ */
490
+ declare function wordsToNumber(word: string): number;
491
+ /**
492
+ * * Converts Bangla (Arabic system) digits to Latin (Arabic system) digits.
493
+ *
494
+ * @remarks
495
+ * - Behavior depends on the `forceNumber` flag:
496
+ * - When `forceNumber` is `true`, always returns a `number` (strips non-digit characters).
497
+ * - Returns `NaN` if the input is non empty string or does not include any numeric string.
498
+ * - When `forceNumber` is `false`, always returns a string, including non-digit characters.
499
+ * - Returns empty string if the input is non empty string.
500
+ *
501
+ * @param bnDigit - A string containing Bangla (Arabic system) digits.
502
+ * @param forceNumber - Whether to force number conversion even if the input includes non-digit character(s). Default is `false`.
503
+ *
504
+ * @example
505
+ * banglaToDigit('১২৩abc'); // 123
506
+ * banglaToDigit(''); // NaN
507
+ * banglaToDigit('৪৫৬'); // 456
508
+ *
509
+ * @example
510
+ * banglaToDigit('১২৩', false); // "123"
511
+ * banglaToDigit('১২৩abc', false); // "123abc"
512
+ */
513
+ declare function banglaToDigit<Force extends boolean = true>(bnDigit: string, forceNumber?: Force): BnDigitResult<Force>;
514
+ /**
515
+ * * Converts Latin (Arabic system) digits to Bangla digits (Arabic system).
516
+ *
517
+ * @remarks
518
+ * - Accepts numbers or numeric strings including non-digit characters.
519
+ * - When `preserveNonDigit` is `true`, non-digit characters are preserved in the output.
520
+ * - When `preserveNonDigit` is `false`, non-numeric strings are stripped.
521
+ * - Returns empty string for invalid input.
522
+ *
523
+ * @param digit - A number or string containing Latin (Arabic system) digits.
524
+ * @param preserveNonDigit - Whether to preserve non-digit characters in the output. Default is `true`.
525
+ *
526
+ * @example
527
+ * digitToBangla(123); // "১২৩"
528
+ * digitToBangla('456'); // "৪৫৬"
529
+ *
530
+ * @example
531
+ * digitToBangla('12ab', false); // "১২"
532
+ * digitToBangla('12ab'); // "১২ab"
533
+ */
534
+ declare function digitToBangla(digit: number | string, preserveNonDigit?: boolean): string;
535
+ //#endregion
536
+ //#region src/number/prime.d.ts
537
+ /**
538
+ * * Checks if a number is prime.
539
+ *
540
+ * @param number The number to check.
541
+ * @returns Boolean: `true` if the number is prime, otherwise `false`.
542
+ */
543
+ declare const isPrime: (number: number) => boolean;
544
+ /**
545
+ * * Find prime numbers in a given range.
546
+ *
547
+ * @param start The starting number of the range. Default is `1`.
548
+ * @param end The ending number of the range. Default is `1000`.
549
+ * @returns An array of prime numbers within the range (inclusive).
550
+ */
551
+ declare const findPrimeNumbers: (start?: number, end?: number) => number[];
552
+ //#endregion
553
+ //#region src/number/utilities.d.ts
554
+ /**
555
+ * * Rounds a number to the nearest specified interval.
556
+ * @param value - The number to round.
557
+ * @param interval - The interval to round to. Defaults to `5`.
558
+ * @returns The number rounded to the nearest interval.
559
+ * @example roundToNearest(27, 5) → 25
560
+ */
561
+ declare const roundToNearest: (value: Numeric, interval?: number) => number;
562
+ /**
563
+ * * Formats a number as a currency string.
564
+ * @param value - The number to format.
565
+ * @param currency - The currency code (default: `USD`).
566
+ * @param locale - The locale for formatting (default: matching currency locale).
567
+ * @returns A formatted currency string.
568
+ * @example formatCurrency(1234.56) → "$1,234.56"
569
+ * @example formatCurrency(1234.56, "USD") → "$1,234.56"
570
+ * @example formatCurrency(1234.56, "USD", "en-US") → "$1,234.56"
571
+ */
572
+ declare const formatCurrency: (value: Numeric, currency?: CurrencyCode, locale?: LocaleCode) => string;
573
+ /**
574
+ * * Clamps a number within a specified range.
575
+ * @param value - The number to clamp.
576
+ * @param min - The minimum allowed value.
577
+ * @param max - The maximum allowed value.
578
+ * @returns The clamped number.
579
+ * @example clampNumber(15, 10, 20) → 15
580
+ * @example clampNumber(5, 10, 20) → 10
581
+ * @example clampNumber(25, 10, 20) → 20
582
+ */
583
+ declare const clampNumber: (value: number, min: number, max: number) => number;
584
+ /**
585
+ * * Generates a random floating-point number within a range.
586
+ * @param min - The minimum value.
587
+ * @param max - The maximum value.
588
+ * @returns A random floating-point number between min and max.
589
+ * @example randomFloat(1.5, 3.5) → 2.84623
590
+ */
591
+ declare const getRandomFloat: (min: Numeric, max: Numeric) => number;
592
+ /**
593
+ * * Returns the ordinal suffix for a given number (e.g., 1 -> 'st', 2 -> 'nd', 3 -> 'rd', 4 -> 'th' etc.).
594
+ * @description The function handles special cases for 11, 12, and 13, which all use 'th' despite the last digit.
595
+ * If the `withNumber` parameter is `true`, the function returns the number along with its ordinal suffix (e.g., "1st").
596
+ * Otherwise, it returns only the ordinal suffix (e.g., "st").
597
+ *
598
+ * @param num - The number or number string to get the ordinal suffix for.
599
+ * @param withNumber - Whether to include the number along with its ordinal suffix (defaults to `true`).
600
+ * @returns The appropriate ordinal suffix, optionally with the number (e.g., '1st' or 'st`, '2nd' or 'nd' and so on.).
601
+ */
602
+ declare const getOrdinal: (num: Numeric, withNumber?: boolean) => string;
603
+ /**
604
+ * * Normalize a number or numeric string to a number.
605
+ * @description
606
+ * This function checks if the input is a number or a numeric string and converts it to a number.
607
+ * If the input is not a valid number or numeric string, it returns `undefined`.
608
+ * @param num - The number to normalize.
609
+ * @returns The normalized number or `undefined` if the input is not a valid number or numeric string.
610
+ */
611
+ declare function normalizeNumber(num: unknown): Maybe<number>;
612
+ //#endregion
613
+ //#region src/number/range.d.ts
614
+ /**
615
+ * * Function to get numbers within a range based on the provided {@link NumberType} and options.
616
+ *
617
+ * @remarks Returns either string or array of numbers based on the {@link RangeOptions.getAsString getAsString} option.
618
+ *
619
+ * @param type - The type of numbers to generate ('random', 'prime', etc.).
620
+ * @param options - Options to configure number generation, including range and formatting.
621
+ * @returns The numbers in the range based on {@link type} and {@link options} either as string or array of numbers.
622
+ */
623
+ declare function getNumbersInRange<T extends boolean = false>(type?: NumberType, options?: RangeOptions<T>): RangedNumbers<T>;
624
+ //#endregion
625
+ //#region src/array/basics.d.ts
626
+ /**
627
+ * * Flattens a nested array recursively or wraps any non-array data type in an array.
628
+ *
629
+ * @param input - The input value, which can be a nested array or a non-array value.
630
+ * @returns A fully flattened array of type `Flatten<T>`. If the input is not an array, it wraps it in a single-element array.
631
+ */
632
+ declare const flattenArray: <T>(input: T | T[]) => Flattened<T>[];
633
+ /**
634
+ * @deprecated _Please, use `findAll` instance method from `Finder` class for **more advanced filtering and searching.**_
635
+ *
636
+ * * Filters an array of objects based on multiple conditions for specified keys.
637
+ * @param array - The array of objects to filter.
638
+ * @param conditions - An object where keys represent the property names and values represent filter conditions.
639
+ * The conditions can be a function `(value: T[K]) => boolean`.
640
+ * @returns The filtered array of objects.
641
+ * @throws `Error` If the input is not a valid array.
642
+ */
643
+ declare const filterArrayOfObjects: <T extends GenericObject>(array: T[], conditions: { [K in keyof T]?: (value: Maybe<T[K]>) => boolean }) => T[];
644
+ /**
645
+ * * Checks if a value is an empty array or an array with only empty values.
646
+ *
647
+ * @param value - The value to check.
648
+ * @returns `true` if the value is not an array, an empty array, or an array containing only `null`, `undefined`, empty objects, or empty arrays.
649
+ */
650
+ declare const isInvalidOrEmptyArray: <T>(value: T) => boolean;
651
+ /**
652
+ * * Shuffle the elements of an array.
653
+ *
654
+ * @param array Array to shuffle.
655
+ * @returns Shuffled array.
656
+ */
657
+ declare const shuffleArray: <T>(array: T[]) => T[];
658
+ /**
659
+ * * Get the last element of an array.
660
+ *
661
+ * @param array Array to get the last element from.
662
+ * @returns The last element or `undefined` if the array is empty.
663
+ */
664
+ declare const getLastArrayElement: <T>(array: T[]) => Maybe<T>;
665
+ //#endregion
666
+ //#region src/array/calc.d.ts
667
+ /**
668
+ * * Calculates the sum of differences between two numeric fields for each item in the array.
669
+ *
670
+ * @param data - The array of objects to process.
671
+ * @param first - The field name to subtract **from** (minuend), supports nested dot notation.
672
+ * @param second - The field name to subtract (subtrahend), supports nested dot notation.
673
+ * @param roundTo - Decimal places to round the result to. Defaults to 2.
674
+ * @returns The total sum of differences between the two fields across all items.
675
+ *
676
+ * @example
677
+ * sumFieldDifference([{ buy: 10, sell: 3 }, { buy: 8, sell: 5 }], 'buy', 'sell');
678
+ * // => 10
679
+ */
680
+ declare function sumFieldDifference<T extends GenericObject, P extends NumericDotKey<T>>(data: Maybe<T[]>, first: P, second: P, roundTo?: number): number;
681
+ /**
682
+ * * Calculates the total sum of a numeric field across all items.
683
+ *
684
+ * @param data - The array of objects to process.
685
+ * @param field - The field to sum values from. Supports nested dot notation.
686
+ * @param roundTo - Decimal places to round the result to. Defaults to 2.
687
+ * @returns The rounded total sum.
688
+ *
689
+ * @example
690
+ * sumByField([{ a: 5 }, { a: 3 }], 'a');
691
+ * // => 8
692
+ */
693
+ declare function sumByField<T extends GenericObject>(data: Maybe<T[]>, field: NumericDotKey<T>, roundTo?: number): number;
694
+ /**
695
+ * * Calculates the average of a numeric field across all items.
696
+ *
697
+ * @param data - The array of objects to process.
698
+ * @param field - The field to calculate the average from. Supports nested dot notation.
699
+ * @param roundTo - Decimal places to round the result to. Defaults to 2.
700
+ * @returns The rounded average.
701
+ *
702
+ * @example
703
+ * averageByField([{ a: 4 }, { a: 6 }], 'a');
704
+ * // => 5
705
+ */
706
+ declare function averageByField<T extends GenericObject>(data: Maybe<T[]>, field: NumericDotKey<T>, roundTo?: number): number;
707
+ /**
708
+ * * Groups an array of objects by a primitive field and sums another numeric field per group.
709
+ *
710
+ * @param data - The array of objects to group.
711
+ * @param groupBy - The field to group by. Supports nested dot notation.
712
+ * @param sumBy - The numeric field to sum within each group. Supports nested dot notation.
713
+ * @param roundTo - Decimal places to round each group’s result to. Defaults to 2.
714
+ * @returns An array of records, each with the group key and its corresponding summed value.
715
+ *
716
+ * @example
717
+ * groupAndSumByField([{ type: 'A', val: 2 }, { type: 'A', val: 3 }, { type: 'B', val: 1 }], 'type', 'val');
718
+ * // => [{ A: 5 }, { B: 1 }]
719
+ */
720
+ declare function groupAndSumByField<T extends GenericObject>(data: Maybe<T[]>, groupBy: NestedPrimitiveKey<T>, sumBy: NumericDotKey<T>, roundTo?: number): Array<Record<string, number>>;
721
+ /**
722
+ * * Groups an array of objects by a primitive field and averages another numeric field per group.
723
+ *
724
+ * @param data - The array of objects to group.
725
+ * @param groupBy - The field to group by. Supports nested dot notation.
726
+ * @param averageBy - The numeric field to average within each group. Supports nested dot notation.
727
+ * @param roundTo - Decimal places to round each group’s average to. Defaults to 2.
728
+ * @returns An array of records, each with the group key and its corresponding average value.
729
+ *
730
+ * @example
731
+ * groupAndAverageByField([{ type: 'A', val: 2 }, { type: 'A', val: 4 }, { type: 'B', val: 6 }], 'type', 'val');
732
+ * // => [{ A: 3 }, { B: 6 }]
733
+ */
734
+ declare function groupAndAverageByField<T extends GenericObject>(data: Maybe<T[]>, groupBy: NestedPrimitiveKey<T>, averageBy: NumericDotKey<T>, roundTo?: number): Array<Record<string, number>>;
735
+ //#endregion
736
+ //#region src/array/Finder.d.ts
737
+ type KeySelector<T> = Extract<OwnKeys<T>, string | number> | ((item: T) => string | number);
738
+ /**
739
+ * @class `Finder` performs optimized searching on arrays.
740
+ * - It supports binary search, fuzzy search, and smart caching with TTL.
741
+ */
742
+ declare class Finder<T extends GenericObject> {
743
+ #private;
744
+ /**
745
+ * * Creates a new `Finder` instance with a static array of items.
746
+ *
747
+ * @param data An array of items to initialize the search dataset.
748
+ * @param ttl Optional time-to-live (in milliseconds) for cached search results. Defaults to {@link Finder.#DEFAULT_TTL 5 Minutes}.
749
+ */
750
+ constructor(data: T[], ttl?: number);
751
+ /**
752
+ * * Creates a new `Finder` instance with a lazy-evaluated item provider.
753
+ *
754
+ * @param cb A function returning an array of items to initialize the search dataset.
755
+ * @param ttl Time-to-live (in milliseconds) for cached search results. Defaults to {@link Finder.#DEFAULT_TTL 5 Minutes}.
756
+ */
757
+ constructor(cb: () => T[], ttl?: number);
758
+ /**
759
+ * @instance Clears cache globally or for a specific key.
760
+ * @param key Optional key to clear only a specific cache entry.
761
+ */
762
+ clearCache(key?: string): void;
763
+ /**
764
+ * @instance Finds all items that match the provided matcher using optional caching or fuzzy logic.
765
+ * @param matcher The value to match against.
766
+ * @param keySelector Property key or selector function.
767
+ * @param options Optional settings for search behavior and source list.
768
+ */
769
+ findAll(matcher: string | number, keySelector: KeySelector<T>, options?: FindOptions<T>): T[];
770
+ /**
771
+ * @instance Finds first matching item that matches the provided matcher using optional caching or fuzzy logic.
772
+ * @param matcher The value to match.
773
+ * @param keySelector Property key or selector function.
774
+ * @param options Optional behavior flags and item source.
775
+ */
776
+ findOne(matcher: string | number, keySelector: KeySelector<T>, options?: FindOptions<T>): Maybe<T>;
777
+ /**
778
+ * @instance Asynchronous variant of `findAll` that accepts a promise-based data supplier.
779
+ * @param supplier Async function resolving the items list.
780
+ * @param matcher The value to match.
781
+ * @param keySelector Property key or selector function.
782
+ * @param options Optional settings for search behavior and cache.
783
+ */
784
+ findAllAsync(supplier: () => Promise<T[]>, matcher: string | number, keySelector: KeySelector<T>, options?: Omit<FindOptions<T>, 'data'>): Promise<T[]>;
785
+ /**
786
+ * @instance Asynchronous variant of `findOne`.
787
+ * @param supplier Async function resolving the items list.
788
+ * @param matcher The value to match.
789
+ * @param keySelector Property key or selector function.
790
+ * @param options Optional settings for behavior and cache.
791
+ */
792
+ findOneAsync(supplier: () => Promise<T[]>, matcher: string | number, keySelector: KeySelector<T>, options?: Omit<FindOptions<T>, 'data'>): Promise<Maybe<T>>;
793
+ /**
794
+ * @instance Performs a binary search on a sorted array using a custom key selector.
795
+ *
796
+ * @param sorted - The sorted array of items to search.
797
+ * @param matcher - The value to search for.
798
+ * @param keySelector - A function that extracts the comparable key from each item.
799
+ * @param caseInsensitive - Whether to compare string keys ignoring case.
800
+ * @returns The first matching item if found; otherwise, undefined.
801
+ */
802
+ binarySearch(sorted: T[], matcher: string | number, keySelector: (item: T) => string | number, caseInsensitive: boolean): Maybe<T>;
803
+ /**
804
+ * @instance Performs a fuzzy search on an array by matching characters in sequence.
805
+ *
806
+ * @param array - The array of items to search.
807
+ * @param matcher - The fuzzy search string to match against.
808
+ * @param keySelector - A function that extracts the key to search from each item.
809
+ * @param caseInsensitive - Whether to compare ignoring case for string values.
810
+ * @returns The first fuzzy-matching item if found; otherwise, undefined.
811
+ */
812
+ fuzzySearch(array: T[], matcher: string, keySelector: (item: T) => string | number, caseInsensitive: boolean): Maybe<T>;
813
+ }
814
+ //#endregion
815
+ //#region src/array/sort.d.ts
816
+ /**
817
+ * Compare two strings using natural sorting (e.g., `"file2"` < `"file10"`).
818
+ * - Optionally supports case-insensitive and locale-aware string chunk comparisons.
819
+ *
820
+ * @param a - The first string to compare.
821
+ * @param b - The second string to compare.
822
+ * @param options - Optional settings to configure comparison behavior.
823
+ * @returns A negative number if `a` comes before `b`, a positive number if `a` comes after `b`, or 0 if equal.
824
+ */
825
+ declare function naturalSort(a: string, b: string, options?: SortNature): number;
826
+ /**
827
+ * * Sorts an array of objects based on the provided options.
828
+ *
829
+ * @remarks
830
+ * - Sorts array by the specified field in the options `sortByField`.
831
+ * - Uses {@link naturalSort} for sorting string values.
832
+ *
833
+ * @param array - The array of objects to sort.
834
+ * @param options - Sorting options for objects.
835
+ * @returns The sorted array.
836
+ */
837
+ declare function sortAnArray<T extends GenericObject>(array: T[], options: SortByOption<T>): T[];
838
+ /**
839
+ * * Sorts an array of `strings`, `numbers` or `boolean` based on the provided options.
840
+ *
841
+ * @remarks
842
+ * - If the array contains strings, it sorts them alphabetically.
843
+ * - If the array contains numbers, it sorts them numerically.
844
+ * - If the array contains booleans, it sorts them by their boolean value.
845
+ * - Uses {@link naturalSort} for sorting string values.
846
+ *
847
+ * @param array - The array of `strings`, `numbers` or `boolean` to sort.
848
+ * @param options - Sorting options.
849
+ * @returns The sorted array.
850
+ */
851
+ declare function sortAnArray<T extends BasicPrimitive>(array: T[], options?: OrderOption): T[];
852
+ //#endregion
853
+ //#region src/array/transform.d.ts
854
+ /**
855
+ * * Converts an array of objects into a formatted array of options.
856
+ *
857
+ * @param data - An array of objects to convert into options.
858
+ * @param config - The configuration object to specify the keys for the `value` (firstFieldName) and `label` (secondFieldName) fields and rename as needed.
859
+ * @returns An array of options, where each option has `value` and `label` fields as default or as specified by user in the config options.
860
+ */
861
+ declare function createOptionsArray<T extends GenericObject, K1 extends string = 'value', K2 extends string = 'label', V extends boolean = false>(data: T[], config: OptionsConfig<T, K1, K2, V>): Array<{ [P in K1 | K2]: FieldValue<P, T, K1, K2, V> }>;
862
+ /**
863
+ * * Removes duplicate values from an array, supporting deep comparison for objects and arrays.
864
+ *
865
+ * @param array - The array from which duplicates need to be removed.
866
+ * @returns A new array with duplicates removed.
867
+ */
868
+ declare function removeDuplicatesFromArray<T>(array: T[]): T[];
869
+ /**
870
+ * * Finds duplicate values in an array, runs deep comparison for objects and arrays.
871
+ *
872
+ * @param array - The array in which to find duplicates.
873
+ * @returns An array containing all duplicate entries (each one only once).
874
+ */
875
+ declare function getDuplicates<T>(array: T[]): T[];
876
+ /**
877
+ * * Finds elements missing from one array compared to another using deep comparison.
878
+ *
879
+ * @param options - Configuration to specify which array to compare and direction of check.
880
+ * @returns An array of missing elements based on the comparison direction.
881
+ */
882
+ /**
883
+ * * Finds elements missing from one array compared to another using deep comparison.
884
+ *
885
+ * @param array1 The first array to compare.
886
+ * @param array2 The second array to compare.
887
+ * @param missingFrom Which direction to compare for missing values:.
888
+ * - `'from-first'` → values in `array1` missing in `array2`.
889
+ * - `'from-second'` → values in `array2` missing in `array1`.
890
+ * @returns An array of missing elements based on the comparison direction.
891
+ */
892
+ declare function findMissingElements<T, U>(array1: T[], array2: U[], missingFrom: 'from-first' | 'from-second'): (T | U)[];
893
+ /**
894
+ * * Splits an array into chunks of a given size.
895
+ *
896
+ * @param arr The array to split.
897
+ * @param chunkSize The size of each chunk.
898
+ * @returns An array of chunked arrays.
899
+ */
900
+ declare function splitArray<T>(arr: T[], chunkSize: number): Array<T[]>;
901
+ /**
902
+ * * Group an array of objects by a specified key, returning only arrays of grouped objects.
903
+ *
904
+ * @param source - The source array of objects to group.
905
+ * @param property - The property to group the array by. Property can be a string, number, boolean, undefined or null. Supports nested dot notation.
906
+ *
907
+ * @returns An array of grouped arrays. Each sub-array contains objects that share the same value for the specified property.
908
+ *
909
+ * @example
910
+ * splitArrayByProperty([{ type: 'a' }, { type: 'b' }, { type: 'a' }, { type: undefined }], 'type')
911
+ * // => [ [{ type: 'a' }, { type: 'a' }], [{ type: 'b' }], [{ type: undefined }] ]
912
+ *
913
+ * @notes
914
+ * - Returns an empty array if the input is invalid or empty.
915
+ * - Groups objects even when the group key is `undefined` or `null` (object with `null` & `undefined` property-values are grouped together).
916
+ */
917
+ declare function splitArrayByProperty<T extends GenericObject, P extends NestedPrimitiveKey<T>>(source: Maybe<T[]>, property: P): Array<T[]>;
918
+ /**
919
+ * * Rotates an array left or right by a given number of steps.
920
+ *
921
+ * @param arr The array to rotate.
922
+ * @param steps The number of positions to rotate (positive: right, negative: left).
923
+ * @returns The rotated array.
924
+ */
925
+ declare function rotateArray<T>(arr: T[], steps: number): T[];
926
+ /**
927
+ * * Moves an element within an array from one index to another.
928
+ *
929
+ * @param arr The array to modify.
930
+ * @param fromIndex The index of the element to move.
931
+ * @param toIndex The new index for the element.
932
+ * @returns A new array with the element moved.
933
+ */
934
+ declare function moveArrayElement<T>(arr: T[], fromIndex: number, toIndex: number): T[];
935
+ //#endregion
936
+ //#region src/object/basics.d.ts
937
+ /**
938
+ * * Deep clone an object using `structuredClone` or deterministic *JSON serialization*.
939
+ *
940
+ * @param obj Object to clone.
941
+ * @param serialize Whether to force deterministic JSON serialization instead of using `structuredClone`. Defaults to `false`.
942
+ * @returns Deep cloned object.
943
+ *
944
+ * @remarks
945
+ * **Primary behavior**
946
+ * - By default (`serialize = false`), the function uses {@link https://developer.mozilla.org/docs/Web/API/Window/structuredClone structuredClone} when available. This supports:
947
+ * - Circular references
948
+ * - `Date` objects
949
+ * - `Map` / `Set`
950
+ * - `RegExp`
951
+ * - Typed arrays
952
+ * - Most built-in JavaScript types
953
+ * - Preserves `undefined` values
954
+ *
955
+ * - **Note:** `structuredClone` **does not preserve class prototypes**, even though it preserves data types like `Date`, `Map`, and `Set`.
956
+ *
957
+ * **Deterministic serialization mode**
958
+ * - When `serialize = true`, or when `structuredClone` is unavailable, the function falls back to **stable JSON serialization** via `stableStringify`. This guarantees:
959
+ * - All object keys are sorted alphabetically.
960
+ * - Consistent output across environments (deterministic).
961
+ * - All `undefined` values are converted to `null`.
962
+ * - Converting date-like objects (`Date`, `Chronos`, `Moment.js`, `Day.js`, `Luxon`, `JS-Joda`, `Temporal`) **in the same way that {@link JSON.stringify} would serialize them**, ensuring predictable and JSON-compliant output.
963
+ *
964
+ * - This mode is ideal for:
965
+ * - Hashing
966
+ * - Signature generation
967
+ * - Deep equality checks
968
+ * - Anything requiring deterministic, environment-neutral output
969
+ *
970
+ * **Deterministic mode limitations**
971
+ * - JSON serialization will:
972
+ * - Drop functions and `Symbol` values.
973
+ * - Lose prototype and class instance information.
974
+ * - Convert all date-like objects into strings.
975
+ * - Fail on circular references.
976
+ *
977
+ * **Final safety fallback**
978
+ * - If JSON serialization fails (e.g., due to circular references), the function returns a **shallow clone** (`{ ...obj }`) to ensure the cloning never throws.
979
+ */
980
+ declare function cloneObject<T extends GenericObject>(obj: T, serialize?: boolean): T;
981
+ /**
982
+ * * Count the number of fields in an object.
983
+ *
984
+ * @param obj Object to check.
985
+ * @returns Number of fields in the object.
986
+ */
987
+ declare function countObjectFields<T extends GenericObject>(obj: T): number;
988
+ /**
989
+ * * Extracts all the top-level keys of an object as an array.
990
+ *
991
+ * @remarks
992
+ * - Returns a normal array of keys (string literals).
993
+ * - Safe for runtime iteration.
994
+ * - Returns an empty array (`[]`) for empty or non-object values.
995
+ *
996
+ * @param obj The object from which to extract keys.
997
+ * @returns Array of keys.
998
+ *
999
+ * @example
1000
+ * const keys = extractObjectKeys({ a: 1, b: 2 });
1001
+ * // keys: ["a", "b"]; typed as ("a" | "b")[]
1002
+ */
1003
+ declare function extractObjectKeys<T extends GenericObject>(obj: T): Array<keyof T>;
1004
+ /**
1005
+ * * Extracts all the top-level keys of an object as a tuple.
1006
+ *
1007
+ * @remarks
1008
+ * - Returns a typed tuple based on the input type, not runtime values.
1009
+ * - **Caution:** The order of keys in the returned tuple is determined by TypeScript’s type system and **may not match the runtime order** returned by `Object.keys(obj)`.
1010
+ * - Use this tuple for strict type-level operations, not for runtime iteration that relies on key order.
1011
+ * - Useful when you want literal type information preserved.
1012
+ * - Returns an empty tuple (`[]`) for empty or non-object values.
1013
+ *
1014
+ * @param obj The object from which to extract keys.
1015
+ * @param tuple Pass `true` to return as tuple instead of an array type.
1016
+ * @returns Tuple of keys.
1017
+ *
1018
+ * @example
1019
+ * const keysTuple = extractObjectKeys({ a: 1, b: 2 }, true);
1020
+ * // keysTuple: ["a", "b"]; also typed as ["a", "b"]
1021
+ */
1022
+ declare function extractObjectKeys<T extends GenericObject>(obj: T, tuple: true): Tuple<keyof T>;
1023
+ /**
1024
+ * * Recursively extracts all nested keys from an object as an array.
1025
+ *
1026
+ * @remarks
1027
+ * - Returns an empty array (`[]`) for an empty object or a non-object value.
1028
+ * - For only top-level keys, use {@link extractObjectKeys}.
1029
+ *
1030
+ * @param obj The object from which to extract the keys.
1031
+ * @returns An array of all the nested keys (string literals) from the specified object.
1032
+ */
1033
+ declare function extractObjectKeysDeep<T extends GenericObject>(obj: T): Array<DeepKeys<T>>;
1034
+ //#endregion
1035
+ //#region src/object/objectify.d.ts
1036
+ /**
1037
+ * Deeply merges two or more objects.
1038
+ * Objects are merged recursively. Later values override earlier ones unless both are plain objects.
1039
+ *
1040
+ * @param objects - List of objects to be merged.
1041
+ * @returns A new object with deeply merged properties from all input objects.
1042
+ *
1043
+ * @example
1044
+ * const obj1 = { a: 1, b: { x: 10 } };
1045
+ * const obj2 = { b: { y: 20 }, c: 3 };
1046
+ * const merged = mergeObjects(obj1, obj2);
1047
+ * // merged = { a: 1, b: { x: 10, y: 20 }, c: 3 }
1048
+ *
1049
+ * @example
1050
+ * mergeObjects(
1051
+ * { a: 1, b: 2 },
1052
+ * { p: { c: 3 }, d: 4 },
1053
+ * { p: { e: 5 }, f: 6 }
1054
+ * );
1055
+ * // => { a: 1, b: 2, p: { c: 3, e: 5 }, d: 4, f: 6 }
1056
+ */
1057
+ declare const mergeObjects: <T extends Objects>(...objects: T) => ExpandAll<MergeAll<T>>;
1058
+ /**
1059
+ * * Deeply merge objects and flatten nested objects.
1060
+ * * Useful for flattening a single object or merging multiple objects with duplicate key(s).
1061
+ * * If keys are duplicated, the last object's value will be used.
1062
+ *
1063
+ * @param objects Objects to merge.
1064
+ * @returns Merged object with flattened structure.
1065
+ */
1066
+ declare const mergeAndFlattenObjects: <T extends Objects>(...objects: T) => ExpandAll<FlattenDotValue<MergeAll<T>>>;
1067
+ /**
1068
+ * * Flattens a nested object into key-value format.
1069
+ *
1070
+ * @param object - The `object` to flatten.
1071
+ * @returns A `flattened object` in key-value format.
1072
+ */
1073
+ declare const flattenObjectKeyValue: <T extends GenericObject>(object: T) => ExpandAll<FlattenLeafValue<MergeAll<[T]>>>;
1074
+ /**
1075
+ * * Flattens a nested object into a dot notation format.
1076
+ *
1077
+ * @param object - The `object` to flatten.
1078
+ * @returns A `flattened object` with dot notation keys.
1079
+ */
1080
+ declare const flattenObjectDotNotation: <T extends GenericObject>(object: T) => ExpandAll<FlattenDotValue<MergeAll<[T]>>>;
1081
+ /**
1082
+ * * Extracts only the fields that have changed between the original and updated object.
1083
+ *
1084
+ * @param baseObject The original object to compare against.
1085
+ * @param updatedObject The modified object containing potential updates.
1086
+ * @returns A new object containing only the changed fields.
1087
+ */
1088
+ declare const extractUpdatedFields: <T extends GenericObject>(baseObject: T, updatedObject: FlattenPartial<T>) => FlattenPartial<T>;
1089
+ /**
1090
+ * * Extracts only new fields that exist in updatedObject but not in baseObject.
1091
+ *
1092
+ * @param baseObject The original object to compare against.
1093
+ * @param updatedObject The modified object containing potential new fields.
1094
+ * @returns A new object containing only the new fields.
1095
+ */
1096
+ declare const extractNewFields: <T extends GenericObject, U extends GenericObject>(baseObject: T, updatedObject: FlattenPartial<T> & FlattenPartial<U>) => FlattenPartial<U>;
1097
+ /**
1098
+ * * Extracts changed fields from the updated object while also identifying newly added keys.
1099
+ *
1100
+ * @param baseObject The original object to compare against.
1101
+ * @param updatedObject The modified object containing potential updates.
1102
+ * @returns An object containing modified fields and new fields separately.
1103
+ */
1104
+ declare const extractUpdatedAndNewFields: <T extends GenericObject, U extends GenericObject>(baseObject: T, updatedObject: FlattenPartial<T> & FlattenPartial<U>) => FlattenPartial<T> & FlattenPartial<U>;
1105
+ /**
1106
+ * * Safely parses a JSON string into an object.
1107
+ * * Optionally converts stringified primitive values inside the object (e.g., `"0"` → `0`, `"true"` → `true`, `"null"` → `null`).
1108
+ *
1109
+ * @param value - The JSON string to parse.
1110
+ * @param parsePrimitives - Whether to convert stringified primitives into real values (default: `true`).
1111
+ * @returns A parsed object with primitive conversions, or an empty object on failure or if the root is not a valid object.
1112
+ * - Returns `{}` if parsing fails, such as when the input is malformed or invalid JSON or passing single quoted string.
1113
+ *
1114
+ * - **N.B.** This function will return an empty object if the JSON string is invalid or if the root element is not an object.
1115
+ *
1116
+ * - *Unlike `parseJSON`, which returns any valid JSON structure (including arrays, strings, numbers, etc.),
1117
+ * this function strictly ensures that the result is an object and optionally transforms stringified primitives.*
1118
+ *
1119
+ * @see parseJSON - For parsing generic JSON values (arrays, numbers, etc.) with optional primitive transformation.
1120
+ *
1121
+ */
1122
+ declare const parseJsonToObject: <T extends GenericObject = GenericObject>(value: string, parsePrimitives?: boolean) => T;
1123
+ //#endregion
1124
+ //#region src/object/sanitize.d.ts
1125
+ /**
1126
+ * * Trims all the words in a string.
1127
+ *
1128
+ * @param input String to sanitize.
1129
+ * @returns Sanitized string .
1130
+ */
1131
+ declare function sanitizeData(input: string): string;
1132
+ /**
1133
+ * * Trims all the words in an array of strings.
1134
+ *
1135
+ * @param input Array of strings to sanitize.
1136
+ * @returns Sanitized array of strings.
1137
+ */
1138
+ declare function sanitizeData(input: string[]): string[];
1139
+ /**
1140
+ * * Sanitizes a deeply nested array that may contain arrays, objects or other (mixed) data types.
1141
+ * * Preserves structure while removing empty values and trimming strings and other operations.
1142
+ *
1143
+ * @param array - An array of objects that may contain arrays, objects or other data types.
1144
+ * @param options - Options that define which keys to ignore, whether to trim string values, and whether to exclude nullish, falsy or empty values.
1145
+ * @param _return - By default return type is as it is, passing this parameter `partial` makes the return type `$DeepPartial<T>`.
1146
+ * @returns A new sanitized array with the specified modifications.
1147
+ */
1148
+ declare function sanitizeData<Data extends GenericObject, Ignored extends DotNotationKey<Data> = never, PoR extends PartialOrRequired = 'required'>(array: Data[], options?: SanitizeOptions<Data, Ignored>, _return?: PoR): Array<SanitizedData<Data, Ignored, PoR>>;
1149
+ /**
1150
+ * * Sanitizes an object by ignoring specified keys and trimming string values based on options provided.
1151
+ * * Also excludes nullish values (`null`, `undefined`), falsy (`nullish` + `0` & `""`) or empty values (`object`, `array`) if specified.
1152
+ *
1153
+ * @param object - The object to sanitize.
1154
+ * @param options - Options that define which keys to ignore, whether to trim string values, and whether to exclude nullish, falsy or empty values.
1155
+ * @param _return - By default return type is as it is, passing this parameter `true` makes the return type `Partial<T>`.
1156
+ * @returns A new object with the specified modifications.
1157
+ */
1158
+ declare function sanitizeData<Data extends GenericObject, Ignored extends DotNotationKey<Data> = never, PoR extends PartialOrRequired = 'required'>(object: Data, options?: SanitizeOptions<Data, Ignored>, _return?: PoR): SanitizedData<Data, Ignored, PoR>;
1159
+ /**
1160
+ * * Parse an object of stringified values into their appropriate primitive types.
1161
+ *
1162
+ * @description
1163
+ * - Attempts to convert string values into `boolean`, `number`, or JSON-parsed objects/arrays.
1164
+ * - Non-string values except arrays/objects are left unchanged. Nested arrays/objects are parsed recursively.
1165
+ *
1166
+ * @param object - The object with potentially stringified primitive values.
1167
+ * @param parseNested - Whether to convert stringified primitives in nested arrays/objects. (default: `true`).
1168
+ * @returns A new object with parsed values converted to their original types.
1169
+ */
1170
+ declare function parseObjectValues<T extends GenericObject>(object: T, parseNested?: boolean): { [K in keyof T]: Any };
1171
+ //#endregion
1172
+ //#region src/object/convert.d.ts
1173
+ /**
1174
+ * * Converts the values of specified keys in an object to `"string"` or `"number"`.
1175
+ * * Supports nested objects using dot-notation keys.
1176
+ *
1177
+ * @param data The object to convert.
1178
+ * @param options Options object specifying the conversion mapping.
1179
+ * - `keys`: The keys in the objects to be converted (dot-notation supported).
1180
+ * - `convertTo`: The target type, either `"string"` or `"number"`.
1181
+ * @returns The modified object with the converted values as `"string"` or `"number"`.
1182
+ */
1183
+ declare function convertObjectValues<T extends GenericObject, Key extends NumericDotKey<T>, C extends 'string' | 'number'>(data: T, options: ConvertObjectOptions<T, Key, C>): ConvertedObject<T, Key, C>;
1184
+ /**
1185
+ * * Converts the values of specified keys in an array of objects to `"string"` or `"number"`.
1186
+ * * Supports nested objects using dot-notation keys.
1187
+ *
1188
+ * @param data The array of objects to convert.
1189
+ * @param options Options object specifying the conversion mapping.
1190
+ * - `keys`: The keys in the objects to be converted (dot-notation supported).
1191
+ * - `convertTo`: The target type, either `"string"` or `"number"`.
1192
+ * @returns The modified array of objects with the converted values as `"string"` or `"number"`.
1193
+ */
1194
+ declare function convertObjectValues<T extends GenericObject, Key extends NumericDotKey<T>, C extends 'string' | 'number'>(data: Array<T>, options: ConvertObjectOptions<T, Key, C>): Array<ConvertedObject<T, Key, C>>;
1195
+ /**
1196
+ * * Pick specific fields from an object and create a new object with specified fields.
1197
+ *
1198
+ * @description This function creates a new object containing only the specified fields from the source object.
1199
+ * It is useful for creating a new object with a subset of properties from an existing object.
1200
+ *
1201
+ * @param T The type of the source object.
1202
+ * @param U The type of the keys to pick from the source object.
1203
+ *
1204
+ * @param source The source object from which to pick fields.
1205
+ * @param keys The keys of the fields to pick from the source object.
1206
+ *
1207
+ * @returns An object containing only the picked fields.
1208
+ */
1209
+ declare function pickFields<T extends GenericObject, U extends keyof T>(source: T, keys: U[]): { [K in U]: T[K] };
1210
+ /**
1211
+ * * Create a new object by removing specific keys from the source object.
1212
+ *
1213
+ * @param source - The original (source) object from which to delete fields.
1214
+ * @param keys - An array of keys (fields) to remove from the object.
1215
+ *
1216
+ * @returns A new object without the specified keys.
1217
+ *
1218
+ * @example
1219
+ * deleteFields({ a: 1, b: 2, c: 3 }, ['b'])
1220
+ * // => { a: 1, c: 3 }
1221
+ *
1222
+ * @notes
1223
+ * - Does not mutate the original object.
1224
+ * - Useful for excluding sensitive or unwanted fields.
1225
+ */
1226
+ declare function deleteFields<T extends GenericObject, U extends keyof T>(source: T, keys: readonly U[]): { [K in Exclude<keyof T, U>]: T[K] };
1227
+ /**
1228
+ * * Pick specific fields from an object based on a given condition.
1229
+ *
1230
+ * @description This function creates a new object containing only the fields that satisfy the given condition.
1231
+ * The condition can be based on the field's value or type, depending on the implementation.
1232
+ *
1233
+ * @param T The type of the source object.
1234
+ *
1235
+ * @param source The source object from which to pick fields.
1236
+ * @param condition A function that takes the key and value of a property and returns a boolean indicating whether the property should be picked.
1237
+ *
1238
+ * @returns An object containing only the fields that satisfy the condition.
1239
+ */
1240
+ declare function pickObjectFieldsByCondition<T extends GenericObject>(source: T, condition: (key: keyof T, value: T[keyof T]) => boolean): Partial<T>;
1241
+ /**
1242
+ * * Remap fields from one object to another.
1243
+ * @description This function creates a new object with fields remapped from the source object to the target object based on the provided field map.
1244
+ *
1245
+ * @param source The source object from which to remap fields.
1246
+ * @param fieldMap An object that maps target keys to source keys.
1247
+ * @returns An object with fields remapped according to the field map.
1248
+ */
1249
+ declare function remapFields<Source extends GenericObject, Target extends Record<string, keyof Source>>(source: Source, fieldMap: Target): { [K in keyof Target]: Source[Target[K]] };
1250
+ //#endregion
1251
+ //#region src/utils/index.d.ts
1252
+ /**
1253
+ * * Deeply compare two values (arrays, objects, or primitive values).
1254
+ *
1255
+ * @param a First value to compare.
1256
+ * @param b Second value to compare.
1257
+ * @returns Whether the values are deeply equal.
1258
+ */
1259
+ declare const isDeepEqual: (a: unknown, b: unknown) => boolean;
1260
+ /**
1261
+ * * Converts an array of objects to a string using a specific property (supports nested path to primitive values) and separator.
1262
+ *
1263
+ * @example
1264
+ * const users = [
1265
+ * { id: 1, name: { first: 'Alice' }, city: 'Bangu', },
1266
+ * { id: 4, name: { first: 'Bob' }, city: 'Banguland', },
1267
+ * ];
1268
+ * convertArrayToString(users, { target: 'name.first', separator: ' | ' });
1269
+ * // "Alice | Bob"
1270
+ *
1271
+ * @param array Array of objects to convert.
1272
+ * @param options Options including the target property and separator.
1273
+ * @returns String formed by joining the property values with the given separator.
1274
+ */
1275
+ declare function convertArrayToString<T extends GenericObject>(array: Maybe<T[]>, options: ArrayOfObjectsToStringOptions<T>): string;
1276
+ /**
1277
+ * * Converts an array of primitive values to a string using a custom separator.
1278
+ *
1279
+ * @example
1280
+ * convertArrayToString(['red', 'green', 'blue'], { separator: ' - ' });
1281
+ * // "red - green - blue"
1282
+ *
1283
+ * @example
1284
+ * convertArrayToString([1, 2, 3]);
1285
+ * // "1, 2, 3"
1286
+ *
1287
+ * @param array Array of primitive values to convert.
1288
+ * @param options Optional separator configuration.
1289
+ * @returns String formed by joining array elements with the given separator.
1290
+ */
1291
+ declare function convertArrayToString<T extends Primitive>(array: Maybe<T[]>, options?: ArrayOfPrimitivesToStringOptions): string;
1292
+ /**
1293
+ * * A generic debounce function that delays the execution of a callback.
1294
+ *
1295
+ * @param callback - The function to debounce.
1296
+ * @param delay - The delay in milliseconds. Default is `300ms`.
1297
+ * @returns A debounced version of the callback function.
1298
+ *
1299
+ * @example
1300
+ * const debouncedSearch = debounceAction((query: string) => {
1301
+ * console.log(`Searching for: ${query}`);
1302
+ * }, 300);
1303
+ *
1304
+ * debouncedSearch('laptop'); // Executes after 300ms of inactivity.
1305
+ */
1306
+ declare function debounceAction<T extends VoidFn>(callback: T, delay?: number): DelayedFn<T>;
1307
+ /**
1308
+ * * A generic throttle function that ensures a callback is executed at most once per specified interval.
1309
+ *
1310
+ * @param callback - The function to throttle.
1311
+ * @param delay - The delay in milliseconds. Default is `150ms`.
1312
+ * @returns A throttled version of the callback function.
1313
+ *
1314
+ * @example
1315
+ * const throttledResize = throttleAction(() => {
1316
+ * console.log('Resized');
1317
+ * }, 300);
1318
+ *
1319
+ * window.addEventListener('resize', throttledResize);
1320
+ */
1321
+ declare function throttleAction<T extends VoidFn>(callback: T, delay?: number): DelayedFn<T>;
1322
+ /**
1323
+ * * Retrieves the names of all instance methods defined directly on a class prototype.
1324
+ *
1325
+ * @param cls - The class constructor (not an instance).
1326
+ * @returns A sorted array of instance method names.
1327
+ */
1328
+ declare function getInstanceMethodNames(cls: Constructor): string[];
1329
+ /**
1330
+ * * Retrieves the names of all static methods defined directly on a class constructor.
1331
+ *
1332
+ * @param cls - The class constructor (not an instance).
1333
+ * @returns A sorted array of static method names.
1334
+ */
1335
+ declare function getStaticMethodNames(cls: Constructor): string[];
1336
+ /**
1337
+ * * Counts the number of instance methods defined directly on a class prototype.
1338
+ *
1339
+ * @param cls - The class constructor (not an instance).
1340
+ * @returns The number of instance methods defined on the class prototype.
1341
+ */
1342
+ declare function countInstanceMethods(cls: Constructor): number;
1343
+ /**
1344
+ * * Counts the number of static methods defined directly on a class constructor.
1345
+ *
1346
+ * @param cls - The class constructor (not an instance).
1347
+ * @returns The number of static methods defined on the class constructor.
1348
+ */
1349
+ declare function countStaticMethods(cls: Constructor): number;
1350
+ /**
1351
+ * * Retrieves the names of all instance getters defined directly on a class prototype.
1352
+ *
1353
+ * @param cls - The class constructor (not an instance).
1354
+ * @returns A sorted array of instance getter names.
1355
+ */
1356
+ declare function getInstanceGetterNames(cls: Constructor): string[];
1357
+ /**
1358
+ * * Retrieves the names of all static getters defined directly on a class constructor.
1359
+ *
1360
+ * @param cls - The class constructor (not an instance).
1361
+ * @returns A sorted array of static getter names.
1362
+ */
1363
+ declare function getStaticGetterNames(cls: Constructor): string[];
1364
+ /**
1365
+ * * Gathers detailed information about the instance and static methods of a class.
1366
+ *
1367
+ * @param cls - The class constructor (not an instance).
1368
+ * @returns An object containing names and counts of instance and static methods.
1369
+ */
1370
+ declare function getClassDetails(cls: Constructor): ClassDetails;
1371
+ /**
1372
+ * * Create a deterministic JSON string representation of any value.
1373
+ * - The output format matches standard JSON but with guaranteed sorted keys.
1374
+ *
1375
+ * @remarks
1376
+ * - This function guarantees **stable, repeatable output** by:
1377
+ * - Sorting all object keys alphabetically.
1378
+ * - Recursively stabilizing nested objects and arrays.
1379
+ * - Converting all `undefined` values into `null` so the output remains valid JSON.
1380
+ * - Converting date-like objects (`Date`, `Chronos`, `Moment.js`, `Day.js`, `Luxon`, `JS-Joda`, `Temporal`) **in the same way that {@link JSON.stringify} would serialize them**, ensuring predictable and JSON-compliant output.
1381
+ * - Falling back to native JSON serialization for primitives.
1382
+ *
1383
+ * - **Useful for:**
1384
+ * - Hash generation (e.g., signatures, cache keys)
1385
+ * - Deep equality checks
1386
+ * - Producing predictable output across environments
1387
+ *
1388
+ * @param obj - The value to stringify into a deterministic JSON string.
1389
+ * @returns A stable, deterministic string representation of the input.
1390
+ */
1391
+ declare function stableStringify(obj: unknown): string;
1392
+ /**
1393
+ * * Remove trailing or leading garbage characters **after/before JSON object or array**.
1394
+ * @param str String to sanitize/strip.
1395
+ * @returns Sanitized/stripped JSON string.
1396
+ */
1397
+ declare function stripJsonEdgeGarbage(str: string): string;
1398
+ /**
1399
+ * * Parses any valid JSON string, optionally converting stringified primitives inside (nested) arrays or objects.
1400
+ *
1401
+ * @typeParam T - Expected return type (default is unknown).
1402
+ * @param value - The JSON string to parse.
1403
+ * @param parsePrimitives - Whether to convert stringified primitives (default: `true`).
1404
+ * @returns The parsed JSON value typed as `T`, or the original parsed value with optional primitive conversion.
1405
+ * - Returns `{}` if parsing fails, such as when the input is malformed or invalid JSON or passing single quoted string.
1406
+ *
1407
+ * - *Unlike {@link https://toolbox.nazmul-nhb.dev/docs/utilities/object/parseJsonToObject parseJsonToObject}, which ensures the root value is an object,
1408
+ * this function returns any valid JSON structure such as arrays, strings, numbers, or objects.*
1409
+ *
1410
+ * This is useful when you're not sure of the root structure of the JSON, or when you expect something other than an object.
1411
+ *
1412
+ * @see {@link https://toolbox.nazmul-nhb.dev/docs/utilities/object/parseJsonToObject parseJsonToObject} for strict object-only parsing.
1413
+ */
1414
+ declare const parseJSON: <T = unknown>(value: string, parsePrimitives?: boolean) => T;
1415
+ /**
1416
+ * * Recursively parses primitive values inside objects and arrays.
1417
+ *
1418
+ * @typeParam T - Expected return type after parsing (default is unknown).
1419
+ * @param input - Any input value to parse recursively.
1420
+ * @returns Input with primitives (strings like "true", "123") converted, typed as `T`.
1421
+ */
1422
+ declare function deepParsePrimitives<T = unknown>(input: unknown): T;
1423
+ /**
1424
+ * * Defines a method on any prototype — including built-in prototypes — in a safe, idempotent manner.
1425
+ * - The method is non-enumerable by default and will not overwrite an existing method unless explicitly allowed.
1426
+ *
1427
+ * @param proto The target prototype object (e.g., String.prototype).
1428
+ * @param name The method name to define on the prototype.
1429
+ * @param impl The function implementation for the method.
1430
+ * @param options Optional property-descriptor settings and overwrite rules.
1431
+ *
1432
+ * @example
1433
+ * // Safely augment prototype methods by extending the global interface:
1434
+ * declare global {
1435
+ * interface String {
1436
+ * toBang(): string;
1437
+ * }
1438
+ * }
1439
+ *
1440
+ * // Define a custom method on String.prototype
1441
+ * definePrototypeMethod(String.prototype, 'toBang', function (this: String) {
1442
+ * return this.toString().concat('!');
1443
+ * // or
1444
+ * // return this.concat('!');
1445
+ * });
1446
+ *
1447
+ * "Hi".toBang(); // "Hi!"
1448
+ *
1449
+ * // Attempting to redefine without overwrite option is ignored
1450
+ * definePrototypeMethod(String.prototype, 'toBang', () => 'x'); // ignored
1451
+ *
1452
+ * // Overwrite intentionally using the overwrite option
1453
+ * definePrototypeMethod(
1454
+ * String.prototype,
1455
+ * 'toBang',
1456
+ * function (this: String) { return this.concat('!!!'); },
1457
+ * { overwrite: true }
1458
+ * );
1459
+ *
1460
+ * "Hi".toBang(); // "Hi!!!"
1461
+ */
1462
+ declare function definePrototypeMethod<Proto extends object, Name extends keyof Proto>(proto: Proto, name: Name, impl: (...args: unknown[]) => unknown, options?: ProtoMethodOptions): void;
1463
+ //#endregion
1464
+ //#region src/utils/xtras.d.ts
1465
+ /**
1466
+ * @function `getCountryByPhone` Get country details by matching the country code in the given phone number.
1467
+ * @param phone - The phone number to look up, can be a string or a number. It will be normalized by removing any non-digit character before matching against the country codes.
1468
+ * @returns An array of country details that match the provided phone number. Each country detail includes the country name, country code, ISO short code, and ISO code. If the input is invalid (not a primitive value or an empty string), an empty array will be returned.
1469
+ *
1470
+ * @remarks
1471
+ * - The function uses the {@link COUNTRIES} constant, which is an array of country details, to find matches based on the normalized phone number.
1472
+ * - The normalization process removes any non-digit character from the input phone number to ensure consistent matching against the country codes.
1473
+ * - The function checks if the input is neither an empty string nor a finite number before proceeding with the normalization and matching process. If the input is invalid, it returns an empty array.
1474
+ * - If multiple countries share the same country code, all matching countries will be included in the returned array.
1475
+ * - **`IMPORTANT:`** If a phone number does not start with a country code (plain local number), the function will return an empty array since it cannot determine the country. But if the number matches the country code of any country, it will return the corresponding country details even if the number is a local number.
1476
+ *
1477
+ * @example
1478
+ * ```typescript
1479
+ * const country = getCountryByPhone('+8801623732187');
1480
+ * console.info(country);
1481
+ * // Output: [
1482
+ * // {
1483
+ * // country_name: 'Bangladesh',
1484
+ * // country_code: '880',
1485
+ * // iso_code_short: 'BD',
1486
+ * // iso_code: 'BGD'
1487
+ * // }
1488
+ * // ]
1489
+ * ```
1490
+ */
1491
+ declare function getCountryByPhone(phone: number | string): CountryDetails[];
1492
+ //#endregion
1493
+ export { Currency, Finder, Unit, Unit as UnitConverter, convertToRomanNumerals as arabicToRoman, convertToRomanNumerals, convertToRomanNumerals as integerToRoman, convertToRomanNumerals as numberToRoman, convertToRomanNumerals as numericToRoman, convertToRomanNumerals as toRoman, convertToRomanNumerals as toRomanNumeral, averageByField, averageByField as avgByField, banglaToDigit, getAverage as calculateAverage, getAverage, getAverage as getAverageOfNumbers, factorial as calculateFactorial, factorial, factorial as getFactorial, calculateHCF as calculateGCD, calculateHCF, calculateLCM as calculateLCD, calculateLCM, calculatePercentage, capitalizeString, getOrdinal as cardinalToOrdinal, getOrdinal as convertNumberToOrdinal, getOrdinal as convertToOrdinal, getOrdinal, getOrdinal as getOrdinalNumber, getOrdinal as numberToOrdinal, numberToWordsOrdinal as cardinalWordsToOrdinal, numberToWordsOrdinal as convertNumberToWordsOrdinal, numberToWordsOrdinal, clampNumber, cloneObject, naturalSort as compareNaturally, naturalSort as compareSorter, naturalSort, naturalSort as naturalSortForString, computeTextDiff, convertArrayToString, convertArrayToString as joinArrayElements, formatCurrency as convertNumberToCurrency, formatCurrency, numberToWords as convertNumberToWords, numberToWords, convertObjectValues, romanToInteger as convertRomanToArabic, romanToInteger as convertRomanToInteger, romanToInteger as convertRomanToNumeric, romanToInteger as romanToArabic, romanToInteger, romanToInteger as romanToNumeric, convertStringCase, convertToDecimal, convertToDecimal as convertToFixed, wordsToNumber as convertWordToNumber, wordsToNumber as convertWordsToNumber, wordsToNumber as wordToNumber, wordsToNumber, countInstanceMethods, countInstanceMethods as getInstanceMethodsCount, countObjectFields, countStaticMethods, countStaticMethods as getStaticMethodsCount, countWords, countWords as countWordsInString, countWords as wordCount, createOptionsArray, debounceAction, deepParsePrimitives, deepParsePrimitives as parsePrimitivesDeep, definePrototypeMethod, deleteFields, deleteFields as deleteObjectFields, deleteFields as omitFields, deleteFields as omitObjectFields, deleteFields as removeFields, deleteFields as removeObjectFields, digitToBangla, getDuplicates as extractDuplicates, getDuplicates as extractDuplicatesFromArray, getDuplicates, getDuplicates as getDuplicatesFromArray, extractEmails, extractObjectKeys as extractKeys, extractObjectKeys, extractObjectKeysDeep as extractKeysDeep, extractObjectKeysDeep, findMissingElements as extractMissingElements, findMissingElements, findMissingElements as getMissingElements, extractNewFields, extractNumbersFromString as extractNumbers, extractNumbersFromString, extractNumbersFromString as parseNumbersFromText, extractURLs, extractUpdatedAndNewFields, extractUpdatedFields, getFactors as factorsOf, getFactors as getDivisors, getFactors, fibonacciGenerator, fibonacciGenerator as generateFibonacci, filterArrayOfObjects, findPrimeNumbers, findPrimeNumbers as getPrimeNumbers, flattenArray, flattenObjectDotNotation, flattenObjectKeyValue, formatUnitWithPlural as formatNumberWithPluralUnit, formatUnitWithPlural, formatUnitWithPlural as formatWithPlural, generateAnagrams, generateRandomID, getCharacterDifferences, getClassDetails, getCountryByPhone, getFibonacciSeries as getFibonacci, getFibonacciSeries as getFibonacciNumbers, getFibonacciSeries, getFibonacciSeriesMemo, getFibonacciSeriesMemo as getMemoizedFibonacci, getFibonacciSeriesMemo as getMemoizedFibonacciSeries, getInstanceGetterNames, getInstanceMethodNames, getLastArrayElement, getLevenshteinDistance, getLevenshteinDistance as levenshteinDistance, getNthFibonacci, getNumbersInRange, getRandomFloat as getRandomDecimal, getRandomFloat, getRandomNumber as getRandomInt, getRandomNumber, getStaticGetterNames, getStaticMethodNames, sumNumbers as getSumOfNumbers, sumNumbers, sumNumbers as sumOfNumbers, groupAndAverageByField, groupAndAverageByField as groupAndAvgByField, groupAndSumByField, splitArrayByProperty as groupArrayByProperty, splitArrayByProperty, isDeepEqual, isInvalidOrEmptyArray, isInvalidOrEmptyArray as isValidEmptyArray, isPrime, isPrime as isPrimeNumber, maskString, mergeAndFlattenObjects, mergeObjects, moveArrayElement, normalizeNumber, normalizeString, parseJSON, parseJSON as parseJsonDeep, parseJsonToObject, parseObjectValues, parseObjectValues as parseStringifiedObjectValues, pickFields, pickFields as pickObjectFields, pickObjectFieldsByCondition as pickFieldsByCondition, pickObjectFieldsByCondition, remapFields, remapFields as remapObjectFields, removeDuplicatesFromArray as removeDuplicates, removeDuplicatesFromArray, replaceAllInString, reverseNumber, reverseString, rotateArray, roundNumber, roundNumber as roundToDecimal, roundToNearest as roundNumberToNearestInterval, roundToNearest, roundToNearest as roundToNearestInterval, sanitizeData, shuffleArray, slugifyString, sortAnArray, splitArray, stableStringify, stripJsonEdgeGarbage, sumByField, sumDigits, sumFieldDifference, sumFieldDifference as totalDeltaByField, throttleAction, trimString, truncateString };