nhb-toolbox 4.20.27 → 4.20.30

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 (324) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/dist/cjs/array/Finder.js +0 -75
  3. package/dist/cjs/array/basics.js +0 -35
  4. package/dist/cjs/array/calc.js +0 -63
  5. package/dist/cjs/array/helpers.js +0 -15
  6. package/dist/cjs/array/sort.js +0 -16
  7. package/dist/cjs/array/transform.js +0 -73
  8. package/dist/cjs/array/utils.js +0 -19
  9. package/dist/cjs/colors/Color.js +0 -199
  10. package/dist/cjs/colors/constants.js +0 -2
  11. package/dist/cjs/colors/convert.js +0 -114
  12. package/dist/cjs/colors/css-colors.js +0 -1
  13. package/dist/cjs/colors/helpers.js +0 -73
  14. package/dist/cjs/colors/initials.js +0 -17
  15. package/dist/cjs/colors/random.js +0 -17
  16. package/dist/cjs/colors/utils.js +0 -18
  17. package/dist/cjs/date/Chronos.js +11 -595
  18. package/dist/cjs/date/chronos-fn.js +0 -112
  19. package/dist/cjs/date/constants.js +1 -161
  20. package/dist/cjs/date/greet.js +0 -6
  21. package/dist/cjs/date/guards.js +0 -29
  22. package/dist/cjs/date/plugins/businessPlugin.js +0 -3
  23. package/dist/cjs/date/plugins/dayPartPlugin.js +0 -2
  24. package/dist/cjs/date/plugins/fromNowPlugin.js +0 -2
  25. package/dist/cjs/date/plugins/palindromePlugin.js +0 -1
  26. package/dist/cjs/date/plugins/relativeTimePlugin.js +0 -3
  27. package/dist/cjs/date/plugins/seasonPlugin.js +0 -2
  28. package/dist/cjs/date/plugins/timeZonePlugin.js +0 -1
  29. package/dist/cjs/date/plugins/zodiacPlugin.js +0 -1
  30. package/dist/cjs/date/seasons.js +14 -25
  31. package/dist/cjs/date/utils.js +0 -48
  32. package/dist/cjs/dom/query.js +0 -38
  33. package/dist/cjs/dom/storage.js +0 -36
  34. package/dist/cjs/dom/utils.js +1 -15
  35. package/dist/cjs/form/convert.js +0 -26
  36. package/dist/cjs/form/guards.js +0 -45
  37. package/dist/cjs/form/transform.js +0 -16
  38. package/dist/cjs/guards/non-primitives.js +0 -88
  39. package/dist/cjs/guards/primitives.js +0 -70
  40. package/dist/cjs/guards/specials.js +0 -62
  41. package/dist/cjs/http-status/HttpStatus.js +0 -93
  42. package/dist/cjs/http-status/constants.js +0 -258
  43. package/dist/cjs/index.js +0 -34
  44. package/dist/cjs/number/Currency.js +0 -73
  45. package/dist/cjs/number/Unit.js +0 -128
  46. package/dist/cjs/number/basics.js +0 -67
  47. package/dist/cjs/number/constants.js +161 -182
  48. package/dist/cjs/number/convert.js +0 -55
  49. package/dist/cjs/number/fibonacci.js +0 -25
  50. package/dist/cjs/number/guards.js +0 -37
  51. package/dist/cjs/number/helpers.js +0 -26
  52. package/dist/cjs/number/percent.js +0 -20
  53. package/dist/cjs/number/prime.js +0 -13
  54. package/dist/cjs/number/range.js +0 -15
  55. package/dist/cjs/number/utilities.js +0 -52
  56. package/dist/cjs/object/basics.js +0 -12
  57. package/dist/cjs/object/convert.js +0 -64
  58. package/dist/cjs/object/objectify.js +0 -88
  59. package/dist/cjs/object/sanitize.js +0 -58
  60. package/dist/cjs/pluralize/Pluralizer.js +0 -138
  61. package/dist/cjs/pluralize/rules.js +0 -10
  62. package/dist/cjs/string/anagram.js +0 -11
  63. package/dist/cjs/string/basics.js +0 -31
  64. package/dist/cjs/string/case.js +1 -86
  65. package/dist/cjs/string/constants.js +0 -5
  66. package/dist/cjs/string/convert.js +0 -53
  67. package/dist/cjs/string/guards.js +0 -30
  68. package/dist/cjs/string/utilities.js +0 -17
  69. package/dist/cjs/utils/Paginator.js +0 -99
  70. package/dist/cjs/utils/constants.js +0 -12
  71. package/dist/cjs/utils/helpers.js +0 -15
  72. package/dist/cjs/utils/index.js +0 -114
  73. package/dist/cjs/utils/stylog.js +3 -276
  74. package/dist/cjs/verbalizer/Verbalizer.js +0 -124
  75. package/dist/cjs/verbalizer/rules.js +16 -23
  76. package/dist/dts/array/Finder.d.ts +0 -1
  77. package/dist/dts/array/basics.d.ts +0 -1
  78. package/dist/dts/array/calc.d.ts +0 -1
  79. package/dist/dts/array/helpers.d.ts +0 -1
  80. package/dist/dts/array/sort.d.ts +0 -1
  81. package/dist/dts/array/transform.d.ts +0 -1
  82. package/dist/dts/array/types.d.ts +0 -1
  83. package/dist/dts/array/utils.d.ts +0 -1
  84. package/dist/dts/colors/Color.d.ts +0 -1
  85. package/dist/dts/colors/constants.d.ts +0 -1
  86. package/dist/dts/colors/convert.d.ts +0 -1
  87. package/dist/dts/colors/css-colors.d.ts +0 -1
  88. package/dist/dts/colors/helpers.d.ts +0 -1
  89. package/dist/dts/colors/initials.d.ts +0 -1
  90. package/dist/dts/colors/random.d.ts +0 -1
  91. package/dist/dts/colors/types.d.ts +0 -1
  92. package/dist/dts/colors/utils.d.ts +0 -1
  93. package/dist/dts/constants.d.ts +0 -1
  94. package/dist/dts/date/Chronos.d.ts +0 -1
  95. package/dist/dts/date/chronos-fn.d.ts +0 -1
  96. package/dist/dts/date/constants.d.ts +0 -1
  97. package/dist/dts/date/greet.d.ts +0 -1
  98. package/dist/dts/date/guards.d.ts +0 -1
  99. package/dist/dts/date/plugins/businessPlugin.d.ts +0 -1
  100. package/dist/dts/date/plugins/dayPartPlugin.d.ts +0 -1
  101. package/dist/dts/date/plugins/fromNowPlugin.d.ts +0 -1
  102. package/dist/dts/date/plugins/palindromePlugin.d.ts +0 -1
  103. package/dist/dts/date/plugins/relativeTimePlugin.d.ts +0 -1
  104. package/dist/dts/date/plugins/seasonPlugin.d.ts +0 -1
  105. package/dist/dts/date/plugins/timeZonePlugin.d.ts +0 -1
  106. package/dist/dts/date/plugins/zodiacPlugin.d.ts +0 -1
  107. package/dist/dts/date/seasons.d.ts +0 -1
  108. package/dist/dts/date/types.d.ts +0 -1
  109. package/dist/dts/date/utils.d.ts +0 -1
  110. package/dist/dts/dom/query.d.ts +0 -1
  111. package/dist/dts/dom/storage.d.ts +0 -1
  112. package/dist/dts/dom/utils.d.ts +0 -1
  113. package/dist/dts/form/convert.d.ts +0 -1
  114. package/dist/dts/form/guards.d.ts +0 -1
  115. package/dist/dts/form/transform.d.ts +0 -1
  116. package/dist/dts/form/types.d.ts +0 -1
  117. package/dist/dts/guards/non-primitives.d.ts +0 -1
  118. package/dist/dts/guards/primitives.d.ts +0 -1
  119. package/dist/dts/guards/specials.d.ts +0 -1
  120. package/dist/dts/http-status/HttpStatus.d.ts +0 -1
  121. package/dist/dts/http-status/constants.d.ts +0 -1
  122. package/dist/dts/http-status/types.d.ts +0 -1
  123. package/dist/dts/index.d.ts +0 -1
  124. package/dist/dts/number/Currency.d.ts +0 -1
  125. package/dist/dts/number/Unit.d.ts +0 -1
  126. package/dist/dts/number/basics.d.ts +0 -1
  127. package/dist/dts/number/constants.d.ts +0 -1
  128. package/dist/dts/number/convert.d.ts +0 -1
  129. package/dist/dts/number/fibonacci.d.ts +0 -1
  130. package/dist/dts/number/guards.d.ts +0 -1
  131. package/dist/dts/number/helpers.d.ts +0 -1
  132. package/dist/dts/number/percent.d.ts +0 -1
  133. package/dist/dts/number/prime.d.ts +0 -1
  134. package/dist/dts/number/range.d.ts +0 -1
  135. package/dist/dts/number/types.d.ts +0 -1
  136. package/dist/dts/number/utilities.d.ts +0 -1
  137. package/dist/dts/object/basics.d.ts +0 -1
  138. package/dist/dts/object/convert.d.ts +0 -1
  139. package/dist/dts/object/objectify.d.ts +0 -1
  140. package/dist/dts/object/sanitize.d.ts +0 -1
  141. package/dist/dts/object/types.d.ts +0 -1
  142. package/dist/dts/pluralize/Pluralizer.d.ts +0 -1
  143. package/dist/dts/pluralize/rules.d.ts +0 -1
  144. package/dist/dts/pluralize/types.d.ts +0 -1
  145. package/dist/dts/string/anagram.d.ts +0 -1
  146. package/dist/dts/string/basics.d.ts +0 -1
  147. package/dist/dts/string/case.d.ts +0 -1
  148. package/dist/dts/string/constants.d.ts +0 -1
  149. package/dist/dts/string/convert.d.ts +0 -1
  150. package/dist/dts/string/guards.d.ts +0 -1
  151. package/dist/dts/string/types.d.ts +0 -1
  152. package/dist/dts/string/utilities.d.ts +0 -1
  153. package/dist/dts/types/index.d.ts +0 -1
  154. package/dist/dts/utils/Paginator.d.ts +0 -1
  155. package/dist/dts/utils/constants.d.ts +0 -1
  156. package/dist/dts/utils/helpers.d.ts +0 -1
  157. package/dist/dts/utils/index.d.ts +0 -1
  158. package/dist/dts/utils/stylog.d.ts +0 -1
  159. package/dist/dts/utils/types.d.ts +0 -1
  160. package/dist/dts/verbalizer/Verbalizer.d.ts +5 -2
  161. package/dist/dts/verbalizer/rules.d.ts +0 -1
  162. package/dist/dts/verbalizer/types.d.ts +0 -1
  163. package/dist/esm/array/Finder.js +0 -75
  164. package/dist/esm/array/basics.js +0 -35
  165. package/dist/esm/array/calc.js +0 -63
  166. package/dist/esm/array/helpers.js +0 -15
  167. package/dist/esm/array/sort.js +0 -16
  168. package/dist/esm/array/transform.js +0 -73
  169. package/dist/esm/array/utils.js +0 -19
  170. package/dist/esm/colors/Color.js +0 -199
  171. package/dist/esm/colors/constants.js +2 -4
  172. package/dist/esm/colors/convert.js +0 -114
  173. package/dist/esm/colors/css-colors.js +1 -2
  174. package/dist/esm/colors/helpers.js +0 -73
  175. package/dist/esm/colors/initials.js +0 -17
  176. package/dist/esm/colors/random.js +0 -17
  177. package/dist/esm/colors/utils.js +0 -18
  178. package/dist/esm/date/Chronos.js +11 -595
  179. package/dist/esm/date/chronos-fn.js +0 -112
  180. package/dist/esm/date/constants.js +20 -180
  181. package/dist/esm/date/greet.js +0 -6
  182. package/dist/esm/date/guards.js +0 -29
  183. package/dist/esm/date/plugins/businessPlugin.js +0 -3
  184. package/dist/esm/date/plugins/dayPartPlugin.js +0 -2
  185. package/dist/esm/date/plugins/fromNowPlugin.js +0 -2
  186. package/dist/esm/date/plugins/palindromePlugin.js +0 -1
  187. package/dist/esm/date/plugins/relativeTimePlugin.js +0 -3
  188. package/dist/esm/date/plugins/seasonPlugin.js +0 -2
  189. package/dist/esm/date/plugins/timeZonePlugin.js +0 -1
  190. package/dist/esm/date/plugins/zodiacPlugin.js +0 -1
  191. package/dist/esm/date/seasons.js +25 -36
  192. package/dist/esm/date/utils.js +0 -48
  193. package/dist/esm/dom/query.js +0 -38
  194. package/dist/esm/dom/storage.js +0 -36
  195. package/dist/esm/dom/utils.js +1 -15
  196. package/dist/esm/form/convert.js +0 -26
  197. package/dist/esm/form/guards.js +0 -45
  198. package/dist/esm/form/transform.js +0 -16
  199. package/dist/esm/guards/non-primitives.js +0 -88
  200. package/dist/esm/guards/primitives.js +0 -70
  201. package/dist/esm/guards/specials.js +0 -62
  202. package/dist/esm/http-status/HttpStatus.js +0 -93
  203. package/dist/esm/http-status/constants.js +2 -260
  204. package/dist/esm/index.js +0 -34
  205. package/dist/esm/number/Currency.js +0 -73
  206. package/dist/esm/number/Unit.js +0 -128
  207. package/dist/esm/number/basics.js +0 -67
  208. package/dist/esm/number/constants.js +173 -194
  209. package/dist/esm/number/convert.js +0 -55
  210. package/dist/esm/number/fibonacci.js +0 -25
  211. package/dist/esm/number/guards.js +0 -37
  212. package/dist/esm/number/helpers.js +0 -26
  213. package/dist/esm/number/percent.js +0 -20
  214. package/dist/esm/number/prime.js +0 -13
  215. package/dist/esm/number/range.js +0 -15
  216. package/dist/esm/number/utilities.js +0 -52
  217. package/dist/esm/object/basics.js +0 -12
  218. package/dist/esm/object/convert.js +0 -64
  219. package/dist/esm/object/objectify.js +0 -88
  220. package/dist/esm/object/sanitize.js +0 -58
  221. package/dist/esm/pluralize/Pluralizer.js +0 -138
  222. package/dist/esm/pluralize/rules.js +4 -14
  223. package/dist/esm/string/anagram.js +0 -11
  224. package/dist/esm/string/basics.js +0 -31
  225. package/dist/esm/string/case.js +1 -86
  226. package/dist/esm/string/constants.js +1 -6
  227. package/dist/esm/string/convert.js +0 -53
  228. package/dist/esm/string/guards.js +0 -30
  229. package/dist/esm/string/utilities.js +0 -17
  230. package/dist/esm/utils/Paginator.js +0 -99
  231. package/dist/esm/utils/constants.js +4 -16
  232. package/dist/esm/utils/helpers.js +0 -15
  233. package/dist/esm/utils/index.js +0 -114
  234. package/dist/esm/utils/stylog.js +3 -276
  235. package/dist/esm/verbalizer/Verbalizer.js +0 -124
  236. package/dist/esm/verbalizer/rules.js +18 -25
  237. package/package.json +1 -1
  238. package/dist/dts/array/Finder.d.ts.map +0 -1
  239. package/dist/dts/array/basics.d.ts.map +0 -1
  240. package/dist/dts/array/calc.d.ts.map +0 -1
  241. package/dist/dts/array/helpers.d.ts.map +0 -1
  242. package/dist/dts/array/sort.d.ts.map +0 -1
  243. package/dist/dts/array/transform.d.ts.map +0 -1
  244. package/dist/dts/array/types.d.ts.map +0 -1
  245. package/dist/dts/array/utils.d.ts.map +0 -1
  246. package/dist/dts/colors/Color.d.ts.map +0 -1
  247. package/dist/dts/colors/constants.d.ts.map +0 -1
  248. package/dist/dts/colors/convert.d.ts.map +0 -1
  249. package/dist/dts/colors/css-colors.d.ts.map +0 -1
  250. package/dist/dts/colors/helpers.d.ts.map +0 -1
  251. package/dist/dts/colors/initials.d.ts.map +0 -1
  252. package/dist/dts/colors/random.d.ts.map +0 -1
  253. package/dist/dts/colors/types.d.ts.map +0 -1
  254. package/dist/dts/colors/utils.d.ts.map +0 -1
  255. package/dist/dts/constants.d.ts.map +0 -1
  256. package/dist/dts/date/Chronos.d.ts.map +0 -1
  257. package/dist/dts/date/chronos-fn.d.ts.map +0 -1
  258. package/dist/dts/date/constants.d.ts.map +0 -1
  259. package/dist/dts/date/greet.d.ts.map +0 -1
  260. package/dist/dts/date/guards.d.ts.map +0 -1
  261. package/dist/dts/date/plugins/businessPlugin.d.ts.map +0 -1
  262. package/dist/dts/date/plugins/dayPartPlugin.d.ts.map +0 -1
  263. package/dist/dts/date/plugins/fromNowPlugin.d.ts.map +0 -1
  264. package/dist/dts/date/plugins/palindromePlugin.d.ts.map +0 -1
  265. package/dist/dts/date/plugins/relativeTimePlugin.d.ts.map +0 -1
  266. package/dist/dts/date/plugins/seasonPlugin.d.ts.map +0 -1
  267. package/dist/dts/date/plugins/timeZonePlugin.d.ts.map +0 -1
  268. package/dist/dts/date/plugins/zodiacPlugin.d.ts.map +0 -1
  269. package/dist/dts/date/seasons.d.ts.map +0 -1
  270. package/dist/dts/date/types.d.ts.map +0 -1
  271. package/dist/dts/date/utils.d.ts.map +0 -1
  272. package/dist/dts/dom/query.d.ts.map +0 -1
  273. package/dist/dts/dom/storage.d.ts.map +0 -1
  274. package/dist/dts/dom/utils.d.ts.map +0 -1
  275. package/dist/dts/form/convert.d.ts.map +0 -1
  276. package/dist/dts/form/guards.d.ts.map +0 -1
  277. package/dist/dts/form/transform.d.ts.map +0 -1
  278. package/dist/dts/form/types.d.ts.map +0 -1
  279. package/dist/dts/guards/non-primitives.d.ts.map +0 -1
  280. package/dist/dts/guards/primitives.d.ts.map +0 -1
  281. package/dist/dts/guards/specials.d.ts.map +0 -1
  282. package/dist/dts/http-status/HttpStatus.d.ts.map +0 -1
  283. package/dist/dts/http-status/constants.d.ts.map +0 -1
  284. package/dist/dts/http-status/types.d.ts.map +0 -1
  285. package/dist/dts/index.d.ts.map +0 -1
  286. package/dist/dts/number/Currency.d.ts.map +0 -1
  287. package/dist/dts/number/Unit.d.ts.map +0 -1
  288. package/dist/dts/number/basics.d.ts.map +0 -1
  289. package/dist/dts/number/constants.d.ts.map +0 -1
  290. package/dist/dts/number/convert.d.ts.map +0 -1
  291. package/dist/dts/number/fibonacci.d.ts.map +0 -1
  292. package/dist/dts/number/guards.d.ts.map +0 -1
  293. package/dist/dts/number/helpers.d.ts.map +0 -1
  294. package/dist/dts/number/percent.d.ts.map +0 -1
  295. package/dist/dts/number/prime.d.ts.map +0 -1
  296. package/dist/dts/number/range.d.ts.map +0 -1
  297. package/dist/dts/number/types.d.ts.map +0 -1
  298. package/dist/dts/number/utilities.d.ts.map +0 -1
  299. package/dist/dts/object/basics.d.ts.map +0 -1
  300. package/dist/dts/object/convert.d.ts.map +0 -1
  301. package/dist/dts/object/objectify.d.ts.map +0 -1
  302. package/dist/dts/object/sanitize.d.ts.map +0 -1
  303. package/dist/dts/object/types.d.ts.map +0 -1
  304. package/dist/dts/pluralize/Pluralizer.d.ts.map +0 -1
  305. package/dist/dts/pluralize/rules.d.ts.map +0 -1
  306. package/dist/dts/pluralize/types.d.ts.map +0 -1
  307. package/dist/dts/string/anagram.d.ts.map +0 -1
  308. package/dist/dts/string/basics.d.ts.map +0 -1
  309. package/dist/dts/string/case.d.ts.map +0 -1
  310. package/dist/dts/string/constants.d.ts.map +0 -1
  311. package/dist/dts/string/convert.d.ts.map +0 -1
  312. package/dist/dts/string/guards.d.ts.map +0 -1
  313. package/dist/dts/string/types.d.ts.map +0 -1
  314. package/dist/dts/string/utilities.d.ts.map +0 -1
  315. package/dist/dts/types/index.d.ts.map +0 -1
  316. package/dist/dts/utils/Paginator.d.ts.map +0 -1
  317. package/dist/dts/utils/constants.d.ts.map +0 -1
  318. package/dist/dts/utils/helpers.d.ts.map +0 -1
  319. package/dist/dts/utils/index.d.ts.map +0 -1
  320. package/dist/dts/utils/stylog.d.ts.map +0 -1
  321. package/dist/dts/utils/types.d.ts.map +0 -1
  322. package/dist/dts/verbalizer/Verbalizer.d.ts.map +0 -1
  323. package/dist/dts/verbalizer/rules.d.ts.map +0 -1
  324. package/dist/dts/verbalizer/types.d.ts.map +0 -1
