umt 2.5.0 → 2.7.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 (368) hide show
  1. package/README.md +36 -0
  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 +1 -1
  7. package/module/Array/groupBy.js.map +1 -1
  8. package/module/Array/index.d.ts +2 -0
  9. package/module/Array/index.js +2 -0
  10. package/module/Array/index.js.map +1 -1
  11. package/module/Array/ultraNumberSort.js +2 -2
  12. package/module/Array/ultraNumberSort.js.map +1 -1
  13. package/module/Array/uniqBy.d.ts +7 -0
  14. package/module/Array/uniqBy.js +19 -0
  15. package/module/Array/uniqBy.js.map +1 -0
  16. package/module/Array/unique.d.ts +6 -0
  17. package/module/Array/unique.js +9 -0
  18. package/module/Array/unique.js.map +1 -0
  19. package/module/Color/rgbaToHsla.js +1 -1
  20. package/module/Color/rgbaToHsla.js.map +1 -1
  21. package/module/Crypto/decodeBase32.d.ts +7 -0
  22. package/module/Crypto/decodeBase32.js +27 -0
  23. package/module/Crypto/decodeBase32.js.map +1 -0
  24. package/module/Crypto/decodeBase32ToString.d.ts +7 -0
  25. package/module/Crypto/decodeBase32ToString.js +11 -0
  26. package/module/Crypto/decodeBase32ToString.js.map +1 -0
  27. package/module/Crypto/decodeBase58.d.ts +7 -0
  28. package/module/Crypto/decodeBase58.js +34 -0
  29. package/module/Crypto/decodeBase58.js.map +1 -0
  30. package/module/Crypto/decodeBase58ToString.d.ts +7 -0
  31. package/module/Crypto/decodeBase58ToString.js +11 -0
  32. package/module/Crypto/decodeBase58ToString.js.map +1 -0
  33. package/module/Crypto/encodeBase32.d.ts +7 -0
  34. package/module/Crypto/encodeBase32.js +28 -0
  35. package/module/Crypto/encodeBase32.js.map +1 -0
  36. package/module/Crypto/encodeBase58.d.ts +7 -0
  37. package/module/Crypto/encodeBase58.js +29 -0
  38. package/module/Crypto/encodeBase58.js.map +1 -0
  39. package/module/Crypto/index.d.ts +6 -0
  40. package/module/Crypto/index.js +7 -0
  41. package/module/Crypto/index.js.map +1 -0
  42. package/module/DataStructure/index.d.ts +1 -0
  43. package/module/DataStructure/index.js +2 -0
  44. package/module/DataStructure/index.js.map +1 -0
  45. package/module/DataStructure/priorityQueue.d.ts +241 -0
  46. package/module/DataStructure/priorityQueue.js +327 -0
  47. package/module/DataStructure/priorityQueue.js.map +1 -0
  48. package/module/Date/birthday.js +14 -6
  49. package/module/Date/birthday.js.map +1 -1
  50. package/module/Date/isLeapYear.js +3 -0
  51. package/module/Date/isLeapYear.js.map +1 -1
  52. package/module/Error/index.d.ts +1 -0
  53. package/module/Error/index.js +1 -0
  54. package/module/Error/index.js.map +1 -1
  55. package/module/Error/retry.d.ts +37 -0
  56. package/module/Error/retry.js +47 -0
  57. package/module/Error/retry.js.map +1 -0
  58. package/module/IP/getIpClass.js +1 -1
  59. package/module/IP/getIpClass.js.map +1 -1
  60. package/module/IP/getNetworkAddress.js +2 -2
  61. package/module/IP/getNetworkAddress.js.map +1 -1
  62. package/module/IP/ipToBinaryString.js +2 -2
  63. package/module/IP/ipToBinaryString.js.map +1 -1
  64. package/module/IP/subnetMaskToCidr.js +1 -1
  65. package/module/IP/subnetMaskToCidr.js.map +1 -1
  66. package/module/Math/calculator/core.js +21 -13
  67. package/module/Math/calculator/core.js.map +1 -1
  68. package/module/Math/calculator/literalExpression.js +19 -7
  69. package/module/Math/calculator/literalExpression.js.map +1 -1
  70. package/module/Math/correlationCoefficient.d.ts +11 -0
  71. package/module/Math/correlationCoefficient.js +40 -0
  72. package/module/Math/correlationCoefficient.js.map +1 -0
  73. package/module/Math/division.js +3 -3
  74. package/module/Math/division.js.map +1 -1
  75. package/module/Math/gcd.js +26 -4
  76. package/module/Math/gcd.js.map +1 -1
  77. package/module/Math/index.d.ts +3 -0
  78. package/module/Math/index.js +3 -0
  79. package/module/Math/index.js.map +1 -1
  80. package/module/Math/mode.d.ts +10 -0
  81. package/module/Math/mode.js +31 -0
  82. package/module/Math/mode.js.map +1 -0
  83. package/module/Math/percentile.d.ts +11 -0
  84. package/module/Math/percentile.js +31 -0
  85. package/module/Math/percentile.js.map +1 -0
  86. package/module/Math/standardDeviation.js +4 -2
  87. package/module/Math/standardDeviation.js.map +1 -1
  88. package/module/Object/has.js +1 -2
  89. package/module/Object/has.js.map +1 -1
  90. package/module/Object/index.d.ts +4 -0
  91. package/module/Object/index.js +4 -0
  92. package/module/Object/index.js.map +1 -1
  93. package/module/Object/isEmpty.d.ts +6 -0
  94. package/module/Object/isEmpty.js +20 -0
  95. package/module/Object/isEmpty.js.map +1 -0
  96. package/module/Object/merge.d.ts +8 -0
  97. package/module/Object/merge.js +10 -0
  98. package/module/Object/merge.js.map +1 -0
  99. package/module/Object/mergeDeep.d.ts +8 -0
  100. package/module/Object/mergeDeep.js +37 -0
  101. package/module/Object/mergeDeep.js.map +1 -0
  102. package/module/Object/omit.d.ts +7 -0
  103. package/module/Object/omit.js +14 -0
  104. package/module/Object/omit.js.map +1 -0
  105. package/module/Object/pickDeep.d.ts +2 -2
  106. package/module/Object/pickDeep.js +4 -4
  107. package/module/Object/pickDeep.js.map +1 -1
  108. package/module/Simple/Date/dayOfWeekSimple.js +3 -3
  109. package/module/Simple/Date/dayOfWeekSimple.js.map +1 -1
  110. package/module/String/camelCase.d.ts +6 -0
  111. package/module/String/camelCase.js +12 -0
  112. package/module/String/camelCase.js.map +1 -0
  113. package/module/String/escapeHtml.d.ts +6 -0
  114. package/module/String/escapeHtml.js +19 -0
  115. package/module/String/escapeHtml.js.map +1 -0
  116. package/module/String/formatString/applyFormatter.d.ts +25 -0
  117. package/module/String/formatString/applyFormatter.js +71 -0
  118. package/module/String/formatString/applyFormatter.js.map +1 -0
  119. package/module/String/formatString/defaultFormatters.d.ts +24 -0
  120. package/module/String/formatString/defaultFormatters.js +59 -0
  121. package/module/String/formatString/defaultFormatters.js.map +1 -0
  122. package/module/String/formatString/detectMode.d.ts +26 -0
  123. package/module/String/formatString/detectMode.js +61 -0
  124. package/module/String/formatString/detectMode.js.map +1 -0
  125. package/module/String/formatString/getValue.d.ts +27 -0
  126. package/module/String/formatString/getValue.js +56 -0
  127. package/module/String/formatString/getValue.js.map +1 -0
  128. package/module/String/formatString/index.d.ts +91 -0
  129. package/module/String/formatString/index.js +38 -0
  130. package/module/String/formatString/index.js.map +1 -0
  131. package/module/String/fuzzySearch.d.ts +14 -0
  132. package/module/String/fuzzySearch.js +27 -0
  133. package/module/String/fuzzySearch.js.map +1 -0
  134. package/module/String/index.d.ts +9 -0
  135. package/module/String/index.js +9 -0
  136. package/module/String/index.js.map +1 -1
  137. package/module/String/kebabCase.d.ts +6 -0
  138. package/module/String/kebabCase.js +22 -0
  139. package/module/String/kebabCase.js.map +1 -0
  140. package/module/String/levenshteinDistance.d.ts +8 -0
  141. package/module/String/levenshteinDistance.js +38 -0
  142. package/module/String/levenshteinDistance.js.map +1 -0
  143. package/module/String/slugify.d.ts +10 -0
  144. package/module/String/slugify.js +21 -0
  145. package/module/String/slugify.js.map +1 -0
  146. package/module/String/stringSimilarity.d.ts +8 -0
  147. package/module/String/stringSimilarity.js +23 -0
  148. package/module/String/stringSimilarity.js.map +1 -0
  149. package/module/String/truncate.d.ts +12 -0
  150. package/module/String/truncate.js +21 -0
  151. package/module/String/truncate.js.map +1 -0
  152. package/module/String/unescapeHtml.d.ts +17 -0
  153. package/module/String/unescapeHtml.js +45 -0
  154. package/module/String/unescapeHtml.js.map +1 -0
  155. package/module/Validate/core/index.js +0 -1
  156. package/module/Validate/core/index.js.map +1 -1
  157. package/module/Validate/index.d.ts +1 -0
  158. package/module/Validate/index.js +1 -0
  159. package/module/Validate/index.js.map +1 -1
  160. package/module/Validate/isDeepEqual.d.ts +28 -0
  161. package/module/Validate/isDeepEqual.js +148 -0
  162. package/module/Validate/isDeepEqual.js.map +1 -0
  163. package/module/Validate/isDouble.js +1 -1
  164. package/module/Validate/isDouble.js.map +1 -1
  165. package/module/Validate/isNode.js +1 -0
  166. package/module/Validate/isNode.js.map +1 -1
  167. package/module/Validate/isNumber.js +1 -1
  168. package/module/Validate/isNumber.js.map +1 -1
  169. package/module/Validate/isValueNaN.js +1 -1
  170. package/module/Validate/isValueNaN.js.map +1 -1
  171. package/module/Validate/number/even.js +7 -1
  172. package/module/Validate/number/even.js.map +1 -1
  173. package/module/Validate/number/odd.js +7 -1
  174. package/module/Validate/number/odd.js.map +1 -1
  175. package/module/Validate/string/email.js +20 -2
  176. package/module/Validate/string/email.js.map +1 -1
  177. package/module/es5/Array/generateNumberArray.js +15 -9
  178. package/module/es5/Array/getArraysCommon.js +39 -4
  179. package/module/es5/Array/groupBy.js +1 -1
  180. package/module/es5/Array/index.d.ts +2 -0
  181. package/module/es5/Array/index.js +22 -0
  182. package/module/es5/Array/ultraNumberSort.js +2 -2
  183. package/module/es5/Array/uniqBy.d.ts +7 -0
  184. package/module/es5/Array/uniqBy.js +36 -0
  185. package/module/es5/Array/unique.d.ts +6 -0
  186. package/module/es5/Array/unique.js +20 -0
  187. package/module/es5/Color/rgbaToHsla.js +1 -1
  188. package/module/es5/Crypto/decodeBase32.d.ts +7 -0
  189. package/module/es5/Crypto/decodeBase32.js +44 -0
  190. package/module/es5/Crypto/decodeBase32ToString.d.ts +7 -0
  191. package/module/es5/Crypto/decodeBase32ToString.js +16 -0
  192. package/module/es5/Crypto/decodeBase58.d.ts +7 -0
  193. package/module/es5/Crypto/decodeBase58.js +63 -0
  194. package/module/es5/Crypto/decodeBase58ToString.d.ts +7 -0
  195. package/module/es5/Crypto/decodeBase58ToString.js +16 -0
  196. package/module/es5/Crypto/encodeBase32.d.ts +7 -0
  197. package/module/es5/Crypto/encodeBase32.js +45 -0
  198. package/module/es5/Crypto/encodeBase58.d.ts +7 -0
  199. package/module/es5/Crypto/encodeBase58.js +55 -0
  200. package/module/es5/Crypto/index.d.ts +6 -0
  201. package/module/es5/Crypto/index.js +71 -0
  202. package/module/es5/DataStructure/index.d.ts +1 -0
  203. package/module/es5/DataStructure/index.js +16 -0
  204. package/module/es5/DataStructure/priorityQueue.d.ts +241 -0
  205. package/module/es5/DataStructure/priorityQueue.js +405 -0
  206. package/module/es5/Date/birthday.js +17 -3
  207. package/module/es5/Date/isLeapYear.js +3 -0
  208. package/module/es5/Error/index.d.ts +1 -0
  209. package/module/es5/Error/index.js +11 -0
  210. package/module/es5/Error/retry.d.ts +37 -0
  211. package/module/es5/Error/retry.js +88 -0
  212. package/module/es5/IP/getIpClass.js +1 -1
  213. package/module/es5/IP/getNetworkAddress.js +2 -2
  214. package/module/es5/IP/ipToBinaryString.js +2 -2
  215. package/module/es5/IP/subnetMaskToCidr.js +1 -1
  216. package/module/es5/Math/calculator/core.js +17 -9
  217. package/module/es5/Math/calculator/literalExpression.js +19 -6
  218. package/module/es5/Math/correlationCoefficient.d.ts +11 -0
  219. package/module/es5/Math/correlationCoefficient.js +63 -0
  220. package/module/es5/Math/division.js +3 -3
  221. package/module/es5/Math/gcd.js +43 -5
  222. package/module/es5/Math/index.d.ts +3 -0
  223. package/module/es5/Math/index.js +33 -0
  224. package/module/es5/Math/mode.d.ts +10 -0
  225. package/module/es5/Math/mode.js +67 -0
  226. package/module/es5/Math/percentile.d.ts +11 -0
  227. package/module/es5/Math/percentile.js +42 -0
  228. package/module/es5/Math/standardDeviation.js +4 -2
  229. package/module/es5/Object/has.js +1 -1
  230. package/module/es5/Object/index.d.ts +4 -0
  231. package/module/es5/Object/index.js +44 -0
  232. package/module/es5/Object/isEmpty.d.ts +6 -0
  233. package/module/es5/Object/isEmpty.js +26 -0
  234. package/module/es5/Object/merge.d.ts +8 -0
  235. package/module/es5/Object/merge.js +18 -0
  236. package/module/es5/Object/mergeDeep.d.ts +8 -0
  237. package/module/es5/Object/mergeDeep.js +46 -0
  238. package/module/es5/Object/omit.d.ts +7 -0
  239. package/module/es5/Object/omit.js +29 -0
  240. package/module/es5/Object/pickDeep.d.ts +2 -2
  241. package/module/es5/Object/pickDeep.js +4 -4
  242. package/module/es5/Simple/Date/dayOfWeekSimple.js +3 -3
  243. package/module/es5/String/camelCase.d.ts +6 -0
  244. package/module/es5/String/camelCase.js +18 -0
  245. package/module/es5/String/escapeHtml.d.ts +6 -0
  246. package/module/es5/String/escapeHtml.js +27 -0
  247. package/module/es5/String/formatString/applyFormatter.d.ts +25 -0
  248. package/module/es5/String/formatString/applyFormatter.js +100 -0
  249. package/module/es5/String/formatString/defaultFormatters.d.ts +24 -0
  250. package/module/es5/String/formatString/defaultFormatters.js +79 -0
  251. package/module/es5/String/formatString/detectMode.d.ts +26 -0
  252. package/module/es5/String/formatString/detectMode.js +60 -0
  253. package/module/es5/String/formatString/getValue.d.ts +27 -0
  254. package/module/es5/String/formatString/getValue.js +85 -0
  255. package/module/es5/String/formatString/index.d.ts +91 -0
  256. package/module/es5/String/formatString/index.js +152 -0
  257. package/module/es5/String/fuzzySearch.d.ts +14 -0
  258. package/module/es5/String/fuzzySearch.js +50 -0
  259. package/module/es5/String/index.d.ts +9 -0
  260. package/module/es5/String/index.js +99 -0
  261. package/module/es5/String/kebabCase.d.ts +6 -0
  262. package/module/es5/String/kebabCase.js +26 -0
  263. package/module/es5/String/levenshteinDistance.d.ts +8 -0
  264. package/module/es5/String/levenshteinDistance.js +58 -0
  265. package/module/es5/String/slugify.d.ts +10 -0
  266. package/module/es5/String/slugify.js +18 -0
  267. package/module/es5/String/stringSimilarity.d.ts +8 -0
  268. package/module/es5/String/stringSimilarity.js +30 -0
  269. package/module/es5/String/truncate.d.ts +12 -0
  270. package/module/es5/String/truncate.js +27 -0
  271. package/module/es5/String/unescapeHtml.d.ts +17 -0
  272. package/module/es5/String/unescapeHtml.js +51 -0
  273. package/module/es5/Validate/core/index.js +0 -1
  274. package/module/es5/Validate/index.d.ts +1 -0
  275. package/module/es5/Validate/index.js +11 -0
  276. package/module/es5/Validate/isDeepEqual.d.ts +28 -0
  277. package/module/es5/Validate/isDeepEqual.js +232 -0
  278. package/module/es5/Validate/isDouble.js +1 -1
  279. package/module/es5/Validate/isNode.js +1 -0
  280. package/module/es5/Validate/isNumber.js +1 -1
  281. package/module/es5/Validate/isValueNaN.js +1 -1
  282. package/module/es5/Validate/number/even.js +4 -0
  283. package/module/es5/Validate/number/odd.js +4 -0
  284. package/module/es5/Validate/string/email.js +26 -1
  285. package/module/es5/index.d.ts +2 -0
  286. package/module/es5/index.js +22 -0
  287. package/module/es5/tsconfig.tsbuildinfo +1 -1
  288. package/module/es5/types/index.d.ts +1 -0
  289. package/module/es5/types/index.js +11 -0
  290. package/module/es5/types/logic/deepPartial.d.ts +37 -0
  291. package/module/es5/types/logic/deepPartial.js +5 -0
  292. package/module/es5/types/logic/deepRequired.d.ts +37 -0
  293. package/module/es5/types/logic/deepRequired.js +5 -0
  294. package/module/es5/types/logic/index.d.ts +3 -0
  295. package/module/es5/types/logic/index.js +33 -0
  296. package/module/es5/types/logic/unionToIntersection.d.ts +12 -0
  297. package/module/es5/types/logic/unionToIntersection.js +5 -0
  298. package/module/es5/types/object/index.d.ts +1 -0
  299. package/module/es5/types/object/index.js +11 -0
  300. package/module/es5/types/object/pickDeep.d.ts +13 -1
  301. package/module/es5/types/object/shallowObjectValue.d.ts +9 -0
  302. package/module/es5/types/object/shallowObjectValue.js +5 -0
  303. package/module/es5/types/string/formatString/formatData.d.ts +17 -0
  304. package/module/es5/types/string/formatString/formatData.js +5 -0
  305. package/module/es5/types/string/formatString/formatOptions.d.ts +21 -0
  306. package/module/es5/types/string/formatString/formatOptions.js +5 -0
  307. package/module/es5/types/string/formatString/formatString.d.ts +4 -0
  308. package/module/es5/types/string/formatString/formatString.js +49 -0
  309. package/module/es5/types/string/formatString/formatValue.d.ts +15 -0
  310. package/module/es5/types/string/formatString/formatValue.js +5 -0
  311. package/module/es5/types/string/formatString/formatter.d.ts +13 -0
  312. package/module/es5/types/string/formatString/formatter.js +5 -0
  313. package/module/es5/types/string/formatString/index.d.ts +5 -0
  314. package/module/es5/types/string/formatString/index.js +60 -0
  315. package/module/es5/types/string/index.d.ts +1 -0
  316. package/module/es5/types/string/index.js +16 -0
  317. package/module/index.d.ts +2 -0
  318. package/module/index.js +2 -0
  319. package/module/index.js.map +1 -1
  320. package/module/types/index.d.ts +1 -0
  321. package/module/types/index.js +1 -0
  322. package/module/types/index.js.map +1 -1
  323. package/module/types/logic/deepPartial.d.ts +37 -0
  324. package/module/types/logic/deepPartial.js +36 -0
  325. package/module/types/logic/deepPartial.js.map +1 -0
  326. package/module/types/logic/deepRequired.d.ts +37 -0
  327. package/module/types/logic/deepRequired.js +2 -0
  328. package/module/types/logic/deepRequired.js.map +1 -0
  329. package/module/types/logic/index.d.ts +3 -0
  330. package/module/types/logic/index.js +3 -0
  331. package/module/types/logic/index.js.map +1 -1
  332. package/module/types/logic/unionToIntersection.d.ts +12 -0
  333. package/module/types/logic/unionToIntersection.js +2 -0
  334. package/module/types/logic/unionToIntersection.js.map +1 -0
  335. package/module/types/object/index.d.ts +1 -0
  336. package/module/types/object/index.js +1 -0
  337. package/module/types/object/index.js.map +1 -1
  338. package/module/types/object/pickDeep.d.ts +13 -1
  339. package/module/types/object/shallowObjectValue.d.ts +9 -0
  340. package/module/types/object/shallowObjectValue.js +2 -0
  341. package/module/types/object/shallowObjectValue.js.map +1 -0
  342. package/module/types/string/formatString/formatData.d.ts +17 -0
  343. package/module/types/string/formatString/formatData.js +2 -0
  344. package/module/types/string/formatString/formatData.js.map +1 -0
  345. package/module/types/string/formatString/formatOptions.d.ts +21 -0
  346. package/module/types/string/formatString/formatOptions.js +2 -0
  347. package/module/types/string/formatString/formatOptions.js.map +1 -0
  348. package/module/types/string/formatString/formatString.d.ts +4 -0
  349. package/module/types/string/formatString/formatString.js +5 -0
  350. package/module/types/string/formatString/formatString.js.map +1 -0
  351. package/module/types/string/formatString/formatValue.d.ts +15 -0
  352. package/module/types/string/formatString/formatValue.js +2 -0
  353. package/module/types/string/formatString/formatValue.js.map +1 -0
  354. package/module/types/string/formatString/formatter.d.ts +13 -0
  355. package/module/types/string/formatString/formatter.js +2 -0
  356. package/module/types/string/formatString/formatter.js.map +1 -0
  357. package/module/types/string/formatString/index.d.ts +5 -0
  358. package/module/types/string/formatString/index.js +6 -0
  359. package/module/types/string/formatString/index.js.map +1 -0
  360. package/module/types/string/index.d.ts +1 -0
  361. package/module/types/string/index.js +2 -0
  362. package/module/types/string/index.js.map +1 -0
  363. package/package.json +40 -41
  364. package/module/String/formatString.d.ts +0 -13
  365. package/module/String/formatString.js +0 -18
  366. package/module/String/formatString.js.map +0 -1
  367. package/module/es5/String/formatString.d.ts +0 -13
  368. package/module/es5/String/formatString.js +0 -26
