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,241 @@
1
+ /**
2
+ * A priority queue implementation using a binary heap.
3
+ * Higher priority values are dequeued first.
4
+ *
5
+ * ## Features
6
+ * - **enqueue(value, priority)**: Add element with priority
7
+ * - **enqueueBack(value)**: Add element to the back with lowest priority
8
+ * - **dequeue()**: Remove and return highest priority element
9
+ * - **peek()**: View highest priority element without removing
10
+ * - **peekPriority()**: View highest priority value
11
+ * - **size**: Get number of elements
12
+ * - **isEmpty**: Check if queue is empty
13
+ * - **clear()**: Remove all elements
14
+ * - **toArray()**: Get all elements as array
15
+ * - **toArrayWithPriorities()**: Get all elements with priorities
16
+ *
17
+ * ## Time Complexity
18
+ * - enqueue: O(log n)
19
+ * - enqueueBack: O(log n)
20
+ * - dequeue: O(log n)
21
+ * - peek: O(1)
22
+ * - peekPriority: O(1)
23
+ *
24
+ * @example
25
+ * ```typescript
26
+ * const queue = new PriorityQueue<string>();
27
+ * queue.enqueue("low", 1);
28
+ * queue.enqueue("high", 3);
29
+ * queue.enqueue("medium", 2);
30
+ *
31
+ * console.log(queue.dequeue()); // "high"
32
+ * console.log(queue.dequeue()); // "medium"
33
+ * console.log(queue.dequeue()); // "low"
34
+ * ```
35
+ *
36
+ * @example
37
+ * ```typescript
38
+ * // Initialize with elements
39
+ * const queue = new PriorityQueue([
40
+ * { value: "task1", priority: 1 },
41
+ * { value: "task2", priority: 3 },
42
+ * { value: "task3", priority: 2 }
43
+ * ]);
44
+ *
45
+ * console.log(queue.peek()); // "task2"
46
+ * console.log(queue.peekPriority()); // 3
47
+ * ```
48
+ *
49
+ * @template T - The type of elements stored in the queue
50
+ */
51
+ export declare class PriorityQueue<T> {
52
+ private heap;
53
+ private minPriority;
54
+ /**
55
+ * Creates a new PriorityQueue instance.
56
+ * @param initialElements - Optional array of initial elements with priorities
57
+ * @example
58
+ * ```typescript
59
+ * const queue = new PriorityQueue<string>();
60
+ * // or
61
+ * const queue = new PriorityQueue([
62
+ * { value: "item1", priority: 10 },
63
+ * { value: "item2", priority: 5 }
64
+ * ]);
65
+ * ```
66
+ */
67
+ constructor(initialElements?: Array<{
68
+ value: T;
69
+ priority: number;
70
+ }>);
71
+ /**
72
+ * Returns the number of elements in the queue.
73
+ * @returns The number of elements in the queue
74
+ * @example
75
+ * ```typescript
76
+ * const queue = new PriorityQueue<string>();
77
+ * queue.enqueue("item", 1);
78
+ * console.log(queue.size); // 1
79
+ * ```
80
+ */
81
+ get size(): number;
82
+ /**
83
+ * Checks if the queue is empty.
84
+ * @returns True if the queue is empty, false otherwise
85
+ * @example
86
+ * ```typescript
87
+ * const queue = new PriorityQueue<string>();
88
+ * console.log(queue.isEmpty); // true
89
+ * queue.enqueue("item", 1);
90
+ * console.log(queue.isEmpty); // false
91
+ * ```
92
+ */
93
+ get isEmpty(): boolean;
94
+ /**
95
+ * Adds an element to the queue with a specified priority.
96
+ * Higher priority values are dequeued first.
97
+ * @param value - The value to add
98
+ * @param priority - The priority value (higher values have higher priority)
99
+ * @example
100
+ * ```typescript
101
+ * const queue = new PriorityQueue<string>();
102
+ * queue.enqueue("low", 1);
103
+ * queue.enqueue("high", 10);
104
+ * queue.enqueue("medium", 5);
105
+ * console.log(queue.dequeue()); // "high"
106
+ * ```
107
+ */
108
+ enqueue(value: T, priority: number): void;
109
+ /**
110
+ * Adds an element to the end of the queue with lowest priority.
111
+ * This element will be dequeued last (FIFO for equal lowest priority).
112
+ *
113
+ * @param value - The value to add
114
+ * @example
115
+ * ```typescript
116
+ * const queue = new PriorityQueue<string>();
117
+ * queue.enqueue("high", 10);
118
+ * queue.enqueue("medium", 5);
119
+ * queue.enqueueBack("back1");
120
+ * queue.enqueueBack("back2");
121
+ * console.log(queue.dequeue()); // "high"
122
+ * console.log(queue.dequeue()); // "medium"
123
+ * console.log(queue.dequeue()); // "back1"
124
+ * console.log(queue.dequeue()); // "back2"
125
+ * ```
126
+ */
127
+ enqueueBack(value: T): void;
128
+ /**
129
+ * Removes and returns the element with the highest priority.
130
+ * @returns The element with highest priority, or undefined if queue is empty
131
+ * @example
132
+ * ```typescript
133
+ * const queue = new PriorityQueue<string>();
134
+ * queue.enqueue("low", 1);
135
+ * queue.enqueue("high", 10);
136
+ * console.log(queue.dequeue()); // "high"
137
+ * console.log(queue.dequeue()); // "low"
138
+ * console.log(queue.dequeue()); // undefined
139
+ * ```
140
+ */
141
+ dequeue(): T | undefined;
142
+ /**
143
+ * Returns the element with the highest priority without removing it.
144
+ * @returns The element with highest priority, or undefined if queue is empty
145
+ * @example
146
+ * ```typescript
147
+ * const queue = new PriorityQueue<string>();
148
+ * queue.enqueue("low", 1);
149
+ * queue.enqueue("high", 10);
150
+ * console.log(queue.peek()); // "high"
151
+ * console.log(queue.size); // 2 (element not removed)
152
+ * ```
153
+ */
154
+ peek(): T | undefined;
155
+ /**
156
+ * Returns the priority of the element with the highest priority.
157
+ * @returns The highest priority value, or undefined if queue is empty
158
+ * @example
159
+ * ```typescript
160
+ * const queue = new PriorityQueue<string>();
161
+ * queue.enqueue("low", 1);
162
+ * queue.enqueue("high", 10);
163
+ * console.log(queue.peekPriority()); // 10
164
+ * ```
165
+ */
166
+ peekPriority(): number | undefined;
167
+ /**
168
+ * Removes all elements from the queue.
169
+ * @example
170
+ * ```typescript
171
+ * const queue = new PriorityQueue<string>();
172
+ * queue.enqueue("item1", 1);
173
+ * queue.enqueue("item2", 2);
174
+ * console.log(queue.size); // 2
175
+ * queue.clear();
176
+ * console.log(queue.size); // 0
177
+ * console.log(queue.isEmpty); // true
178
+ * ```
179
+ */
180
+ clear(): void;
181
+ /**
182
+ * Returns an array of all elements in the queue (without removing them).
183
+ * The order is not guaranteed to be sorted by priority.
184
+ * @returns Array of all elements in the queue
185
+ * @example
186
+ * ```typescript
187
+ * const queue = new PriorityQueue<string>();
188
+ * queue.enqueue("low", 1);
189
+ * queue.enqueue("high", 10);
190
+ * queue.enqueue("medium", 5);
191
+ * console.log(queue.toArray()); // ["high", "medium", "low"] (order may vary)
192
+ * ```
193
+ */
194
+ toArray(): T[];
195
+ /**
196
+ * Returns an array of all elements with their priorities.
197
+ * The order is not guaranteed to be sorted by priority.
198
+ * @returns Array of all elements with their priorities
199
+ * @example
200
+ * ```typescript
201
+ * const queue = new PriorityQueue<string>();
202
+ * queue.enqueue("low", 1);
203
+ * queue.enqueue("high", 10);
204
+ * console.log(queue.toArrayWithPriorities());
205
+ * // [{ value: "high", priority: 10 }, { value: "low", priority: 1 }] (order may vary)
206
+ * ```
207
+ */
208
+ toArrayWithPriorities(): Array<{
209
+ value: T;
210
+ priority: number;
211
+ }>;
212
+ /**
213
+ * Updates the minimum priority when adding elements.
214
+ * @param priority - The priority being added
215
+ */
216
+ private updateMinPriorityOnAdd;
217
+ /**
218
+ * Updates the minimum priority from all elements (used in constructor).
219
+ */
220
+ private updateMinPriority;
221
+ /**
222
+ * Builds a max heap from the current heap array.
223
+ */
224
+ private buildHeap;
225
+ /**
226
+ * Moves an element up the heap to maintain heap property.
227
+ * @param index - The index of the element to move up
228
+ */
229
+ private heapifyUp;
230
+ /**
231
+ * Moves an element down the heap to maintain heap property.
232
+ * @param index - The index of the element to move down
233
+ */
234
+ private heapifyDown;
235
+ /**
236
+ * Swaps two elements in the heap.
237
+ * @param i - First index
238
+ * @param j - Second index
239
+ */
240
+ private swap;
241
+ }
@@ -0,0 +1,405 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.PriorityQueue = void 0;
7
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
8
+ function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
9
+ 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."); }
10
+ 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; } }
11
+ function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
12
+ function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
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
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
15
+ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
16
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
17
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
18
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
19
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
20
+ /**
21
+ * A priority queue implementation using a binary heap.
22
+ * Higher priority values are dequeued first.
23
+ *
24
+ * ## Features
25
+ * - **enqueue(value, priority)**: Add element with priority
26
+ * - **enqueueBack(value)**: Add element to the back with lowest priority
27
+ * - **dequeue()**: Remove and return highest priority element
28
+ * - **peek()**: View highest priority element without removing
29
+ * - **peekPriority()**: View highest priority value
30
+ * - **size**: Get number of elements
31
+ * - **isEmpty**: Check if queue is empty
32
+ * - **clear()**: Remove all elements
33
+ * - **toArray()**: Get all elements as array
34
+ * - **toArrayWithPriorities()**: Get all elements with priorities
35
+ *
36
+ * ## Time Complexity
37
+ * - enqueue: O(log n)
38
+ * - enqueueBack: O(log n)
39
+ * - dequeue: O(log n)
40
+ * - peek: O(1)
41
+ * - peekPriority: O(1)
42
+ *
43
+ * @example
44
+ * ```typescript
45
+ * const queue = new PriorityQueue<string>();
46
+ * queue.enqueue("low", 1);
47
+ * queue.enqueue("high", 3);
48
+ * queue.enqueue("medium", 2);
49
+ *
50
+ * console.log(queue.dequeue()); // "high"
51
+ * console.log(queue.dequeue()); // "medium"
52
+ * console.log(queue.dequeue()); // "low"
53
+ * ```
54
+ *
55
+ * @example
56
+ * ```typescript
57
+ * // Initialize with elements
58
+ * const queue = new PriorityQueue([
59
+ * { value: "task1", priority: 1 },
60
+ * { value: "task2", priority: 3 },
61
+ * { value: "task3", priority: 2 }
62
+ * ]);
63
+ *
64
+ * console.log(queue.peek()); // "task2"
65
+ * console.log(queue.peekPriority()); // 3
66
+ * ```
67
+ *
68
+ * @template T - The type of elements stored in the queue
69
+ */
70
+ var PriorityQueue = exports.PriorityQueue = /*#__PURE__*/function () {
71
+ /**
72
+ * Creates a new PriorityQueue instance.
73
+ * @param initialElements - Optional array of initial elements with priorities
74
+ * @example
75
+ * ```typescript
76
+ * const queue = new PriorityQueue<string>();
77
+ * // or
78
+ * const queue = new PriorityQueue([
79
+ * { value: "item1", priority: 10 },
80
+ * { value: "item2", priority: 5 }
81
+ * ]);
82
+ * ```
83
+ */
84
+ function PriorityQueue(initialElements) {
85
+ _classCallCheck(this, PriorityQueue);
86
+ _defineProperty(this, "heap", []);
87
+ _defineProperty(this, "minPriority", 0);
88
+ if (initialElements) {
89
+ this.heap = _toConsumableArray(initialElements);
90
+ this.updateMinPriority();
91
+ this.buildHeap();
92
+ }
93
+ }
94
+
95
+ /**
96
+ * Returns the number of elements in the queue.
97
+ * @returns The number of elements in the queue
98
+ * @example
99
+ * ```typescript
100
+ * const queue = new PriorityQueue<string>();
101
+ * queue.enqueue("item", 1);
102
+ * console.log(queue.size); // 1
103
+ * ```
104
+ */
105
+ return _createClass(PriorityQueue, [{
106
+ key: "size",
107
+ get: function get() {
108
+ return this.heap.length;
109
+ }
110
+
111
+ /**
112
+ * Checks if the queue is empty.
113
+ * @returns True if the queue is empty, false otherwise
114
+ * @example
115
+ * ```typescript
116
+ * const queue = new PriorityQueue<string>();
117
+ * console.log(queue.isEmpty); // true
118
+ * queue.enqueue("item", 1);
119
+ * console.log(queue.isEmpty); // false
120
+ * ```
121
+ */
122
+ }, {
123
+ key: "isEmpty",
124
+ get: function get() {
125
+ return this.heap.length === 0;
126
+ }
127
+
128
+ /**
129
+ * Adds an element to the queue with a specified priority.
130
+ * Higher priority values are dequeued first.
131
+ * @param value - The value to add
132
+ * @param priority - The priority value (higher values have higher priority)
133
+ * @example
134
+ * ```typescript
135
+ * const queue = new PriorityQueue<string>();
136
+ * queue.enqueue("low", 1);
137
+ * queue.enqueue("high", 10);
138
+ * queue.enqueue("medium", 5);
139
+ * console.log(queue.dequeue()); // "high"
140
+ * ```
141
+ */
142
+ }, {
143
+ key: "enqueue",
144
+ value: function enqueue(value, priority) {
145
+ this.heap.push({
146
+ value: value,
147
+ priority: priority
148
+ });
149
+ this.updateMinPriorityOnAdd(priority);
150
+ this.heapifyUp(this.heap.length - 1);
151
+ }
152
+
153
+ /**
154
+ * Adds an element to the end of the queue with lowest priority.
155
+ * This element will be dequeued last (FIFO for equal lowest priority).
156
+ *
157
+ * @param value - The value to add
158
+ * @example
159
+ * ```typescript
160
+ * const queue = new PriorityQueue<string>();
161
+ * queue.enqueue("high", 10);
162
+ * queue.enqueue("medium", 5);
163
+ * queue.enqueueBack("back1");
164
+ * queue.enqueueBack("back2");
165
+ * console.log(queue.dequeue()); // "high"
166
+ * console.log(queue.dequeue()); // "medium"
167
+ * console.log(queue.dequeue()); // "back1"
168
+ * console.log(queue.dequeue()); // "back2"
169
+ * ```
170
+ */
171
+ }, {
172
+ key: "enqueueBack",
173
+ value: function enqueueBack(value) {
174
+ var newPriority = this.minPriority - 1;
175
+ this.heap.push({
176
+ value: value,
177
+ priority: newPriority
178
+ });
179
+ this.minPriority = newPriority;
180
+ this.heapifyUp(this.heap.length - 1);
181
+ }
182
+
183
+ /**
184
+ * Removes and returns the element with the highest priority.
185
+ * @returns The element with highest priority, or undefined if queue is empty
186
+ * @example
187
+ * ```typescript
188
+ * const queue = new PriorityQueue<string>();
189
+ * queue.enqueue("low", 1);
190
+ * queue.enqueue("high", 10);
191
+ * console.log(queue.dequeue()); // "high"
192
+ * console.log(queue.dequeue()); // "low"
193
+ * console.log(queue.dequeue()); // undefined
194
+ * ```
195
+ */
196
+ }, {
197
+ key: "dequeue",
198
+ value: function dequeue() {
199
+ if (this.heap.length === 0) {
200
+ return;
201
+ }
202
+ if (this.heap.length === 1) {
203
+ var _this$heap$pop;
204
+ return (_this$heap$pop = this.heap.pop()) === null || _this$heap$pop === void 0 ? void 0 : _this$heap$pop.value;
205
+ }
206
+ var result = this.heap[0].value;
207
+ // biome-ignore lint/style/noNonNullAssertion: pop() cannot return undefined when heap.length > 1
208
+ this.heap[0] = this.heap.pop();
209
+ this.heapifyDown(0);
210
+ return result;
211
+ }
212
+
213
+ /**
214
+ * Returns the element with the highest priority without removing it.
215
+ * @returns The element with highest priority, or undefined if queue is empty
216
+ * @example
217
+ * ```typescript
218
+ * const queue = new PriorityQueue<string>();
219
+ * queue.enqueue("low", 1);
220
+ * queue.enqueue("high", 10);
221
+ * console.log(queue.peek()); // "high"
222
+ * console.log(queue.size); // 2 (element not removed)
223
+ * ```
224
+ */
225
+ }, {
226
+ key: "peek",
227
+ value: function peek() {
228
+ var _this$heap$;
229
+ return (_this$heap$ = this.heap[0]) === null || _this$heap$ === void 0 ? void 0 : _this$heap$.value;
230
+ }
231
+
232
+ /**
233
+ * Returns the priority of the element with the highest priority.
234
+ * @returns The highest priority value, or undefined if queue is empty
235
+ * @example
236
+ * ```typescript
237
+ * const queue = new PriorityQueue<string>();
238
+ * queue.enqueue("low", 1);
239
+ * queue.enqueue("high", 10);
240
+ * console.log(queue.peekPriority()); // 10
241
+ * ```
242
+ */
243
+ }, {
244
+ key: "peekPriority",
245
+ value: function peekPriority() {
246
+ var _this$heap$2;
247
+ return (_this$heap$2 = this.heap[0]) === null || _this$heap$2 === void 0 ? void 0 : _this$heap$2.priority;
248
+ }
249
+
250
+ /**
251
+ * Removes all elements from the queue.
252
+ * @example
253
+ * ```typescript
254
+ * const queue = new PriorityQueue<string>();
255
+ * queue.enqueue("item1", 1);
256
+ * queue.enqueue("item2", 2);
257
+ * console.log(queue.size); // 2
258
+ * queue.clear();
259
+ * console.log(queue.size); // 0
260
+ * console.log(queue.isEmpty); // true
261
+ * ```
262
+ */
263
+ }, {
264
+ key: "clear",
265
+ value: function clear() {
266
+ this.heap = [];
267
+ this.minPriority = 0;
268
+ }
269
+
270
+ /**
271
+ * Returns an array of all elements in the queue (without removing them).
272
+ * The order is not guaranteed to be sorted by priority.
273
+ * @returns Array of all elements in the queue
274
+ * @example
275
+ * ```typescript
276
+ * const queue = new PriorityQueue<string>();
277
+ * queue.enqueue("low", 1);
278
+ * queue.enqueue("high", 10);
279
+ * queue.enqueue("medium", 5);
280
+ * console.log(queue.toArray()); // ["high", "medium", "low"] (order may vary)
281
+ * ```
282
+ */
283
+ }, {
284
+ key: "toArray",
285
+ value: function toArray() {
286
+ return this.heap.map(function (item) {
287
+ return item.value;
288
+ });
289
+ }
290
+
291
+ /**
292
+ * Returns an array of all elements with their priorities.
293
+ * The order is not guaranteed to be sorted by priority.
294
+ * @returns Array of all elements with their priorities
295
+ * @example
296
+ * ```typescript
297
+ * const queue = new PriorityQueue<string>();
298
+ * queue.enqueue("low", 1);
299
+ * queue.enqueue("high", 10);
300
+ * console.log(queue.toArrayWithPriorities());
301
+ * // [{ value: "high", priority: 10 }, { value: "low", priority: 1 }] (order may vary)
302
+ * ```
303
+ */
304
+ }, {
305
+ key: "toArrayWithPriorities",
306
+ value: function toArrayWithPriorities() {
307
+ return _toConsumableArray(this.heap);
308
+ }
309
+
310
+ /**
311
+ * Updates the minimum priority when adding elements.
312
+ * @param priority - The priority being added
313
+ */
314
+ }, {
315
+ key: "updateMinPriorityOnAdd",
316
+ value: function updateMinPriorityOnAdd(priority) {
317
+ if (this.heap.length === 1 || priority < this.minPriority) {
318
+ this.minPriority = priority;
319
+ }
320
+ }
321
+
322
+ /**
323
+ * Updates the minimum priority from all elements (used in constructor).
324
+ */
325
+ }, {
326
+ key: "updateMinPriority",
327
+ value: function updateMinPriority() {
328
+ if (this.heap.length === 0) {
329
+ this.minPriority = 0;
330
+ return;
331
+ }
332
+ this.minPriority = Math.min.apply(Math, _toConsumableArray(this.heap.map(function (item) {
333
+ return item.priority;
334
+ })));
335
+ }
336
+
337
+ /**
338
+ * Builds a max heap from the current heap array.
339
+ */
340
+ }, {
341
+ key: "buildHeap",
342
+ value: function buildHeap() {
343
+ for (var index = Math.floor(this.heap.length / 2) - 1; index >= 0; index--) {
344
+ this.heapifyDown(index);
345
+ }
346
+ }
347
+
348
+ /**
349
+ * Moves an element up the heap to maintain heap property.
350
+ * @param index - The index of the element to move up
351
+ */
352
+ }, {
353
+ key: "heapifyUp",
354
+ value: function heapifyUp(index) {
355
+ var currentIndex = index;
356
+ while (currentIndex > 0) {
357
+ var parentIndex = Math.floor((currentIndex - 1) / 2);
358
+ if (this.heap[currentIndex].priority <= this.heap[parentIndex].priority) {
359
+ break;
360
+ }
361
+ this.swap(currentIndex, parentIndex);
362
+ currentIndex = parentIndex;
363
+ }
364
+ }
365
+
366
+ /**
367
+ * Moves an element down the heap to maintain heap property.
368
+ * @param index - The index of the element to move down
369
+ */
370
+ }, {
371
+ key: "heapifyDown",
372
+ value: function heapifyDown(index) {
373
+ var currentIndex = index;
374
+ while (true) {
375
+ var leftChild = 2 * currentIndex + 1;
376
+ var rightChild = 2 * currentIndex + 2;
377
+ var largest = currentIndex;
378
+ if (leftChild < this.heap.length && this.heap[leftChild].priority > this.heap[largest].priority) {
379
+ largest = leftChild;
380
+ }
381
+ if (rightChild < this.heap.length && this.heap[rightChild].priority > this.heap[largest].priority) {
382
+ largest = rightChild;
383
+ }
384
+ if (largest === currentIndex) {
385
+ break;
386
+ }
387
+ this.swap(currentIndex, largest);
388
+ currentIndex = largest;
389
+ }
390
+ }
391
+
392
+ /**
393
+ * Swaps two elements in the heap.
394
+ * @param i - First index
395
+ * @param j - Second index
396
+ */
397
+ }, {
398
+ key: "swap",
399
+ value: function swap(index, index_) {
400
+ var _ref = [this.heap[index_], this.heap[index]];
401
+ this.heap[index] = _ref[0];
402
+ this.heap[index_] = _ref[1];
403
+ }
404
+ }]);
405
+ }();
@@ -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;