umt 2.4.0 → 2.6.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 (276) hide show
  1. package/README.md +288 -16
  2. package/module/Array/generateNumberArray.js +13 -7
  3. package/module/Array/generateNumberArray.js.map +1 -1
  4. package/module/Array/getArraysCommon.js +21 -3
  5. package/module/Array/getArraysCommon.js.map +1 -1
  6. package/module/Array/groupBy.js +8 -7
  7. package/module/Array/groupBy.js.map +1 -1
  8. package/module/Array/index.d.ts +3 -0
  9. package/module/Array/index.js +3 -0
  10. package/module/Array/index.js.map +1 -1
  11. package/module/Array/timSort.js +2 -20
  12. package/module/Array/timSort.js.map +1 -1
  13. package/module/Array/ultraNumberSort.d.ts +7 -0
  14. package/module/Array/ultraNumberSort.js +373 -0
  15. package/module/Array/ultraNumberSort.js.map +1 -0
  16. package/module/Array/uniqBy.d.ts +7 -0
  17. package/module/Array/uniqBy.js +19 -0
  18. package/module/Array/uniqBy.js.map +1 -0
  19. package/module/Array/unique.d.ts +6 -0
  20. package/module/Array/unique.js +9 -0
  21. package/module/Array/unique.js.map +1 -0
  22. package/module/Color/rgbaToHsla.js +1 -1
  23. package/module/Color/rgbaToHsla.js.map +1 -1
  24. package/module/Date/birthday.js +14 -6
  25. package/module/Date/birthday.js.map +1 -1
  26. package/module/Date/isLeapYear.js +3 -0
  27. package/module/Date/isLeapYear.js.map +1 -1
  28. package/module/Error/index.d.ts +1 -0
  29. package/module/Error/index.js +1 -0
  30. package/module/Error/index.js.map +1 -1
  31. package/module/Error/retry.d.ts +37 -0
  32. package/module/Error/retry.js +47 -0
  33. package/module/Error/retry.js.map +1 -0
  34. package/module/IP/getIpClass.js +1 -1
  35. package/module/IP/getIpClass.js.map +1 -1
  36. package/module/IP/getNetworkAddress.js +2 -2
  37. package/module/IP/getNetworkAddress.js.map +1 -1
  38. package/module/IP/ipToBinaryString.js +2 -2
  39. package/module/IP/ipToBinaryString.js.map +1 -1
  40. package/module/IP/subnetMaskToCidr.js +1 -1
  41. package/module/IP/subnetMaskToCidr.js.map +1 -1
  42. package/module/Math/calculator/core.js +21 -13
  43. package/module/Math/calculator/core.js.map +1 -1
  44. package/module/Math/calculator/literalExpression.js +19 -7
  45. package/module/Math/calculator/literalExpression.js.map +1 -1
  46. package/module/Math/division.js +3 -3
  47. package/module/Math/division.js.map +1 -1
  48. package/module/Math/gcd.js +26 -4
  49. package/module/Math/gcd.js.map +1 -1
  50. package/module/Math/standardDeviation.js +4 -2
  51. package/module/Math/standardDeviation.js.map +1 -1
  52. package/module/Object/has.js +1 -2
  53. package/module/Object/has.js.map +1 -1
  54. package/module/Object/index.d.ts +4 -0
  55. package/module/Object/index.js +4 -0
  56. package/module/Object/index.js.map +1 -1
  57. package/module/Object/isEmpty.d.ts +6 -0
  58. package/module/Object/isEmpty.js +20 -0
  59. package/module/Object/isEmpty.js.map +1 -0
  60. package/module/Object/merge.d.ts +8 -0
  61. package/module/Object/merge.js +10 -0
  62. package/module/Object/merge.js.map +1 -0
  63. package/module/Object/mergeDeep.d.ts +8 -0
  64. package/module/Object/mergeDeep.js +37 -0
  65. package/module/Object/mergeDeep.js.map +1 -0
  66. package/module/Object/omit.d.ts +7 -0
  67. package/module/Object/omit.js +14 -0
  68. package/module/Object/omit.js.map +1 -0
  69. package/module/Object/pickDeep.d.ts +2 -2
  70. package/module/Object/pickDeep.js +4 -4
  71. package/module/Object/pickDeep.js.map +1 -1
  72. package/module/Simple/Date/dayOfWeekSimple.js +3 -3
  73. package/module/Simple/Date/dayOfWeekSimple.js.map +1 -1
  74. package/module/String/camelCase.d.ts +6 -0
  75. package/module/String/camelCase.js +12 -0
  76. package/module/String/camelCase.js.map +1 -0
  77. package/module/String/escapeHtml.d.ts +6 -0
  78. package/module/String/escapeHtml.js +19 -0
  79. package/module/String/escapeHtml.js.map +1 -0
  80. package/module/String/formatString/applyFormatter.d.ts +25 -0
  81. package/module/String/formatString/applyFormatter.js +71 -0
  82. package/module/String/formatString/applyFormatter.js.map +1 -0
  83. package/module/String/formatString/defaultFormatters.d.ts +24 -0
  84. package/module/String/formatString/defaultFormatters.js +59 -0
  85. package/module/String/formatString/defaultFormatters.js.map +1 -0
  86. package/module/String/formatString/detectMode.d.ts +26 -0
  87. package/module/String/formatString/detectMode.js +61 -0
  88. package/module/String/formatString/detectMode.js.map +1 -0
  89. package/module/String/formatString/getValue.d.ts +27 -0
  90. package/module/String/formatString/getValue.js +56 -0
  91. package/module/String/formatString/getValue.js.map +1 -0
  92. package/module/String/formatString/index.d.ts +91 -0
  93. package/module/String/formatString/index.js +38 -0
  94. package/module/String/formatString/index.js.map +1 -0
  95. package/module/String/index.d.ts +5 -0
  96. package/module/String/index.js +5 -0
  97. package/module/String/index.js.map +1 -1
  98. package/module/String/kebabCase.d.ts +6 -0
  99. package/module/String/kebabCase.js +22 -0
  100. package/module/String/kebabCase.js.map +1 -0
  101. package/module/String/levenshteinDistance.d.ts +8 -0
  102. package/module/String/levenshteinDistance.js +38 -0
  103. package/module/String/levenshteinDistance.js.map +1 -0
  104. package/module/String/stringSimilarity.d.ts +8 -0
  105. package/module/String/stringSimilarity.js +23 -0
  106. package/module/String/stringSimilarity.js.map +1 -0
  107. package/module/Tool/pipe.d.ts +1 -1
  108. package/module/Tool/pipe.js.map +1 -1
  109. package/module/Validate/core/index.js +0 -1
  110. package/module/Validate/core/index.js.map +1 -1
  111. package/module/Validate/isDouble.js +1 -1
  112. package/module/Validate/isDouble.js.map +1 -1
  113. package/module/Validate/isNode.js +1 -0
  114. package/module/Validate/isNode.js.map +1 -1
  115. package/module/Validate/isNumber.js +1 -1
  116. package/module/Validate/isNumber.js.map +1 -1
  117. package/module/Validate/isValueNaN.js +1 -1
  118. package/module/Validate/isValueNaN.js.map +1 -1
  119. package/module/Validate/number/even.js +7 -1
  120. package/module/Validate/number/even.js.map +1 -1
  121. package/module/Validate/number/odd.js +7 -1
  122. package/module/Validate/number/odd.js.map +1 -1
  123. package/module/Validate/string/email.js +20 -2
  124. package/module/Validate/string/email.js.map +1 -1
  125. package/module/es5/Array/generateNumberArray.js +15 -9
  126. package/module/es5/Array/getArraysCommon.js +39 -4
  127. package/module/es5/Array/groupBy.js +8 -7
  128. package/module/es5/Array/index.d.ts +3 -0
  129. package/module/es5/Array/index.js +33 -0
  130. package/module/es5/Array/timSort.js +2 -20
  131. package/module/es5/Array/ultraNumberSort.d.ts +7 -0
  132. package/module/es5/Array/ultraNumberSort.js +475 -0
  133. package/module/es5/Array/uniqBy.d.ts +7 -0
  134. package/module/es5/Array/uniqBy.js +36 -0
  135. package/module/es5/Array/unique.d.ts +6 -0
  136. package/module/es5/Array/unique.js +20 -0
  137. package/module/es5/Color/rgbaToHsla.js +1 -1
  138. package/module/es5/Date/birthday.js +17 -3
  139. package/module/es5/Date/isLeapYear.js +3 -0
  140. package/module/es5/Error/index.d.ts +1 -0
  141. package/module/es5/Error/index.js +11 -0
  142. package/module/es5/Error/retry.d.ts +37 -0
  143. package/module/es5/Error/retry.js +88 -0
  144. package/module/es5/IP/getIpClass.js +1 -1
  145. package/module/es5/IP/getNetworkAddress.js +2 -2
  146. package/module/es5/IP/ipToBinaryString.js +2 -2
  147. package/module/es5/IP/subnetMaskToCidr.js +1 -1
  148. package/module/es5/Math/calculator/core.js +17 -9
  149. package/module/es5/Math/calculator/literalExpression.js +19 -6
  150. package/module/es5/Math/division.js +3 -3
  151. package/module/es5/Math/gcd.js +43 -5
  152. package/module/es5/Math/standardDeviation.js +4 -2
  153. package/module/es5/Object/has.js +1 -1
  154. package/module/es5/Object/index.d.ts +4 -0
  155. package/module/es5/Object/index.js +44 -0
  156. package/module/es5/Object/isEmpty.d.ts +6 -0
  157. package/module/es5/Object/isEmpty.js +26 -0
  158. package/module/es5/Object/merge.d.ts +8 -0
  159. package/module/es5/Object/merge.js +18 -0
  160. package/module/es5/Object/mergeDeep.d.ts +8 -0
  161. package/module/es5/Object/mergeDeep.js +46 -0
  162. package/module/es5/Object/omit.d.ts +7 -0
  163. package/module/es5/Object/omit.js +29 -0
  164. package/module/es5/Object/pickDeep.d.ts +2 -2
  165. package/module/es5/Object/pickDeep.js +4 -4
  166. package/module/es5/Simple/Date/dayOfWeekSimple.js +3 -3
  167. package/module/es5/String/camelCase.d.ts +6 -0
  168. package/module/es5/String/camelCase.js +18 -0
  169. package/module/es5/String/escapeHtml.d.ts +6 -0
  170. package/module/es5/String/escapeHtml.js +27 -0
  171. package/module/es5/String/formatString/applyFormatter.d.ts +25 -0
  172. package/module/es5/String/formatString/applyFormatter.js +100 -0
  173. package/module/es5/String/formatString/defaultFormatters.d.ts +24 -0
  174. package/module/es5/String/formatString/defaultFormatters.js +79 -0
  175. package/module/es5/String/formatString/detectMode.d.ts +26 -0
  176. package/module/es5/String/formatString/detectMode.js +60 -0
  177. package/module/es5/String/formatString/getValue.d.ts +27 -0
  178. package/module/es5/String/formatString/getValue.js +85 -0
  179. package/module/es5/String/formatString/index.d.ts +91 -0
  180. package/module/es5/String/formatString/index.js +152 -0
  181. package/module/es5/String/index.d.ts +5 -0
  182. package/module/es5/String/index.js +55 -0
  183. package/module/es5/String/kebabCase.d.ts +6 -0
  184. package/module/es5/String/kebabCase.js +26 -0
  185. package/module/es5/String/levenshteinDistance.d.ts +8 -0
  186. package/module/es5/String/levenshteinDistance.js +58 -0
  187. package/module/es5/String/stringSimilarity.d.ts +8 -0
  188. package/module/es5/String/stringSimilarity.js +30 -0
  189. package/module/es5/Tool/pipe.d.ts +1 -1
  190. package/module/es5/Validate/core/index.js +0 -1
  191. package/module/es5/Validate/isDouble.js +1 -1
  192. package/module/es5/Validate/isNode.js +1 -0
  193. package/module/es5/Validate/isNumber.js +1 -1
  194. package/module/es5/Validate/isValueNaN.js +1 -1
  195. package/module/es5/Validate/number/even.js +4 -0
  196. package/module/es5/Validate/number/odd.js +4 -0
  197. package/module/es5/Validate/string/email.js +26 -1
  198. package/module/es5/tsconfig.tsbuildinfo +1 -1
  199. package/module/es5/types/index.d.ts +1 -0
  200. package/module/es5/types/index.js +11 -0
  201. package/module/es5/types/logic/deepPartial.d.ts +37 -0
  202. package/module/es5/types/logic/deepPartial.js +5 -0
  203. package/module/es5/types/logic/deepRequired.d.ts +37 -0
  204. package/module/es5/types/logic/deepRequired.js +5 -0
  205. package/module/es5/types/logic/index.d.ts +3 -0
  206. package/module/es5/types/logic/index.js +33 -0
  207. package/module/es5/types/logic/unionToIntersection.d.ts +12 -0
  208. package/module/es5/types/logic/unionToIntersection.js +5 -0
  209. package/module/es5/types/object/index.d.ts +1 -0
  210. package/module/es5/types/object/index.js +11 -0
  211. package/module/es5/types/object/pickDeep.d.ts +13 -1
  212. package/module/es5/types/object/shallowObjectValue.d.ts +9 -0
  213. package/module/es5/types/object/shallowObjectValue.js +5 -0
  214. package/module/es5/types/string/formatString/formatData.d.ts +17 -0
  215. package/module/es5/types/string/formatString/formatData.js +5 -0
  216. package/module/es5/types/string/formatString/formatOptions.d.ts +21 -0
  217. package/module/es5/types/string/formatString/formatOptions.js +5 -0
  218. package/module/es5/types/string/formatString/formatString.d.ts +4 -0
  219. package/module/es5/types/string/formatString/formatString.js +49 -0
  220. package/module/es5/types/string/formatString/formatValue.d.ts +15 -0
  221. package/module/es5/types/string/formatString/formatValue.js +5 -0
  222. package/module/es5/types/string/formatString/formatter.d.ts +13 -0
  223. package/module/es5/types/string/formatString/formatter.js +5 -0
  224. package/module/es5/types/string/formatString/index.d.ts +5 -0
  225. package/module/es5/types/string/formatString/index.js +60 -0
  226. package/module/es5/types/string/index.d.ts +1 -0
  227. package/module/es5/types/string/index.js +16 -0
  228. package/module/types/index.d.ts +1 -0
  229. package/module/types/index.js +1 -0
  230. package/module/types/index.js.map +1 -1
  231. package/module/types/logic/deepPartial.d.ts +37 -0
  232. package/module/types/logic/deepPartial.js +36 -0
  233. package/module/types/logic/deepPartial.js.map +1 -0
  234. package/module/types/logic/deepRequired.d.ts +37 -0
  235. package/module/types/logic/deepRequired.js +2 -0
  236. package/module/types/logic/deepRequired.js.map +1 -0
  237. package/module/types/logic/index.d.ts +3 -0
  238. package/module/types/logic/index.js +3 -0
  239. package/module/types/logic/index.js.map +1 -1
  240. package/module/types/logic/unionToIntersection.d.ts +12 -0
  241. package/module/types/logic/unionToIntersection.js +2 -0
  242. package/module/types/logic/unionToIntersection.js.map +1 -0
  243. package/module/types/object/index.d.ts +1 -0
  244. package/module/types/object/index.js +1 -0
  245. package/module/types/object/index.js.map +1 -1
  246. package/module/types/object/pickDeep.d.ts +13 -1
  247. package/module/types/object/shallowObjectValue.d.ts +9 -0
  248. package/module/types/object/shallowObjectValue.js +2 -0
  249. package/module/types/object/shallowObjectValue.js.map +1 -0
  250. package/module/types/string/formatString/formatData.d.ts +17 -0
  251. package/module/types/string/formatString/formatData.js +2 -0
  252. package/module/types/string/formatString/formatData.js.map +1 -0
  253. package/module/types/string/formatString/formatOptions.d.ts +21 -0
  254. package/module/types/string/formatString/formatOptions.js +2 -0
  255. package/module/types/string/formatString/formatOptions.js.map +1 -0
  256. package/module/types/string/formatString/formatString.d.ts +4 -0
  257. package/module/types/string/formatString/formatString.js +5 -0
  258. package/module/types/string/formatString/formatString.js.map +1 -0
  259. package/module/types/string/formatString/formatValue.d.ts +15 -0
  260. package/module/types/string/formatString/formatValue.js +2 -0
  261. package/module/types/string/formatString/formatValue.js.map +1 -0
  262. package/module/types/string/formatString/formatter.d.ts +13 -0
  263. package/module/types/string/formatString/formatter.js +2 -0
  264. package/module/types/string/formatString/formatter.js.map +1 -0
  265. package/module/types/string/formatString/index.d.ts +5 -0
  266. package/module/types/string/formatString/index.js +6 -0
  267. package/module/types/string/formatString/index.js.map +1 -0
  268. package/module/types/string/index.d.ts +1 -0
  269. package/module/types/string/index.js +2 -0
  270. package/module/types/string/index.js.map +1 -0
  271. package/package.json +31 -32
  272. package/module/String/formatString.d.ts +0 -13
  273. package/module/String/formatString.js +0 -18
  274. package/module/String/formatString.js.map +0 -1
  275. package/module/es5/String/formatString.d.ts +0 -13
  276. package/module/es5/String/formatString.js +0 -26