@@ -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>;
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.retry = void 0;
7
+ function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
8
+ function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { if (r) i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n;else { var o = function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); }; o("next", 0), o("throw", 1), o("return", 2); } }, _regeneratorDefine2(e, r, n, t); }
9
+ function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
10
+ function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
11
+ /**
12
+ * Retries a given async function with configurable retry logic
13
+ *
14
+ * @template T - The return type of the function
15
+ * @param function_ - The async function to retry
16
+ * @param options - Configuration options for retry behavior
17
+ * @param options.retries - Maximum number of retry attempts (default: 3)
18
+ * @param options.delay - Delay between retries in milliseconds (default: 1000)
19
+ * @param options.shouldRetry - Function to determine if an error should trigger a retry (default: always retry)
20
+ * @returns Promise that resolves with the function result or rejects with the final error
21
+ *
22
+ * @example
23
+ * ```typescript
24
+ * // Basic usage with default options
25
+ * const result = await retry(async () => {
26
+ * const response = await fetch('/api/data');
27
+ * if (!response.ok) throw new Error('Failed to fetch');
28
+ * return response.json();
29
+ * });
30
+ *
31
+ * // Custom retry configuration
32
+ * const result = await retry(
33
+ * () => riskyOperation(),
34
+ * {
35
+ * retries: 5,
36
+ * delay: 2000,
37
+ * shouldRetry: (error) => error instanceof NetworkError
38
+ * }
39
+ * );
40
+ * ```
41
+ */
42
+ var retry = exports.retry = function retry(function_) {
43
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
44
+ var _options$retries = options.retries,
45
+ retries = _options$retries === void 0 ? 3 : _options$retries,
46
+ _options$delay = options.delay,
47
+ delay = _options$delay === void 0 ? 1000 : _options$delay,
48
+ _options$shouldRetry = options.shouldRetry,
49
+ shouldRetry = _options$shouldRetry === void 0 ? function () {
50
+ return true;
51
+ } : _options$shouldRetry;
52
+ var _attempt = /*#__PURE__*/function () {
53
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(remainingAttempts) {
54
+ var _t;
55
+ return _regenerator().w(function (_context) {
56
+ while (1) switch (_context.n) {
57
+ case 0:
58
+ _context.p = 0;
59
+ _context.n = 1;
60
+ return function_();
61
+ case 1:
62
+ return _context.a(2, _context.v);
63
+ case 2:
64
+ _context.p = 2;
65
+ _t = _context.v;
66
+ if (!(remainingAttempts <= 0 || !shouldRetry(_t))) {
67
+ _context.n = 3;
68
+ break;
69
+ }
70
+ throw _t;
71
+ case 3:
72
+ _context.n = 4;
73
+ return new Promise(function (resolve) {
74
+ return setTimeout(function () {
75
+ return resolve(_attempt(remainingAttempts - 1));
76
+ }, delay);
77
+ });
78
+ case 4:
79
+ return _context.a(2, _context.v);
80
+ }
81
+ }, _callee, null, [[0, 2]]);
82
+ }));
83
+ return function attempt(_x) {
84
+ return _ref.apply(this, arguments);
85
+ };
86
+ }();
87
+ return _attempt(retries);
88
+ };
@@ -19,7 +19,7 @@ var getIpClass = exports.getIpClass = function getIpClass(ip) {
19
19
  if (parts.length !== 4) {
20
20
  return "";
21
21
  }
22
- var firstOctet = Number.parseInt(parts[0]);
22
+ var firstOctet = Number.parseInt(parts[0], 10);
23
23
  if (Number.isNaN(firstOctet) || firstOctet < 0 || firstOctet > 255) {
24
24
  return "";
25
25
  }
@@ -25,7 +25,7 @@ var getNetworkAddress = exports.getNetworkAddress = function getNetworkAddress(i
25
25
  // Validate IP format
26
26
  var ipParts = ip.split(".");
27
27
  if (ipParts.length !== 4 || !ipParts.every(function (part) {
28
- var number_ = Number.parseInt(part);
28
+ var number_ = Number.parseInt(part, 10);
29
29
  return !Number.isNaN(number_) && number_ >= 0 && number_ <= 255;
30
30
  })) {
31
31
  throw new TypeError("Invalid IP address or subnet mask");
@@ -34,7 +34,7 @@ var getNetworkAddress = exports.getNetworkAddress = function getNetworkAddress(i
34
34
  // Validate subnet mask format
35
35
  var maskParts = subnetMask.split(".");
36
36
  if (maskParts.length !== 4 || !maskParts.every(function (part) {
37
- var number_ = Number.parseInt(part);
37
+ var number_ = Number.parseInt(part, 10);
38
38
  return !Number.isNaN(number_) && number_ >= 0 && number_ <= 255;
39
39
  })) {
40
40
  throw new TypeError("Invalid IP address or subnet mask");
@@ -37,7 +37,7 @@ var ipToBinaryString = exports.ipToBinaryString = function ipToBinaryString(ip)
37
37
  if (!octet || octet.length > 1 && octet[0] === "0") {
38
38
  throw new Error("Invalid IP address format");
39
39
  }
40
- var number = Number.parseInt(octet);
40
+ var number = Number.parseInt(octet, 10);
41
41
  if (Number.isNaN(number) || number < 0 || number > 255) {
42
42
  throw new Error("Invalid IP address format");
43
43
  }
@@ -50,6 +50,6 @@ var ipToBinaryString = exports.ipToBinaryString = function ipToBinaryString(ip)
50
50
  _iterator.f();
51
51
  }
52
52
  return parts.map(function (octet) {
53
- return Number.parseInt(octet).toString(2).padStart(8, "0");
53
+ return Number.parseInt(octet, 10).toString(2).padStart(8, "0");
54
54
  }).join("");
55
55
  };
@@ -24,7 +24,7 @@ var subnetMaskToCidr = exports.subnetMaskToCidr = function subnetMaskToCidr(subn
24
24
 
25
25
  // Validate each octet
26
26
  var binaryOctets = octets.map(function (octet) {
27
- var number_ = Number.parseInt(octet);
27
+ var number_ = Number.parseInt(octet, 10);
28
28
  if (Number.isNaN(number_) || number_ < 0 || number_ > 255) {
29
29
  throw new Error("Invalid subnet mask format");
30
30
  }
@@ -11,6 +11,10 @@ var _multiplication = require("@/Math/multiplication");
11
11
  var _subtract = require("@/Math/subtract");
12
12
  var _isNumber = require("@/Validate/isNumber");
13
13
  var calculatorCore = exports.calculatorCore = function calculatorCore(expression, currencyExchange) {
14
+ // Handle empty string
15
+ if (expression === "") {
16
+ return "";
17
+ }
14
18
  var sanitizedExpression = expression;
15
19
 
16
20
  // Handle signs
@@ -61,6 +65,12 @@ var calculatorCore = exports.calculatorCore = function calculatorCore(expression
61
65
 
62
66
  // Return result if no more calculations needed
63
67
  else {
68
+ var number_ = Number(sanitizedExpression);
69
+ if (!Number.isNaN(number_)) {
70
+ // Handle floating point precision issues
71
+ var rounded = Math.round(number_ * 1e10) / 1e10;
72
+ return rounded.toString();
73
+ }
64
74
  return sanitizedExpression;
65
75
  }
66
76
  }
@@ -86,7 +96,7 @@ var containsParentheses = function containsParentheses(expr) {
86
96
  };
87
97
  var resolveParentheses = function resolveParentheses(expr) {
88
98
  // Logic for calculations inside parentheses
89
- var match = expr.match(/\(\d+\.?(\d+)?([*+/-])\d+\.?(\d+)?\)/);
99
+ var match = expr.match(/\((-?\d+(?:\.\d+)?)([*+/-])(-?\d+(?:\.\d+)?)\)/);
90
100
  if (match) {
91
101
  return expr.replace(match[0], calculatorCore(match[0].replaceAll(/\(|\)/g, "")));
92
102
  }
@@ -100,20 +110,18 @@ var containsDiv = function containsDiv(expr) {
100
110
  };
101
111
  var resolveMulExp = function resolveMulExp(expr) {
102
112
  // Logic for multiplication and exponentiation
103
- var match = expr.match(/(.*?)(\d+\.?(\d+)?([*^])\d+\.?(\d+)?$)/);
113
+ var match = expr.match(/(.*?)(-?\d+(?:\.\d+)?)([*^])(-?\d+(?:\.\d+)?)$/);
104
114
  if (match) {
105
- var operands = match[2].split(/([*/^])/);
106
- var result = operands[1] === "^" ? Math.pow(Number(operands[0]), Number(operands[2])) : (0, _multiplication.multiplication)(Number(operands[0]), Number(operands[2]));
115
+ var result = match[3] === "^" ? Math.pow(Number(match[2]), Number(match[4])) : (0, _multiplication.multiplication)(Number(match[2]), Number(match[4]));
107
116
  return "".concat(match[1]).concat(result);
108
117
  }
109
118
  return Number.NaN.toString();
110
119
  };
111
120
  var resolveDiv = function resolveDiv(expr) {
112
121
  // Logic for division
113
- var match = expr.match(/\d+\.?(\d+)?(\/)\d+\.?(\d+)?/);
122
+ var match = expr.match(/(-?\d+(?:\.\d+)?)\/(-?\d+(?:\.\d+)?)/);
114
123
  if (match) {
115
- var operands = match[0].split(/(\/)/);
116
- var result = (0, _division.division)(Number(operands[0]), Number(operands[2]));
124
+ var result = (0, _division.division)(Number(match[1]), Number(match[2]));
117
125
  return expr.replace(match[0], String(result));
118
126
  }
119
127
  return Number.NaN.toString();
@@ -123,9 +131,9 @@ var containsAddSub = function containsAddSub(expr) {
123
131
  };
124
132
  var resolveAddSub = function resolveAddSub(expr) {
125
133
  // Logic for addition and subtraction
126
- var match = expr.match(/(-?\d+)\.?(\d+)?(\+|-)(-?\d+)\.?(\d+)?/);
134
+ var match = expr.match(/(-?\d+(?:\.\d+)?)(\+|-)(-?\d+(?:\.\d+)?)/);
127
135
  if (match) {
128
- var result = match[3] === "+" ? (0, _addition.addition)(Number(match[1]), Number(match[4])) : (0, _subtract.subtract)(Number(match[1]), Number(match[4]));
136
+ var result = match[2] === "+" ? (0, _addition.addition)(Number(match[1]), Number(match[3])) : (0, _subtract.subtract)(Number(match[1]), Number(match[3]));
129
137
  return expr.replace(match[0], String(result));
130
138
  }
131
139
  return Number.NaN.toString();
@@ -19,18 +19,24 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
19
19
  * @example literalExpression("3x+2=8"); // "2"
20
20
  */
21
21
  var literalExpression = exports.literalExpression = function literalExpression(x) {
22
+ // Handle invalid equations like x=x
23
+ var sides = x.split("=");
24
+ if (sides.length === 2 && sides[0] === sides[1]) {
25
+ return "";
26
+ }
27
+
22
28
  // Store numerical and variable parts of the equation
23
29
  var numericalPart = "";
24
30
  var variablePart = [];
25
31
 
26
32
  // Split by equals sign and identify numerical and variable parts
27
- var _iterator = _createForOfIteratorHelper(x.split("=")),
33
+ var _iterator = _createForOfIteratorHelper(sides),
28
34
  _step;
29
35
  try {
30
36
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
31
37
  var part = _step.value;
32
38
  if (/[A-Za-z]+/.test(part)) {
33
- variablePart = part.split(/(\d+[A-Za-z]+)|([^A-Za-z]+)/).filter(function (n) {
39
+ variablePart = part.split(/([-+]?\d*[A-Za-z]+)|([-+]?\d+)/).filter(function (n) {
34
40
  return n && n !== undefined;
35
41
  });
36
42
  } else {
@@ -45,11 +51,19 @@ var literalExpression = exports.literalExpression = function literalExpression(x
45
51
  _iterator.f();
46
52
  }
47
53
  if (variablePart[1]) {
48
- variablePart[1] = (0, _core.calculatorCore)(variablePart[1]).replaceAll("+", "plus").replaceAll("-", "minus").replaceAll("plus", "-").replaceAll("minus", "+");
54
+ // Invert signs before calculating
55
+ var invertedPart = variablePart[1].replaceAll("+", "plus").replaceAll("-", "minus").replaceAll("plus", "-").replaceAll("minus", "+");
56
+ variablePart[1] = (0, _core.calculatorCore)(invertedPart);
49
57
  }
50
58
 
51
59
  // Calculate the numerical part
52
- numericalPart = variablePart[1] ? (0, _core.calculatorCore)("".concat(numericalPart).concat(variablePart[1])) : (0, _core.calculatorCore)(numericalPart);
60
+ if (variablePart[1]) {
61
+ // Ensure proper sign handling when combining
62
+ var sign = variablePart[1].startsWith("-") ? "" : "+";
63
+ numericalPart = (0, _core.calculatorCore)("".concat(numericalPart).concat(sign).concat(variablePart[1]));
64
+ } else {
65
+ numericalPart = (0, _core.calculatorCore)(numericalPart);
66
+ }
53
67
 
54
68
  // Split the variable part again to separate coefficient and variable
55
69
  variablePart = variablePart[0].split(/(\d+)|([A-Za-z]+)/).filter(function (n) {
@@ -68,8 +82,7 @@ var literalExpression = exports.literalExpression = function literalExpression(x
68
82
  if (/(-?)\d+\/1/.test(numericalPart)) {
69
83
  return numericalPart.replace(/\/1/, "");
70
84
  }
71
- }
72
- if (variablePart[0] !== "1") {
85
+ } else if (variablePart[0] !== "1") {
73
86
  numericalPart = "".concat(numericalPart, "/").concat(variablePart[0]);
74
87
  }
75
88
  return numericalPart;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Calculate the Pearson correlation coefficient between two arrays
3
+ * @param x - First array of numbers
4
+ * @param y - Second array of numbers
5
+ * @returns Correlation coefficient (-1 to 1)
6
+ * @example
7
+ * correlationCoefficient([1, 2, 3, 4, 5], [2, 4, 6, 8, 10]); // 1 (perfect positive correlation)
8
+ * correlationCoefficient([1, 2, 3, 4, 5], [5, 4, 3, 2, 1]); // -1 (perfect negative correlation)
9
+ * correlationCoefficient([1, 2, 3, 4, 5], [1, 1, 1, 1, 1]); // 0 (no correlation)
10
+ */
11
+ export declare const correlationCoefficient: (x: number[], y: number[]) => number;
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.correlationCoefficient = void 0;
7
+ var _average = require("./average");
8
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
9
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
10
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
11
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
12
+ 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; } } }; }
13
+ 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; } }
14
+ 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; }
15
+ /**
16
+ * Calculate the Pearson correlation coefficient between two arrays
17
+ * @param x - First array of numbers
18
+ * @param y - Second array of numbers
19
+ * @returns Correlation coefficient (-1 to 1)
20
+ * @example
21
+ * correlationCoefficient([1, 2, 3, 4, 5], [2, 4, 6, 8, 10]); // 1 (perfect positive correlation)
22
+ * correlationCoefficient([1, 2, 3, 4, 5], [5, 4, 3, 2, 1]); // -1 (perfect negative correlation)
23
+ * correlationCoefficient([1, 2, 3, 4, 5], [1, 1, 1, 1, 1]); // 0 (no correlation)
24
+ */
25
+ var correlationCoefficient = exports.correlationCoefficient = function correlationCoefficient(x, y) {
26
+ if (x.length !== y.length) {
27
+ throw new Error("Arrays must have the same length");
28
+ }
29
+ if (x.length === 0) {
30
+ return Number.NaN;
31
+ }
32
+ if (x.length === 1) {
33
+ return Number.NaN;
34
+ }
35
+ var meanX = (0, _average.average)(x);
36
+ var meanY = (0, _average.average)(y);
37
+ var numerator = 0;
38
+ var sumSquaredX = 0;
39
+ var sumSquaredY = 0;
40
+ var _iterator = _createForOfIteratorHelper(x.entries()),
41
+ _step;
42
+ try {
43
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
44
+ var _step$value = _slicedToArray(_step.value, 2),
45
+ index = _step$value[0],
46
+ element = _step$value[1];
47
+ var deltaX = element - meanX;
48
+ var deltaY = y[index] - meanY;
49
+ numerator += deltaX * deltaY;
50
+ sumSquaredX += deltaX * deltaX;
51
+ sumSquaredY += deltaY * deltaY;
52
+ }
53
+ } catch (err) {
54
+ _iterator.e(err);
55
+ } finally {
56
+ _iterator.f();
57
+ }
58
+ var denominator = Math.sqrt(sumSquaredX * sumSquaredY);
59
+ if (denominator === 0) {
60
+ return Number.NaN;
61
+ }
62
+ return numerator / denominator;
63
+ };
@@ -17,7 +17,7 @@ var _getDecimalLength = require("./getDecimalLength");
17
17
  var division = exports.division = function division(x, y) {
18
18
  var isFloor = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
19
19
  if (y === 0) {
20
- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
20
+ // biome-ignore lint/suspicious/noExplicitAny: ignore
21
21
  return isFloor ? Number.NaN : [Number.NaN, Number.NaN];
22
22
  }
23
23
  var sign = Math.sign(x) * Math.sign(y);
@@ -39,12 +39,12 @@ var division = exports.division = function division(x, y) {
39
39
  var divisionResult = xInt / yInt * scalingFactor;
40
40
  if (isFloor) {
41
41
  // Apply sign to result
42
- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
42
+ // biome-ignore lint/suspicious/noExplicitAny: ignore
43
43
  return sign * divisionResult;
44
44
  }
45
45
  // When isFloor is false, calculate quotient and remainder
46
46
  var intQuotient = Math.floor(divisionResult);
47
47
  var remainder = xInt % yInt;
48
- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
48
+ // biome-ignore lint/suspicious/noExplicitAny: ignore
49
49
  return [sign * intQuotient, remainder];
50
50
  };
@@ -4,8 +4,13 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.gcd = void 0;
7
+ var _isDouble = require("@/Validate/isDouble");
7
8
  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; } } }; }
9
+ function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
10
+ 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."); }
8
11
  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; } }
12
+ function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
13
+ function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
9
14
  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
15
  /**
11
16
  * Greatest Common Divisor (GCD)
@@ -15,14 +20,47 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
15
20
  * @returns number The GCD of all input numbers
16
21
  * @example gcd(12, 18); // 6
17
22
  */
18
- var _gcd = exports.gcd = function gcd(x, y) {
19
- var copyX = Math.abs(x);
20
- var copyY = Math.abs(y);
23
+ var gcd = exports.gcd = function gcd(x, y) {
21
24
  for (var _len = arguments.length, z = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
22
25
  z[_key - 2] = arguments[_key];
23
26
  }
27
+ // Handle decimal numbers by scaling them to integers
28
+ var allNumbers = [x, y].concat(z);
29
+
30
+ // If any number is decimal, find common decimal places and scale
31
+ var hasDecimals = allNumbers.some(function (number_) {
32
+ return (0, _isDouble.isDouble)(number_, false);
33
+ });
34
+ if (hasDecimals) {
35
+ // Find maximum decimal places
36
+ var getDecimalPlaces = function getDecimalPlaces(number_) {
37
+ var string_ = number_.toString();
38
+ return string_.includes(".") ? string_.split(".")[1].length : 0;
39
+ };
40
+ var maxDecimalPlaces = Math.max.apply(Math, _toConsumableArray(allNumbers.map(function (number_) {
41
+ return getDecimalPlaces(number_);
42
+ })));
43
+ var multiplier = Math.pow(10, maxDecimalPlaces);
44
+
45
+ // Scale all numbers to integers
46
+ var scaledNumbers = allNumbers.map(function (number_) {
47
+ return Math.round(number_ * multiplier);
48
+ });
49
+ var result = _gcdInteger.apply(void 0, [scaledNumbers[0], scaledNumbers[1]].concat(_toConsumableArray(scaledNumbers.slice(2))));
50
+
51
+ // Scale back to original decimal range
52
+ return result / multiplier;
53
+ }
54
+ return _gcdInteger.apply(void 0, [x, y].concat(z));
55
+ };
56
+ var _gcdInteger = function gcdInteger(x, y) {
57
+ var copyX = Math.abs(Math.round(x));
58
+ var copyY = Math.abs(Math.round(y));
59
+ for (var _len2 = arguments.length, z = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
60
+ z[_key2 - 2] = arguments[_key2];
61
+ }
24
62
  var copyZ = z.map(function (element) {
25
- return Math.abs(element);
63
+ return Math.abs(Math.round(element));
26
64
  });
27
65
  if (copyX === 0 || copyY === 0) {
28
66
  return 0;
@@ -43,7 +81,7 @@ var _gcd = exports.gcd = function gcd(x, y) {
43
81
  try {
44
82
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
45
83
  var element = _step.value;
46
- copyX = _gcd(copyX, element);
84
+ copyX = _gcdInteger(copyX, element);
47
85
  }
48
86
  } catch (err) {
49
87
  _iterator.e(err);
@@ -2,6 +2,7 @@ export * from "./addition";
2
2
  export * from "./average";
3
3
  export * from "./bitwise";
4
4
  export * from "./calculator";
5
+ export * from "./correlationCoefficient";
5
6
  export * from "./degToRad";
6
7
  export * from "./deviationValue";
7
8
  export * from "./division";
@@ -17,11 +18,13 @@ export * from "./mathSeparator";
17
18
  export * from "./max";
18
19
  export * from "./median";
19
20
  export * from "./min";
21
+ export * from "./mode";
20
22
  export * from "./multiples";
21
23
  export * from "./multiplication";
22
24
  export * from "./nCr";
23
25
  export * from "./nHr";
24
26
  export * from "./nPr";
27
+ export * from "./percentile";
25
28
  export * from "./primeFactorization";
26
29
  export * from "./quotient";
27
30
  export * from "./radToDeg";
@@ -47,6 +47,17 @@ Object.keys(_calculator).forEach(function (key) {
47
47
  }
48
48
  });
49
49
  });
50
+ var _correlationCoefficient = require("./correlationCoefficient");
51
+ Object.keys(_correlationCoefficient).forEach(function (key) {
52
+ if (key === "default" || key === "__esModule") return;
53
+ if (key in exports && exports[key] === _correlationCoefficient[key]) return;
54
+ Object.defineProperty(exports, key, {
55
+ enumerable: true,
56
+ get: function get() {
57
+ return _correlationCoefficient[key];
58
+ }
59
+ });
60
+ });
50
61
  var _degToRad = require("./degToRad");
51
62
  Object.keys(_degToRad).forEach(function (key) {
52
63
  if (key === "default" || key === "__esModule") return;
@@ -212,6 +223,17 @@ Object.keys(_min).forEach(function (key) {
212
223
  }
213
224
  });
214
225
  });
226
+ var _mode = require("./mode");
227
+ Object.keys(_mode).forEach(function (key) {
228
+ if (key === "default" || key === "__esModule") return;
229
+ if (key in exports && exports[key] === _mode[key]) return;
230
+ Object.defineProperty(exports, key, {
231
+ enumerable: true,
232
+ get: function get() {
233
+ return _mode[key];
234
+ }
235
+ });
236
+ });
215
237
  var _multiples = require("./multiples");
216
238
  Object.keys(_multiples).forEach(function (key) {
217
239
  if (key === "default" || key === "__esModule") return;
@@ -267,6 +289,17 @@ Object.keys(_nPr).forEach(function (key) {
267
289
  }
268
290
  });
269
291
  });
292
+ var _percentile = require("./percentile");
293
+ Object.keys(_percentile).forEach(function (key) {
294
+ if (key === "default" || key === "__esModule") return;
295
+ if (key in exports && exports[key] === _percentile[key]) return;
296
+ Object.defineProperty(exports, key, {
297
+ enumerable: true,
298
+ get: function get() {
299
+ return _percentile[key];
300
+ }
301
+ });
302
+ });
270
303
  var _primeFactorization = require("./primeFactorization");
271
304
  Object.keys(_primeFactorization).forEach(function (key) {
272
305
  if (key === "default" || key === "__esModule") return;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Finds the most frequently occurring value(s) in an array
3
+ * @param array - Array of numbers to find mode for
4
+ * @returns Array of mode values (can be multiple values if there are ties)
5
+ * @example
6
+ * mode([1, 2, 2, 3, 3, 3]); // [3]
7
+ * mode([1, 2, 2, 3, 3]); // [2, 3]
8
+ * mode([1, 2, 3]); // [1, 2, 3]
9
+ */
10
+ export declare const mode: (array: number[]) => number[];
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.mode = void 0;
7
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
8
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
9
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
10
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
11
+ 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; } } }; }
12
+ 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; } }
13
+ 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; }
14
+ /**
15
+ * Finds the most frequently occurring value(s) in an array
16
+ * @param array - Array of numbers to find mode for
17
+ * @returns Array of mode values (can be multiple values if there are ties)
18
+ * @example
19
+ * mode([1, 2, 2, 3, 3, 3]); // [3]
20
+ * mode([1, 2, 2, 3, 3]); // [2, 3]
21
+ * mode([1, 2, 3]); // [1, 2, 3]
22
+ */
23
+ var mode = exports.mode = function mode(array) {
24
+ if (array.length === 0) {
25
+ return [];
26
+ }
27
+ var frequency = new Map();
28
+ var maxFrequency = 0;
29
+
30
+ // Count frequencies
31
+ var _iterator = _createForOfIteratorHelper(array),
32
+ _step;
33
+ try {
34
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
35
+ var value = _step.value;
36
+ var count = (frequency.get(value) || 0) + 1;
37
+ frequency.set(value, count);
38
+ maxFrequency = Math.max(maxFrequency, count);
39
+ }
40
+
41
+ // Find all values with maximum frequency
42
+ } catch (err) {
43
+ _iterator.e(err);
44
+ } finally {
45
+ _iterator.f();
46
+ }
47
+ var modes = [];
48
+ var _iterator2 = _createForOfIteratorHelper(frequency),
49
+ _step2;
50
+ try {
51
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
52
+ var _step2$value = _slicedToArray(_step2.value, 2),
53
+ _value = _step2$value[0],
54
+ _count = _step2$value[1];
55
+ if (_count === maxFrequency) {
56
+ modes.push(_value);
57
+ }
58
+ }
59
+ } catch (err) {
60
+ _iterator2.e(err);
61
+ } finally {
62
+ _iterator2.f();
63
+ }
64
+ return modes.sort(function (a, b) {
65
+ return a - b;
66
+ });
67
+ };