package/CHANGELOG.md CHANGED
@@ -6,6 +6,11 @@ All notable changes to the package will be documented here.
6
6
 
7
7
  ---
8
8
 
9
+ ## [4.20.30] - 2025-09-17
10
+
11
+ - **Reduced** _unpacked size_ by **removing** _tsdoc comments_ from js (both `cjs` and `esm`) outputs.
12
+ - **Updated** tsdoc for `Verbalizer/verbalizer`: **added** reference to documentation site.
13
+
9
14
  ## [4.20.27] - 2025-09-16
10
15
 
11
16
  - **Fixed** _issues_: (**failed to convert already past/participle regular verbs**) with `toPast()` and `toParticiple()` methods in `Verbalizer/verbalizer`.
@@ -1,30 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Finder = void 0;
4
- /**
5
- * The `Finder` class performs optimized searching on arrays.
6
- * It supports binary search, fuzzy search, and smart caching with TTL.
7
- */
8
4
  class Finder {
9
5
  static #DEFAULT_TTL = 1000 * 60 * 5;
10
6
  #cachedResult = new Map();
11
7
  #sortedCache = new Map();
12
8
  #ttl;
13
9
  #items;
14
- /**
15
- * * Creates a new `Finder` instance.
16
- *
17
- * @param data The initial array of items or a callback returning them.
18
- * @param ttl Time-to-live (in milliseconds) for cached search results. Defaults to {@link Finder.#DEFAULT_TTL 5 Minutes}.
19
- */
20
10
  constructor(data, ttl = Finder.#DEFAULT_TTL) {
21
11
  this.#ttl = ttl;
22
12
  this.#items = typeof data === 'function' ? data() : data;
23
13
  }
24
- /**
25
- * @instance Clears cache globally or for a specific key.
26
- * @param key Optional key to clear only a specific cache entry.
27
- */
28
14
  clearCache(key) {
29
15
  if (key) {
30
16
  this.#cachedResult.delete(key);
@@ -33,12 +19,6 @@ class Finder {
33
19
  this.#cachedResult.clear();
34
20
  }
35
21
  }
36
- /**
37
- * @instance Finds all items that match the provided matcher using optional caching or fuzzy logic.
38
- * @param matcher The value to match against.
39
- * @param keySelector Property key or selector function.
40
- * @param options Optional settings for search behavior and source list.
41
- */
42
22
  findAll(matcher, keySelector, options) {
43
23
  const { fuzzy = false, needSorting = true, cacheKey = 'finder-cache', forceBinary = false, caseInsensitive = true, data, } = options ?? {};
44
24
  const source = typeof data === 'function' ? data() : (data ?? this.#items);
@@ -96,12 +76,6 @@ class Finder {
96
76
  }
97
77
  return results;
98
78
  }
99
- /**
100
- * @instance Finds first matching item that matches the provided matcher using optional caching or fuzzy logic.
101
- * @param matcher The value to match.
102
- * @param keySelector Property key or selector function.
103
- * @param options Optional behavior flags and item source.
104
- */
105
79
  findOne(matcher, keySelector, options) {
106
80
  const { fuzzy = false, needSorting = true, cacheKey = 'finder-cache', forceBinary = false, caseInsensitive = true, data, } = options ?? {};
107
81
  const source = typeof data === 'function' ? data() : (data ?? this.#items);
@@ -141,37 +115,14 @@ class Finder {
141
115
  }
142
116
  return result;
143
117
  }
144
- /**
145
- * @instance Asynchronous variant of `findAll` that accepts a promise-based data supplier.
146
- * @param supplier Async function resolving the items list.
147
- * @param matcher The value to match.
148
- * @param keySelector Property key or selector function.
149
- * @param options Optional settings for search behavior and cache.
150
- */
151
118
  async findAllAsync(supplier, matcher, keySelector, options) {
152
119
  const items = await supplier();
153
120
  return this.findAll(matcher, keySelector, { ...options, data: items });
154
121
  }
155
- /**
156
- * @instance Asynchronous variant of `findOne`.
157
- * @param supplier Async function resolving the items list.
158
- * @param matcher The value to match.
159
- * @param keySelector Property key or selector function.
160
- * @param options Optional settings for behavior and cache.
161
- */
162
122
  async findOneAsync(supplier, matcher, keySelector, options) {
163
123
  const items = await supplier();
164
124
  return this.findOne(matcher, keySelector, { ...options, data: items });
165
125
  }
166
- /**
167
- * @instance Performs a binary search on a sorted array using a custom key selector.
168
- *
169
- * @param sorted - The sorted array of items to search.
170
- * @param matcher - The value to search for.
171
- * @param keySelector - A function that extracts the comparable key from each item.
172
- * @param caseInsensitive - Whether to compare string keys ignoring case.
173
- * @returns The first matching item if found; otherwise, undefined.
174
- */
175
126
  binarySearch(sorted, matcher, keySelector, caseInsensitive) {
176
127
  let min = 0, max = sorted?.length - 1;
177
128
  while (min <= max) {
@@ -187,15 +138,6 @@ class Finder {
187
138
  }
188
139
  return undefined;
189
140
  }
190
- /**
191
- * @instance Performs a fuzzy search on an array by matching characters in sequence.
192
- *
193
- * @param array - The array of items to search.
194
- * @param matcher - The fuzzy search string to match against.
195
- * @param keySelector - A function that extracts the key to search from each item.
196
- * @param caseInsensitive - Whether to compare ignoring case for string values.
197
- * @returns The first fuzzy-matching item if found; otherwise, undefined.
198
- */
199
141
  fuzzySearch(array, matcher, keySelector, caseInsensitive) {
200
142
  for (const item of array) {
201
143
  const rawKey = keySelector(item);
@@ -207,12 +149,6 @@ class Finder {
207
149
  }
208
150
  return undefined;
209
151
  }
210
- /**
211
- * @private Checks if the characters in the target string appear in order within the source string.
212
- * @param source Source string to search within.
213
- * @param target Target string to match against the source string.
214
- * @returns True if the target string is a fuzzy match within the source string; otherwise, false.
215
- */
216
152
  #match(source, target) {
217
153
  let i = 0;
218
154
  for (const char of target) {
@@ -223,13 +159,6 @@ class Finder {
223
159
  }
224
160
  return true;
225
161
  }
226
- /**
227
- * @private Sorts an array and caches the result for a specified time-to-live (TTL).
228
- * @param data Data to sort and cache.
229
- * @param getKey Key extraction function.
230
- * @param cacheKey Optional cache key for storing the result.
231
- * @returns
232
- */
233
162
  #sortAndCache(data, getKey, cacheKey) {
234
163
  if (cacheKey) {
235
164
  const entry = this.#sortedCache.get(cacheKey);
@@ -255,10 +184,6 @@ class Finder {
255
184
  }
256
185
  return sorted;
257
186
  }
258
- /**
259
- * @static @private Creates a memoized version of a key extractor.
260
- * @param getKey Original key extraction function
261
- */
262
187
  static #createMemoizedKeyGetter(getKey) {
263
188
  const cache = new Map();
264
189
  return (item) => {
@@ -1,31 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getLastArrayElement = exports.shuffleArray = exports.isInvalidOrEmptyArray = exports.filterArrayOfObjects = exports.flattenArray = void 0;
4
- /**
5
- * * Flattens a nested array recursively or wraps any non-array data type in an array.
6
- *
7
- * @param input - The input value, which can be a nested array or a non-array value.
8
- * @returns A fully flattened array of type `Flatten<T>`. If the input is not an array, it wraps it in a single-element array.
9
- */
10
4
  const flattenArray = (input) => {
11
5
  if (!Array.isArray(input))
12
6
  return [input];
13
7
  return input.reduce((acc, item) => {
14
- // If item is an array, recursively flatten it; otherwise, add it directly.
15
8
  return acc.concat(Array.isArray(item) ? (0, exports.flattenArray)(item) : [item]);
16
9
  }, []);
17
10
  };
18
11
  exports.flattenArray = flattenArray;
19
- /**
20
- * @deprecated _Please, use `findAll` instance method from `Finder` class for **more advanced filtering and searching.**_
21
- *
22
- * * Filters an array of objects based on multiple conditions for specified keys.
23
- * @param array - The array of objects to filter.
24
- * @param conditions - An object where keys represent the property names and values represent filter conditions.
25
- * The conditions can be a function `(value: T[K]) => boolean`.
26
- * @returns The filtered array of objects.
27
- * @throws `Error` If the input is not a valid array.
28
- */
29
12
  const filterArrayOfObjects = (array, conditions) => {
30
13
  if (!Array.isArray(array)) {
31
14
  throw new Error('The provided input is not a valid array!');
@@ -38,12 +21,6 @@ const filterArrayOfObjects = (array, conditions) => {
38
21
  }));
39
22
  };
40
23
  exports.filterArrayOfObjects = filterArrayOfObjects;
41
- /**
42
- * * Checks if a value is an empty array or an array with only empty values.
43
- *
44
- * @param value - The value to check.
45
- * @returns `true` if the value is not an array, an empty array, or an array containing only `null`, `undefined`, empty objects, or empty arrays.
46
- */
47
24
  const isInvalidOrEmptyArray = (value) => {
48
25
  if (!Array.isArray(value))
49
26
  return true;
@@ -54,12 +31,6 @@ const isInvalidOrEmptyArray = (value) => {
54
31
  (typeof item === 'object' && Object.keys(item || {})?.length === 0));
55
32
  };
56
33
  exports.isInvalidOrEmptyArray = isInvalidOrEmptyArray;
57
- /**
58
- * * Shuffle the elements of an array.
59
- *
60
- * @param array Array to shuffle.
61
- * @returns Shuffled array.
62
- */
63
34
  const shuffleArray = (array) => {
64
35
  if ((0, exports.isInvalidOrEmptyArray)(array))
65
36
  return array;
@@ -71,12 +42,6 @@ const shuffleArray = (array) => {
71
42
  return shuffled;
72
43
  };
73
44
  exports.shuffleArray = shuffleArray;
74
- /**
75
- * * Get the last element of an array.
76
- *
77
- * @param array Array to get the last element from.
78
- * @returns The last element or `undefined` if the array is empty.
79
- */
80
45
  const getLastArrayElement = (array) => {
81
46
  return array?.length > 0 ? array[array?.length - 1] : undefined;
82
47
  };
@@ -9,19 +9,6 @@ const non_primitives_1 = require("../guards/non-primitives");
9
9
  const basics_1 = require("../number/basics");
10
10
  const helpers_1 = require("./helpers");
11
11
  const transform_1 = require("./transform");
12
- /**
13
- * * Calculates the sum of differences between two numeric fields for each item in the array.
14
- *
15
- * @param data - The array of objects to process.
16
- * @param first - The field name to subtract **from** (minuend), supports nested dot notation.
17
- * @param second - The field name to subtract (subtrahend), supports nested dot notation.
18
- * @param roundTo - Decimal places to round the result to. Defaults to 2.
19
- * @returns The total sum of differences between the two fields across all items.
20
- *
21
- * @example
22
- * sumFieldDifference([{ buy: 10, sell: 3 }, { buy: 8, sell: 5 }], 'buy', 'sell');
23
- * // => 10
24
- */
25
12
  function sumFieldDifference(data, first, second, roundTo = 2) {
26
13
  if (!(0, non_primitives_1.isValidArray)(data))
27
14
  return 0;
@@ -30,55 +17,18 @@ function sumFieldDifference(data, first, second, roundTo = 2) {
30
17
  }, 0);
31
18
  return (0, basics_1.roundNumber)(total, roundTo);
32
19
  }
33
- /**
34
- * * Calculates the total sum of a numeric field across all items.
35
- *
36
- * @param data - The array of objects to process.
37
- * @param field - The field to sum values from. Supports nested dot notation.
38
- * @param roundTo - Decimal places to round the result to. Defaults to 2.
39
- * @returns The rounded total sum.
40
- *
41
- * @example
42
- * sumByField([{ a: 5 }, { a: 3 }], 'a');
43
- * // => 8
44
- */
45
20
  function sumByField(data, field, roundTo = 2) {
46
21
  if (!(0, non_primitives_1.isValidArray)(data))
47
22
  return 0;
48
23
  const total = data?.reduce((acc, item) => acc + (0, helpers_1._getNumericProp)(item, field), 0);
49
24
  return (0, basics_1.roundNumber)(total, roundTo);
50
25
  }
51
- /**
52
- * * Calculates the average of a numeric field across all items.
53
- *
54
- * @param data - The array of objects to process.
55
- * @param field - The field to calculate the average from. Supports nested dot notation.
56
- * @param roundTo - Decimal places to round the result to. Defaults to 2.
57
- * @returns The rounded average.
58
- *
59
- * @example
60
- * averageByField([{ a: 4 }, { a: 6 }], 'a');
61
- * // => 5
62
- */
63
26
  function averageByField(data, field, roundTo = 2) {
64
27
  if (!(0, non_primitives_1.isValidArray)(data))
65
28
  return 0;
66
29
  const total = data?.reduce((acc, item) => acc + (0, helpers_1._getNumericProp)(item, field), 0);
67
30
  return (0, basics_1.roundNumber)(total / data.length, roundTo);
68
31
  }
69
- /**
70
- * * Groups an array of objects by a primitive field and sums another numeric field per group.
71
- *
72
- * @param data - The array of objects to group.
73
- * @param groupBy - The field to group by. Supports nested dot notation.
74
- * @param sumBy - The numeric field to sum within each group. Supports nested dot notation.
75
- * @param roundTo - Decimal places to round each group’s result to. Defaults to 2.
76
- * @returns An array of records, each with the group key and its corresponding summed value.
77
- *
78
- * @example
79
- * groupAndSumByField([{ type: 'A', val: 2 }, { type: 'A', val: 3 }, { type: 'B', val: 1 }], 'type', 'val');
80
- * // => [{ A: 5 }, { B: 1 }]
81
- */
82
32
  function groupAndSumByField(data, groupBy, sumBy, roundTo = 2) {
83
33
  if (!(0, non_primitives_1.isValidArray)(data))
84
34
  return [];
@@ -88,19 +38,6 @@ function groupAndSumByField(data, groupBy, sumBy, roundTo = 2) {
88
38
  }));
89
39
  return result;
90
40
  }
91
- /**
92
- * * Groups an array of objects by a primitive field and averages another numeric field per group.
93
- *
94
- * @param data - The array of objects to group.
95
- * @param groupBy - The field to group by. Supports nested dot notation.
96
- * @param averageBy - The numeric field to average within each group. Supports nested dot notation.
97
- * @param roundTo - Decimal places to round each group’s average to. Defaults to 2.
98
- * @returns An array of records, each with the group key and its corresponding average value.
99
- *
100
- * @example
101
- * groupAndAverageByField([{ type: 'A', val: 2 }, { type: 'A', val: 4 }, { type: 'B', val: 6 }], 'type', 'val');
102
- * // => [{ A: 3 }, { B: 6 }]
103
- */
104
41
  function groupAndAverageByField(data, groupBy, averageBy, roundTo = 2) {
105
42
  if (!(0, non_primitives_1.isValidArray)(data))
106
43
  return [];
@@ -4,13 +4,6 @@ exports._resolveNestedKey = _resolveNestedKey;
4
4
  exports._getNumericProp = _getNumericProp;
5
5
  const non_primitives_1 = require("../guards/non-primitives");
6
6
  const utilities_1 = require("../number/utilities");
7
- /**
8
- * Safely resolves nested keys from a dot-separated string like "user.city".
9
- *
10
- * @param obj - The source object
11
- * @param path - The nested path string (e.g. "user.city")
12
- * @returns The resolved value or `undefined`
13
- */
14
7
  function _resolveNestedKey(obj, path) {
15
8
  if ((0, non_primitives_1.isNotEmptyObject)(obj)) {
16
9
  return path?.split('.').reduce((acc, key) => {
@@ -20,14 +13,6 @@ function _resolveNestedKey(obj, path) {
20
13
  }, obj);
21
14
  }
22
15
  }
23
- /**
24
- * Retrieves a numeric value from a nested property in dot notation.
25
- * Falls back to 0 if value is not a number or numeric string.
26
- *
27
- * @param obj - The source object to read from.
28
- * @param path - The path string like 'user.income.tax'.
29
- * @returns The numeric value at that path, or 0 if not valid.
30
- */
31
16
  function _getNumericProp(obj, path) {
32
17
  if ((0, non_primitives_1.isNotEmptyObject)(obj)) {
33
18
  const value = path?.split('.').reduce((acc, key) => {
@@ -4,34 +4,18 @@ exports.sortAnArray = sortAnArray;
4
4
  const non_primitives_1 = require("../guards/non-primitives");
5
5
  const primitives_1 = require("../guards/primitives");
6
6
  const utils_1 = require("./utils");
7
- /**
8
- * * Sorts an array of strings, numbers, booleans, or objects based on the provided options.
9
- *
10
- * - If the array contains strings, it sorts them alphabetically.
11
- * - If the array contains numbers, it sorts them numerically.
12
- * - If the array contains booleans, it sorts them by their boolean value.
13
- * - If the array contains objects, it sorts them by the specified field in the options `sortByField`.
14
- *
15
- * @param array - The array to sort.
16
- * @param options - Sorting options for objects.
17
- * @returns The sorted array.
18
- */
19
7
  function sortAnArray(array, options) {
20
8
  if (!(0, non_primitives_1.isValidArray)(array))
21
9
  return array;
22
- // Check if the array contains strings
23
10
  if ((0, non_primitives_1.isArrayOfType)(array, primitives_1.isString)) {
24
11
  return [...array].sort((a, b) => options?.sortOrder === 'desc' ? (0, utils_1.naturalSort)(b, a) : (0, utils_1.naturalSort)(a, b));
25
12
  }
26
- // Check if the array contains numbers
27
13
  if ((0, non_primitives_1.isArrayOfType)(array, primitives_1.isNumber)) {
28
14
  return [...array].sort((a, b) => (options?.sortOrder === 'desc' ? b - a : a - b));
29
15
  }
30
- // Check if the array contains booleans
31
16
  if ((0, non_primitives_1.isArrayOfType)(array, primitives_1.isBoolean)) {
32
17
  return [...array].sort((a, b) => options?.sortOrder === 'desc' ? Number(b) - Number(a) : Number(a) - Number(b));
33
18
  }
34
- // Handle array of objects
35
19
  if ((0, non_primitives_1.isArrayOfType)(array, non_primitives_1.isObject) && options && 'sortByField' in options) {
36
20
  return [...array].sort((a, b) => {
37
21
  const _getKeyValue = (obj, path) => {
@@ -12,13 +12,6 @@ const non_primitives_1 = require("../guards/non-primitives");
12
12
  const primitives_1 = require("../guards/primitives");
13
13
  const index_1 = require("../utils/index");
14
14
  const helpers_1 = require("./helpers");
15
- /**
16
- * * Converts an array of objects into a formatted array of options.
17
- *
18
- * @param data - An array of objects to convert into options.
19
- * @param config - The configuration object to specify the keys for the `value` (firstFieldName) and `label` (secondFieldName) fields and rename as needed.
20
- * @returns An array of options, where each option has `value` and `label` fields as default or as specified by user in the config options.
21
- */
22
15
  function createOptionsArray(data, config) {
23
16
  const { firstFieldKey, secondFieldKey, firstFieldName = 'value', secondFieldName = 'label', retainNumberValue = false, } = config || {};
24
17
  if (data && data?.length) {
@@ -36,21 +29,9 @@ function createOptionsArray(data, config) {
36
29
  return [];
37
30
  }
38
31
  }
39
- /**
40
- * * Removes duplicate values from an array, supporting deep comparison for objects and arrays.
41
- *
42
- * @param array - The array from which duplicates need to be removed.
43
- * @returns A new array with duplicates removed.
44
- */
45
32
  function removeDuplicatesFromArray(array) {
46
33
  return array?.filter((item, index, self) => index === self?.findIndex((el) => (0, index_1.isDeepEqual)(el, item)));
47
34
  }
48
- /**
49
- * * Finds duplicate values in an array, runs deep comparison for objects and arrays.
50
- *
51
- * @param array - The array in which to find duplicates.
52
- * @returns An array containing all duplicate entries (each one only once).
53
- */
54
35
  function getDuplicates(array) {
55
36
  const seen = [];
56
37
  const duplicates = [];
@@ -66,34 +47,11 @@ function getDuplicates(array) {
66
47
  }
67
48
  return duplicates;
68
49
  }
69
- /**
70
- * * Finds elements missing from one array compared to another using deep comparison.
71
- *
72
- * @param options - Configuration to specify which array to compare and direction of check.
73
- * @returns An array of missing elements based on the comparison direction.
74
- */
75
- /**
76
- * * Finds elements missing from one array compared to another using deep comparison.
77
- *
78
- * @param array1 The first array to compare.
79
- * @param array2 The second array to compare.
80
- * @param missingFrom Which direction to compare for missing values:.
81
- * - `'from-first'` → values in `array1` missing in `array2`.
82
- * - `'from-second'` → values in `array2` missing in `array1`.
83
- * @returns An array of missing elements based on the comparison direction.
84
- */
85
50
  function findMissingElements(array1, array2, missingFrom) {
86
51
  const source = (missingFrom === 'from-first' ? array1 : array2) ?? [];
87
52
  const target = (missingFrom === 'from-first' ? array2 : array1) ?? [];
88
53
  return source.filter((s) => !target?.some((t) => (0, index_1.isDeepEqual)(t, s)));
89
54
  }
90
- /**
91
- * * Splits an array into chunks of a given size.
92
- *
93
- * @param arr The array to split.
94
- * @param chunkSize The size of each chunk.
95
- * @returns An array of chunked arrays.
96
- */
97
55
  function splitArray(arr, chunkSize) {
98
56
  const result = [];
99
57
  for (let i = 0; i < arr?.length; i += chunkSize) {
@@ -101,22 +59,6 @@ function splitArray(arr, chunkSize) {
101
59
  }
102
60
  return result;
103
61
  }
104
- /**
105
- * * Group an array of objects by a specified key, returning only arrays of grouped objects.
106
- *
107
- * @param source - The source array of objects to group.
108
- * @param property - The property to group the array by. Property can be a string, number, boolean, undefined or null. Supports nested dot notation.
109
- *
110
- * @returns An array of grouped arrays. Each sub-array contains objects that share the same value for the specified property.
111
- *
112
- * @example
113
- * splitArrayByProperty([{ type: 'a' }, { type: 'b' }, { type: 'a' }, { type: undefined }], 'type')
114
- * // => [ [{ type: 'a' }, { type: 'a' }], [{ type: 'b' }], [{ type: undefined }] ]
115
- *
116
- * @notes
117
- * - Returns an empty array if the input is invalid or empty.
118
- * - Groups objects even when the group key is `undefined` or `null` (object with `null` & `undefined` property-values are grouped together).
119
- */
120
62
  function splitArrayByProperty(source, property) {
121
63
  if (!(0, non_primitives_1.isValidArray)(source))
122
64
  return [];
@@ -131,13 +73,6 @@ function splitArrayByProperty(source, property) {
131
73
  });
132
74
  return Object.values(grouped);
133
75
  }
134
- /**
135
- * * Rotates an array left or right by a given number of steps.
136
- *
137
- * @param arr The array to rotate.
138
- * @param steps The number of positions to rotate (positive: right, negative: left).
139
- * @returns The rotated array.
140
- */
141
76
  function rotateArray(arr, steps) {
142
77
  const length = arr?.length;
143
78
  if (length === 0)
@@ -145,14 +80,6 @@ function rotateArray(arr, steps) {
145
80
  const offset = ((steps % length) + length) % length;
146
81
  return arr.slice(-offset).concat(arr.slice(0, -offset));
147
82
  }
148
- /**
149
- * * Moves an element within an array from one index to another.
150
- *
151
- * @param arr The array to modify.
152
- * @param fromIndex The index of the element to move.
153
- * @param toIndex The new index for the element.
154
- * @returns A new array with the element moved.
155
- */
156
83
  function moveArrayElement(arr, fromIndex, toIndex) {
157
84
  const newArr = [...arr];
158
85
  const [item] = newArr.splice(fromIndex, 1);
@@ -1,24 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.naturalSort = naturalSort;
4
- /**
5
- * * Compare two strings using natural sorting (e.g., "file2" < "file10").
6
- * Optionally supports case-insensitive and locale-aware string chunk comparisons.
7
- *
8
- * @param a - The first string to compare.
9
- * @param b - The second string to compare.
10
- * @param options - Optional settings to configure comparison behavior.
11
- * @param options.caseInsensitive - If true, compares string chunks without case sensitivity. Defaults to `true`.
12
- * @param options.localeAware - If true, uses localeCompare for string chunk comparisons. Defaults to `false`.
13
- * @returns A negative number if `a` comes before `b`, a positive number if `a` comes after `b`, or 0 if equal.
14
- */
15
4
  function naturalSort(a, b, options) {
16
5
  const { caseInsensitive = true, localeAware = false } = options || {};
17
- /**
18
- * * Splits a string into an array of number and non-number chunks.
19
- * @param str - The string to split.
20
- * @returns An array of string and number parts.
21
- */
22
6
  const _createChunks = (str) => {
23
7
  const chunks = [];
24
8
  let current = '';
@@ -49,16 +33,13 @@ function naturalSort(a, b, options) {
49
33
  for (let i = 0; i < Math.min(aChunks?.length, bChunks?.length); i++) {
50
34
  let aChunk = aChunks[i];
51
35
  let bChunk = bChunks[i];
52
- // Normalize string chunks if case-insensitive
53
36
  if (caseInsensitive && typeof aChunk === 'string' && typeof bChunk === 'string') {
54
37
  aChunk = aChunk?.toLowerCase();
55
38
  bChunk = bChunk?.toLowerCase();
56
39
  }
57
- // Compare types: number vs string
58
40
  if (typeof aChunk !== typeof bChunk) {
59
41
  return typeof aChunk === 'string' ? 1 : -1;
60
42
  }
61
- // Compare same-type chunks
62
43
  if (aChunk !== bChunk) {
63
44
  if (typeof aChunk === 'number' && typeof bChunk === 'number') {
64
45
  return aChunk - bChunk;