@@ -0,0 +1,475 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ultraNumberSort = void 0;
7
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
8
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
9
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
10
+ /**
11
+ * Ultra-fast sorting specifically optimized for number arrays
12
+ * @param array Array of numbers to sort
13
+ * @param ascending Sort in ascending order if true, descending if false
14
+ * @returns Sorted array
15
+ */
16
+ var ultraNumberSort = exports.ultraNumberSort = function ultraNumberSort(array) {
17
+ var ascending = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
18
+ var length = array.length;
19
+ if (length <= 1) {
20
+ return array;
21
+ }
22
+
23
+ // For tiny arrays, use optimized inline sort
24
+ if (length === 2) {
25
+ if (array[0] > array[1] === ascending) {
26
+ var _ref = [array[1], array[0]];
27
+ array[0] = _ref[0];
28
+ array[1] = _ref[1];
29
+ }
30
+ return array;
31
+ }
32
+ if (length === 3) {
33
+ inlineSort3(array, ascending);
34
+ return array;
35
+ }
36
+
37
+ // Check if all numbers are integers and find range
38
+ var allIntegers = true;
39
+ var min = array[0];
40
+ var max = array[0];
41
+ var hasNaN = false;
42
+ for (var index = 0; index < length; index++) {
43
+ var value = array[index];
44
+ // biome-ignore lint/suspicious/noSelfCompare: ignore
45
+ if (value !== value) {
46
+ hasNaN = true;
47
+ break;
48
+ }
49
+ if (value < min) {
50
+ min = value;
51
+ }
52
+ if (value > max) {
53
+ max = value;
54
+ }
55
+ if (allIntegers && value !== Math.floor(value)) {
56
+ allIntegers = false;
57
+ }
58
+ }
59
+
60
+ // Handle NaN values
61
+ if (hasNaN) {
62
+ return handleNaNSort(array, ascending);
63
+ }
64
+
65
+ // For small integer ranges, use counting sort
66
+ if (allIntegers && max - min < length * 2 && max - min < 1000000) {
67
+ return countingSort(array, min, max, ascending);
68
+ }
69
+
70
+ // For larger arrays, use radix sort if applicable
71
+ if (allIntegers && length > 100) {
72
+ return radixSort(array, ascending);
73
+ }
74
+
75
+ // Fall back to optimized quicksort for floating point
76
+ return numericQuickSort(array, 0, length - 1, ascending);
77
+ };
78
+
79
+ /**
80
+ * Inline sort for 3 elements
81
+ */
82
+ var inlineSort3 = function inlineSort3(array, ascending) {
83
+ var a = array[0];
84
+ var b = array[1];
85
+ var c = array[2];
86
+ if (ascending) {
87
+ if (a > b) {
88
+ var _ref2 = [b, a];
89
+ a = _ref2[0];
90
+ b = _ref2[1];
91
+ }
92
+ if (b > c) {
93
+ var _ref3 = [c, b];
94
+ b = _ref3[0];
95
+ c = _ref3[1];
96
+ if (a > b) {
97
+ var _ref4 = [b, a];
98
+ a = _ref4[0];
99
+ b = _ref4[1];
100
+ }
101
+ }
102
+ } else {
103
+ if (a < b) {
104
+ var _ref5 = [b, a];
105
+ a = _ref5[0];
106
+ b = _ref5[1];
107
+ }
108
+ if (b < c) {
109
+ var _ref6 = [c, b];
110
+ b = _ref6[0];
111
+ c = _ref6[1];
112
+ if (a < b) {
113
+ var _ref7 = [b, a];
114
+ a = _ref7[0];
115
+ b = _ref7[1];
116
+ }
117
+ }
118
+ }
119
+ array[0] = a;
120
+ array[1] = b;
121
+ array[2] = c;
122
+ };
123
+
124
+ /**
125
+ * Handle arrays with NaN values
126
+ */
127
+ var handleNaNSort = function handleNaNSort(array, ascending) {
128
+ var valid = [];
129
+ var nanCount = 0;
130
+ var _iterator = _createForOfIteratorHelper(array),
131
+ _step;
132
+ try {
133
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
134
+ var element = _step.value;
135
+ // biome-ignore lint/suspicious/noSelfCompare: ignore
136
+ if (element === element) {
137
+ valid.push(element);
138
+ } else {
139
+ nanCount++;
140
+ }
141
+ }
142
+ } catch (err) {
143
+ _iterator.e(err);
144
+ } finally {
145
+ _iterator.f();
146
+ }
147
+ numericQuickSort(valid, 0, valid.length - 1, ascending);
148
+
149
+ // NaN values go to the end
150
+ for (var index = 0; index < nanCount; index++) {
151
+ valid.push(Number.NaN);
152
+ }
153
+
154
+ // Copy back
155
+ for (var _index = 0; _index < array.length; _index++) {
156
+ array[_index] = valid[_index];
157
+ }
158
+ return array;
159
+ };
160
+
161
+ /**
162
+ * Counting sort for small integer ranges
163
+ */
164
+ var countingSort = function countingSort(array, min, max, ascending) {
165
+ var range = max - min + 1;
166
+ var count = new Uint32Array(range);
167
+
168
+ // Count occurrences
169
+ var _iterator2 = _createForOfIteratorHelper(array),
170
+ _step2;
171
+ try {
172
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
173
+ var element = _step2.value;
174
+ count[element - min]++;
175
+ }
176
+
177
+ // Reconstruct array
178
+ } catch (err) {
179
+ _iterator2.e(err);
180
+ } finally {
181
+ _iterator2.f();
182
+ }
183
+ var index = 0;
184
+ if (ascending) {
185
+ for (var index_ = 0; index_ < range; index_++) {
186
+ var cnt = count[index_];
187
+ var value = index_ + min;
188
+ for (var _index_ = 0; _index_ < cnt; _index_++) {
189
+ array[index++] = value;
190
+ }
191
+ }
192
+ } else {
193
+ for (var _index_2 = range - 1; _index_2 >= 0; _index_2--) {
194
+ var _cnt = count[_index_2];
195
+ var _value = _index_2 + min;
196
+ for (var _index_3 = 0; _index_3 < _cnt; _index_3++) {
197
+ array[index++] = _value;
198
+ }
199
+ }
200
+ }
201
+ return array;
202
+ };
203
+
204
+ /**
205
+ * Radix sort for integers
206
+ */
207
+ var radixSort = function radixSort(array, ascending) {
208
+ var length = array.length;
209
+
210
+ // Separate positive and negative numbers
211
+ var positive = [];
212
+ var negative = [];
213
+ var zeroCount = 0;
214
+ for (var index_ = 0; index_ < length; index_++) {
215
+ if (array[index_] > 0) {
216
+ positive.push(array[index_]);
217
+ } else if (array[index_] < 0) {
218
+ negative.push(-array[index_]);
219
+ } else {
220
+ zeroCount++;
221
+ }
222
+ }
223
+
224
+ // Sort positive numbers
225
+ if (positive.length > 0) {
226
+ radixSortPositive(positive);
227
+ }
228
+
229
+ // Sort negative numbers
230
+ if (negative.length > 0) {
231
+ radixSortPositive(negative);
232
+ }
233
+
234
+ // Merge results
235
+ var index = 0;
236
+ if (ascending) {
237
+ // Negative numbers first (in reverse order)
238
+ for (var _index_4 = negative.length - 1; _index_4 >= 0; _index_4--) {
239
+ array[index++] = -negative[_index_4];
240
+ }
241
+ // Zeros
242
+ for (var _index_5 = 0; _index_5 < zeroCount; _index_5++) {
243
+ array[index++] = 0;
244
+ }
245
+ // Positive numbers
246
+ var _iterator3 = _createForOfIteratorHelper(positive),
247
+ _step3;
248
+ try {
249
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
250
+ var element = _step3.value;
251
+ array[index++] = element;
252
+ }
253
+ } catch (err) {
254
+ _iterator3.e(err);
255
+ } finally {
256
+ _iterator3.f();
257
+ }
258
+ } else {
259
+ // Positive numbers first (in reverse order)
260
+ for (var _index_6 = positive.length - 1; _index_6 >= 0; _index_6--) {
261
+ array[index++] = positive[_index_6];
262
+ }
263
+ // Zeros
264
+ for (var _index_7 = 0; _index_7 < zeroCount; _index_7++) {
265
+ array[index++] = 0;
266
+ }
267
+ // Negative numbers
268
+ var _iterator4 = _createForOfIteratorHelper(negative),
269
+ _step4;
270
+ try {
271
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
272
+ var _element = _step4.value;
273
+ array[index++] = -_element;
274
+ }
275
+ } catch (err) {
276
+ _iterator4.e(err);
277
+ } finally {
278
+ _iterator4.f();
279
+ }
280
+ }
281
+ return array;
282
+ };
283
+
284
+ /**
285
+ * Radix sort for positive integers
286
+ */
287
+ var radixSortPositive = function radixSortPositive(array) {
288
+ var length = array.length;
289
+ if (length <= 1) {
290
+ return;
291
+ }
292
+
293
+ // Find maximum to determine number of digits
294
+ var max = array[0];
295
+ for (var index = 1; index < length; index++) {
296
+ if (array[index] > max) {
297
+ max = array[index];
298
+ }
299
+ }
300
+
301
+ // Use typed arrays for better performance
302
+ var output = new Float64Array(length);
303
+ var count = new Uint32Array(256);
304
+
305
+ // Process 8 bits at a time
306
+ for (var shift = 0; max >> shift > 0; shift += 8) {
307
+ // Reset count array
308
+ count.fill(0);
309
+
310
+ // Count occurrences
311
+ for (var _index2 = 0; _index2 < length; _index2++) {
312
+ var digit = array[_index2] >> shift & 0xff;
313
+ count[digit]++;
314
+ }
315
+
316
+ // Change count[i] to actual position
317
+ for (var _index3 = 1; _index3 < 256; _index3++) {
318
+ count[_index3] += count[_index3 - 1];
319
+ }
320
+
321
+ // Build output array
322
+ for (var _index4 = length - 1; _index4 >= 0; _index4--) {
323
+ var _digit = array[_index4] >> shift & 0xff;
324
+ output[--count[_digit]] = array[_index4];
325
+ }
326
+
327
+ // Copy back
328
+ for (var _index5 = 0; _index5 < length; _index5++) {
329
+ array[_index5] = output[_index5];
330
+ }
331
+ }
332
+ };
333
+
334
+ /**
335
+ * Optimized quicksort for numbers
336
+ */
337
+ var numericQuickSort = function numericQuickSort(array, low, high, ascending) {
338
+ var stack = [];
339
+ stack.push(low, high);
340
+ while (stack.length > 0) {
341
+ var h = stack.pop();
342
+ var l = stack.pop();
343
+ if (h === undefined || l === undefined || h <= l) {
344
+ continue;
345
+ }
346
+
347
+ // For small subarrays, use insertion sort
348
+ if (h - l < 16) {
349
+ numericInsertionSort(array, l, h, ascending);
350
+ continue;
351
+ }
352
+
353
+ // Partition
354
+ var pivot = numericPartition(array, l, h, ascending);
355
+
356
+ // Push larger partition first to limit stack depth
357
+ if (pivot - l > h - pivot) {
358
+ stack.push(l, pivot - 1, pivot + 1, h);
359
+ } else {
360
+ stack.push(pivot + 1, h, l, pivot - 1);
361
+ }
362
+ }
363
+ return array;
364
+ };
365
+
366
+ /**
367
+ * Numeric insertion sort
368
+ */
369
+ var numericInsertionSort = function numericInsertionSort(array, low, high, ascending) {
370
+ if (ascending) {
371
+ for (var index = low + 1; index <= high; index++) {
372
+ var key = array[index];
373
+ var index_ = index - 1;
374
+ while (index_ >= low && array[index_] > key) {
375
+ array[index_ + 1] = array[index_];
376
+ index_--;
377
+ }
378
+ array[index_ + 1] = key;
379
+ }
380
+ } else {
381
+ for (var _index6 = low + 1; _index6 <= high; _index6++) {
382
+ var _key = array[_index6];
383
+ var _index_8 = _index6 - 1;
384
+ while (_index_8 >= low && array[_index_8] < _key) {
385
+ array[_index_8 + 1] = array[_index_8];
386
+ _index_8--;
387
+ }
388
+ array[_index_8 + 1] = _key;
389
+ }
390
+ }
391
+ };
392
+
393
+ /**
394
+ * Numeric partition with median-of-three pivot
395
+ */
396
+ var numericPartition = function numericPartition(array, low, high, ascending) {
397
+ // Median-of-three pivot selection
398
+ var mid = low + (high - low >> 1);
399
+ if (ascending) {
400
+ if (array[mid] < array[low]) {
401
+ var _ref8 = [array[mid], array[low]];
402
+ array[low] = _ref8[0];
403
+ array[mid] = _ref8[1];
404
+ }
405
+ if (array[high] < array[low]) {
406
+ var _ref9 = [array[high], array[low]];
407
+ array[low] = _ref9[0];
408
+ array[high] = _ref9[1];
409
+ }
410
+ if (array[high] < array[mid]) {
411
+ var _ref0 = [array[high], array[mid]];
412
+ array[mid] = _ref0[0];
413
+ array[high] = _ref0[1];
414
+ }
415
+ } else {
416
+ if (array[mid] > array[low]) {
417
+ var _ref1 = [array[mid], array[low]];
418
+ array[low] = _ref1[0];
419
+ array[mid] = _ref1[1];
420
+ }
421
+ if (array[high] > array[low]) {
422
+ var _ref10 = [array[high], array[low]];
423
+ array[low] = _ref10[0];
424
+ array[high] = _ref10[1];
425
+ }
426
+ if (array[high] > array[mid]) {
427
+ var _ref11 = [array[high], array[mid]];
428
+ array[mid] = _ref11[0];
429
+ array[high] = _ref11[1];
430
+ }
431
+ }
432
+
433
+ // Move pivot to end-1
434
+ var _ref12 = [array[high - 1], array[mid]];
435
+ array[mid] = _ref12[0];
436
+ array[high - 1] = _ref12[1];
437
+ var pivot = array[high - 1];
438
+ var index = low;
439
+ var index_ = high - 1;
440
+ if (ascending) {
441
+ while (true) {
442
+ while (array[++index] < pivot) {
443
+ // Continue
444
+ }
445
+ while (array[--index_] > pivot) {
446
+ // Continue
447
+ }
448
+ if (index >= index_) {
449
+ break;
450
+ }
451
+ var _ref13 = [array[index_], array[index]];
452
+ array[index] = _ref13[0];
453
+ array[index_] = _ref13[1];
454
+ }
455
+ } else {
456
+ while (true) {
457
+ while (array[++index] > pivot) {
458
+ // Continue
459
+ }
460
+ while (array[--index_] < pivot) {
461
+ // Continue
462
+ }
463
+ if (index >= index_) {
464
+ break;
465
+ }
466
+ var _ref14 = [array[index_], array[index]];
467
+ array[index] = _ref14[0];
468
+ array[index_] = _ref14[1];
469
+ }
470
+ }
471
+ var _ref15 = [array[high - 1], array[index]];
472
+ array[index] = _ref15[0];
473
+ array[high - 1] = _ref15[1];
474
+ return index;
475
+ };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Removes duplicate values from an array based on a selector function
3
+ * @param array - The array to process
4
+ * @param selector - Function that returns the value to compare for uniqueness
5
+ * @returns A new array with unique values based on the selector
6
+ */
7
+ export declare const uniqBy: <T extends unknown[], K>(array: T, selector: (item: T[number]) => K) => T;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.uniqBy = void 0;
7
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
8
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
9
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
10
+ /**
11
+ * Removes duplicate values from an array based on a selector function
12
+ * @param array - The array to process
13
+ * @param selector - Function that returns the value to compare for uniqueness
14
+ * @returns A new array with unique values based on the selector
15
+ */
16
+ var uniqBy = exports.uniqBy = function uniqBy(array, selector) {
17
+ var seen = new Set();
18
+ var result = [];
19
+ var _iterator = _createForOfIteratorHelper(array),
20
+ _step;
21
+ try {
22
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
23
+ var item = _step.value;
24
+ var key = selector(item);
25
+ if (!seen.has(key)) {
26
+ seen.add(key);
27
+ result.push(item);
28
+ }
29
+ }
30
+ } catch (err) {
31
+ _iterator.e(err);
32
+ } finally {
33
+ _iterator.f();
34
+ }
35
+ return result;
36
+ };
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Removes duplicate values from an array
3
+ * @param array - The array to process
4
+ * @returns A new array with unique values
5
+ */
6
+ export declare const unique: <T>(array: T[]) => T[];
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.unique = void 0;
7
+ function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
8
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
9
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
10
+ function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
11
+ function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
12
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
13
+ /**
14
+ * Removes duplicate values from an array
15
+ * @param array - The array to process
16
+ * @returns A new array with unique values
17
+ */
18
+ var unique = exports.unique = function unique(array) {
19
+ return _toConsumableArray(new Set(array));
20
+ };
@@ -36,7 +36,7 @@ var rgbaToHsla = exports.rgbaToHsla = function rgbaToHsla(_ref) {
36
36
  var l = (0, _division.division)((0, _addition.addition)(max, min), 2);
37
37
  var s = diff === 0 ? 0 : (0, _division.division)(diff, (0, _subtract.subtract)(1, Math.abs((0, _subtract.subtract)((0, _addition.addition)(max, min), 1))));
38
38
  if (diff !== 0) {
39
- // biome-ignore lint/style/useDefaultSwitchClause: <explanation>
39
+ // biome-ignore lint/style/useDefaultSwitchClause: ignore
40
40
  switch (max) {
41
41
  case rPrime:
42
42
  {
@@ -19,7 +19,21 @@ var birthday = exports.birthday = function birthday(year, mon, day) {
19
19
  var timeDifference = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 9;
20
20
  var birthdayDate = new Date((0, _new.newDateInt)(year, mon, day));
21
21
  var nowTime = (0, _now.now)(timeDifference);
22
- var y = nowTime.getFullYear() - birthdayDate.getFullYear();
23
- var r = nowTime < (0, _new.newDateInt)(nowTime.getFullYear(), birthdayDate.getMonth() - 1, birthdayDate.getDay()) ? y - 1 : y;
24
- return year < 100 ? 1900 + y : r;
22
+ var currentYear = nowTime.getFullYear();
23
+ var birthYear = birthdayDate.getFullYear();
24
+
25
+ // Calculate base age
26
+ var age = currentYear - birthYear;
27
+
28
+ // Check if birthday hasn't occurred this year yet
29
+ var thisYearBirthday = new Date(currentYear, birthdayDate.getMonth(), birthdayDate.getDate());
30
+ if (nowTime < thisYearBirthday) {
31
+ age -= 1;
32
+ }
33
+
34
+ // Handle future birthdays (should return 0 or non-negative)
35
+ if (age < 0) {
36
+ return 0;
37
+ }
38
+ return age;
25
39
  };
@@ -15,5 +15,8 @@ exports.isLeapYear = void 0;
15
15
  * isLeapYear(2023); // Returns false (not divisible by 4)
16
16
  */
17
17
  var isLeapYear = exports.isLeapYear = function isLeapYear(year) {
18
+ if (!Number.isInteger(year)) {
19
+ return false;
20
+ }
18
21
  return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0;
19
22
  };
@@ -1 +1,2 @@
1
+ export * from "./retry";
1
2
  export * from "./safeExecute";
@@ -3,6 +3,17 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ var _retry = require("./retry");
7
+ Object.keys(_retry).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _retry[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function get() {
13
+ return _retry[key];
14
+ }
15
+ });
16
+ });
6
17
  var _safeExecute = require("./safeExecute");
7
18
  Object.keys(_safeExecute).forEach(function (key) {
8
19
  if (key === "default" || key === "__esModule") return;
@@ -0,0 +1,37 @@
1
+ export interface RetryOptions {
2
+ retries?: number;
3
+ delay?: number;
4
+ shouldRetry?: (error: unknown) => boolean;
5
+ }
6
+ /**
7
+ * Retries a given async function with configurable retry logic
8
+ *
9
+ * @template T - The return type of the function
10
+ * @param function_ - The async function to retry
11
+ * @param options - Configuration options for retry behavior
12
+ * @param options.retries - Maximum number of retry attempts (default: 3)
13
+ * @param options.delay - Delay between retries in milliseconds (default: 1000)
14
+ * @param options.shouldRetry - Function to determine if an error should trigger a retry (default: always retry)
15
+ * @returns Promise that resolves with the function result or rejects with the final error
16
+ *
17
+ * @example
18
+ * ```typescript
19
+ * // Basic usage with default options
20
+ * const result = await retry(async () => {
21
+ * const response = await fetch('/api/data');
22
+ * if (!response.ok) throw new Error('Failed to fetch');
23
+ * return response.json();
24
+ * });
25
+ *
26
+ * // Custom retry configuration
27
+ * const result = await retry(
28
+ * () => riskyOperation(),
29
+ * {
30
+ * retries: 5,
31
+ * delay: 2000,
32
+ * shouldRetry: (error) => error instanceof NetworkError
33
+ * }
34
+ * );
35
+ * ```
36
+ */
37
+ export declare const retry: <T>(function_: () => Promise<T>, options?: RetryOptions) => Promise<T>;