@fluixi/utils 1.0.0-alpha.53

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 (354) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +73 -0
  3. package/dist/index.cjs +1 -0
  4. package/dist/index.d.ts +2 -0
  5. package/dist/index.d.ts.map +1 -0
  6. package/dist/index.js +1 -0
  7. package/dist/index.mjs +1 -0
  8. package/dist/lib/array/advanced.cjs +1 -0
  9. package/dist/lib/array/advanced.d.ts +1116 -0
  10. package/dist/lib/array/advanced.d.ts.map +1 -0
  11. package/dist/lib/array/advanced.js +2429 -0
  12. package/dist/lib/array/advanced.mjs +1 -0
  13. package/dist/lib/array/array.cjs +1 -0
  14. package/dist/lib/array/array.d.ts +6 -0
  15. package/dist/lib/array/array.d.ts.map +1 -0
  16. package/dist/lib/array/array.js +31 -0
  17. package/dist/lib/array/array.mjs +1 -0
  18. package/dist/lib/array/index.cjs +1 -0
  19. package/dist/lib/array/index.d.ts +4 -0
  20. package/dist/lib/array/index.d.ts.map +1 -0
  21. package/dist/lib/array/index.js +3 -0
  22. package/dist/lib/array/index.mjs +1 -0
  23. package/dist/lib/array/utils.cjs +1 -0
  24. package/dist/lib/array/utils.d.ts +100 -0
  25. package/dist/lib/array/utils.d.ts.map +1 -0
  26. package/dist/lib/array/utils.js +165 -0
  27. package/dist/lib/array/utils.mjs +1 -0
  28. package/dist/lib/color/color.cjs +1 -0
  29. package/dist/lib/color/color.d.ts +366 -0
  30. package/dist/lib/color/color.d.ts.map +1 -0
  31. package/dist/lib/color/color.js +722 -0
  32. package/dist/lib/color/color.mjs +1 -0
  33. package/dist/lib/color/constants.cjs +1 -0
  34. package/dist/lib/color/constants.d.ts +361 -0
  35. package/dist/lib/color/constants.d.ts.map +1 -0
  36. package/dist/lib/color/constants.js +358 -0
  37. package/dist/lib/color/constants.mjs +1 -0
  38. package/dist/lib/color/conversions.cjs +1 -0
  39. package/dist/lib/color/conversions.d.ts +166 -0
  40. package/dist/lib/color/conversions.d.ts.map +1 -0
  41. package/dist/lib/color/conversions.js +766 -0
  42. package/dist/lib/color/conversions.mjs +1 -0
  43. package/dist/lib/color/helpers.cjs +1 -0
  44. package/dist/lib/color/helpers.d.ts +75 -0
  45. package/dist/lib/color/helpers.d.ts.map +1 -0
  46. package/dist/lib/color/helpers.js +419 -0
  47. package/dist/lib/color/helpers.mjs +1 -0
  48. package/dist/lib/color/index.cjs +1 -0
  49. package/dist/lib/color/index.d.ts +12 -0
  50. package/dist/lib/color/index.d.ts.map +1 -0
  51. package/dist/lib/color/index.js +15 -0
  52. package/dist/lib/color/index.mjs +1 -0
  53. package/dist/lib/color/types.cjs +1 -0
  54. package/dist/lib/color/types.d.ts +179 -0
  55. package/dist/lib/color/types.d.ts.map +1 -0
  56. package/dist/lib/color/types.js +1 -0
  57. package/dist/lib/color/types.mjs +0 -0
  58. package/dist/lib/color/utils.cjs +1 -0
  59. package/dist/lib/color/utils.d.ts +199 -0
  60. package/dist/lib/color/utils.d.ts.map +1 -0
  61. package/dist/lib/color/utils.js +858 -0
  62. package/dist/lib/color/utils.mjs +1 -0
  63. package/dist/lib/compare/comparators.cjs +1 -0
  64. package/dist/lib/compare/comparators.d.ts +65 -0
  65. package/dist/lib/compare/comparators.d.ts.map +1 -0
  66. package/dist/lib/compare/comparators.js +210 -0
  67. package/dist/lib/compare/comparators.mjs +1 -0
  68. package/dist/lib/compare/index.cjs +1 -0
  69. package/dist/lib/compare/index.d.ts +2 -0
  70. package/dist/lib/compare/index.d.ts.map +1 -0
  71. package/dist/lib/compare/index.js +1 -0
  72. package/dist/lib/compare/index.mjs +1 -0
  73. package/dist/lib/crypto/hash.cjs +1 -0
  74. package/dist/lib/crypto/hash.d.ts +6 -0
  75. package/dist/lib/crypto/hash.d.ts.map +1 -0
  76. package/dist/lib/crypto/hash.js +53 -0
  77. package/dist/lib/crypto/hash.mjs +1 -0
  78. package/dist/lib/crypto/index.cjs +1 -0
  79. package/dist/lib/crypto/index.d.ts +2 -0
  80. package/dist/lib/crypto/index.d.ts.map +1 -0
  81. package/dist/lib/crypto/index.js +1 -0
  82. package/dist/lib/crypto/index.mjs +1 -0
  83. package/dist/lib/dom/events.cjs +1 -0
  84. package/dist/lib/dom/events.d.ts +159 -0
  85. package/dist/lib/dom/events.d.ts.map +1 -0
  86. package/dist/lib/dom/events.js +50 -0
  87. package/dist/lib/dom/events.mjs +1 -0
  88. package/dist/lib/dom/index.cjs +1 -0
  89. package/dist/lib/dom/index.d.ts +3 -0
  90. package/dist/lib/dom/index.d.ts.map +1 -0
  91. package/dist/lib/dom/index.js +2 -0
  92. package/dist/lib/dom/index.mjs +1 -0
  93. package/dist/lib/dom/utils.cjs +1 -0
  94. package/dist/lib/dom/utils.d.ts +6 -0
  95. package/dist/lib/dom/utils.d.ts.map +1 -0
  96. package/dist/lib/dom/utils.js +37 -0
  97. package/dist/lib/dom/utils.mjs +1 -0
  98. package/dist/lib/functions/functions.cjs +1 -0
  99. package/dist/lib/functions/functions.d.ts +329 -0
  100. package/dist/lib/functions/functions.d.ts.map +1 -0
  101. package/dist/lib/functions/functions.js +585 -0
  102. package/dist/lib/functions/functions.mjs +1 -0
  103. package/dist/lib/functions/index.cjs +1 -0
  104. package/dist/lib/functions/index.d.ts +3 -0
  105. package/dist/lib/functions/index.d.ts.map +1 -0
  106. package/dist/lib/functions/index.js +1 -0
  107. package/dist/lib/functions/index.mjs +1 -0
  108. package/dist/lib/functions/types.cjs +1 -0
  109. package/dist/lib/functions/types.d.ts +2 -0
  110. package/dist/lib/functions/types.d.ts.map +1 -0
  111. package/dist/lib/functions/types.js +1 -0
  112. package/dist/lib/functions/types.mjs +0 -0
  113. package/dist/lib/helpers.cjs +1 -0
  114. package/dist/lib/helpers.d.ts +13 -0
  115. package/dist/lib/helpers.d.ts.map +1 -0
  116. package/dist/lib/helpers.js +66 -0
  117. package/dist/lib/helpers.mjs +1 -0
  118. package/dist/lib/index.cjs +1 -0
  119. package/dist/lib/index.d.ts +6 -0
  120. package/dist/lib/index.d.ts.map +1 -0
  121. package/dist/lib/index.js +8 -0
  122. package/dist/lib/index.mjs +1 -0
  123. package/dist/lib/maths/constants.cjs +1 -0
  124. package/dist/lib/maths/constants.d.ts +84 -0
  125. package/dist/lib/maths/constants.d.ts.map +1 -0
  126. package/dist/lib/maths/constants.js +79 -0
  127. package/dist/lib/maths/constants.mjs +1 -0
  128. package/dist/lib/maths/fn/advanced.cjs +1 -0
  129. package/dist/lib/maths/fn/advanced.d.ts +149 -0
  130. package/dist/lib/maths/fn/advanced.d.ts.map +1 -0
  131. package/dist/lib/maths/fn/advanced.js +264 -0
  132. package/dist/lib/maths/fn/advanced.mjs +1 -0
  133. package/dist/lib/maths/fn/basic.cjs +1 -0
  134. package/dist/lib/maths/fn/basic.d.ts +182 -0
  135. package/dist/lib/maths/fn/basic.d.ts.map +1 -0
  136. package/dist/lib/maths/fn/basic.js +343 -0
  137. package/dist/lib/maths/fn/basic.mjs +1 -0
  138. package/dist/lib/maths/fn/complex.cjs +1 -0
  139. package/dist/lib/maths/fn/complex.d.ts +153 -0
  140. package/dist/lib/maths/fn/complex.d.ts.map +1 -0
  141. package/dist/lib/maths/fn/complex.js +383 -0
  142. package/dist/lib/maths/fn/complex.mjs +1 -0
  143. package/dist/lib/maths/fn/index.cjs +1 -0
  144. package/dist/lib/maths/fn/index.d.ts +10 -0
  145. package/dist/lib/maths/fn/index.d.ts.map +1 -0
  146. package/dist/lib/maths/fn/index.js +9 -0
  147. package/dist/lib/maths/fn/index.mjs +1 -0
  148. package/dist/lib/maths/fn/trigo.cjs +1 -0
  149. package/dist/lib/maths/fn/trigo.d.ts +147 -0
  150. package/dist/lib/maths/fn/trigo.d.ts.map +1 -0
  151. package/dist/lib/maths/fn/trigo.js +227 -0
  152. package/dist/lib/maths/fn/trigo.mjs +1 -0
  153. package/dist/lib/maths/fn/vector.cjs +1 -0
  154. package/dist/lib/maths/fn/vector.d.ts +512 -0
  155. package/dist/lib/maths/fn/vector.d.ts.map +1 -0
  156. package/dist/lib/maths/fn/vector.js +1136 -0
  157. package/dist/lib/maths/fn/vector.mjs +1 -0
  158. package/dist/lib/maths/formatter.cjs +1 -0
  159. package/dist/lib/maths/formatter.d.ts +35 -0
  160. package/dist/lib/maths/formatter.d.ts.map +1 -0
  161. package/dist/lib/maths/formatter.js +56 -0
  162. package/dist/lib/maths/formatter.mjs +1 -0
  163. package/dist/lib/maths/guards.cjs +1 -0
  164. package/dist/lib/maths/guards.d.ts +166 -0
  165. package/dist/lib/maths/guards.d.ts.map +1 -0
  166. package/dist/lib/maths/guards.js +315 -0
  167. package/dist/lib/maths/guards.mjs +1 -0
  168. package/dist/lib/maths/index.cjs +1 -0
  169. package/dist/lib/maths/index.d.ts +24 -0
  170. package/dist/lib/maths/index.d.ts.map +1 -0
  171. package/dist/lib/maths/index.js +29 -0
  172. package/dist/lib/maths/index.mjs +1 -0
  173. package/dist/lib/maths/parser.cjs +1 -0
  174. package/dist/lib/maths/parser.d.ts +20 -0
  175. package/dist/lib/maths/parser.d.ts.map +1 -0
  176. package/dist/lib/maths/parser.js +78 -0
  177. package/dist/lib/maths/parser.mjs +1 -0
  178. package/dist/lib/maths/random.cjs +1 -0
  179. package/dist/lib/maths/random.d.ts +27 -0
  180. package/dist/lib/maths/random.d.ts.map +1 -0
  181. package/dist/lib/maths/random.js +49 -0
  182. package/dist/lib/maths/random.mjs +1 -0
  183. package/dist/lib/maths/types/advanced.cjs +1 -0
  184. package/dist/lib/maths/types/advanced.d.ts +357 -0
  185. package/dist/lib/maths/types/advanced.d.ts.map +1 -0
  186. package/dist/lib/maths/types/advanced.js +5 -0
  187. package/dist/lib/maths/types/advanced.mjs +0 -0
  188. package/dist/lib/maths/types/basic.cjs +1 -0
  189. package/dist/lib/maths/types/basic.d.ts +95 -0
  190. package/dist/lib/maths/types/basic.d.ts.map +1 -0
  191. package/dist/lib/maths/types/basic.js +5 -0
  192. package/dist/lib/maths/types/basic.mjs +0 -0
  193. package/dist/lib/maths/types/index.cjs +1 -0
  194. package/dist/lib/maths/types/index.d.ts +4 -0
  195. package/dist/lib/maths/types/index.d.ts.map +1 -0
  196. package/dist/lib/maths/types/index.js +3 -0
  197. package/dist/lib/maths/types/index.mjs +0 -0
  198. package/dist/lib/maths/types/negative.cjs +1 -0
  199. package/dist/lib/maths/types/negative.d.ts +51 -0
  200. package/dist/lib/maths/types/negative.d.ts.map +1 -0
  201. package/dist/lib/maths/types/negative.js +5 -0
  202. package/dist/lib/maths/types/negative.mjs +0 -0
  203. package/dist/lib/maths/types/operations.cjs +1 -0
  204. package/dist/lib/maths/types/operations.d.ts +188 -0
  205. package/dist/lib/maths/types/operations.d.ts.map +1 -0
  206. package/dist/lib/maths/types/operations.js +6 -0
  207. package/dist/lib/maths/types/operations.mjs +0 -0
  208. package/dist/lib/object/clone.cjs +1 -0
  209. package/dist/lib/object/clone.d.ts +46 -0
  210. package/dist/lib/object/clone.d.ts.map +1 -0
  211. package/dist/lib/object/clone.js +104 -0
  212. package/dist/lib/object/clone.mjs +1 -0
  213. package/dist/lib/object/diff.cjs +1 -0
  214. package/dist/lib/object/diff.d.ts +203 -0
  215. package/dist/lib/object/diff.d.ts.map +1 -0
  216. package/dist/lib/object/diff.js +805 -0
  217. package/dist/lib/object/diff.mjs +1 -0
  218. package/dist/lib/object/getter-setter.cjs +1 -0
  219. package/dist/lib/object/getter-setter.d.ts +361 -0
  220. package/dist/lib/object/getter-setter.d.ts.map +1 -0
  221. package/dist/lib/object/getter-setter.js +1771 -0
  222. package/dist/lib/object/getter-setter.mjs +1 -0
  223. package/dist/lib/object/index.cjs +6 -0
  224. package/dist/lib/object/index.d.ts +13 -0
  225. package/dist/lib/object/index.d.ts.map +1 -0
  226. package/dist/lib/object/index.js +12 -0
  227. package/dist/lib/object/index.mjs +6 -0
  228. package/dist/lib/object/merge.cjs +1 -0
  229. package/dist/lib/object/merge.d.ts +93 -0
  230. package/dist/lib/object/merge.d.ts.map +1 -0
  231. package/dist/lib/object/merge.js +474 -0
  232. package/dist/lib/object/merge.mjs +1 -0
  233. package/dist/lib/object/object.cjs +1 -0
  234. package/dist/lib/object/object.d.ts +128 -0
  235. package/dist/lib/object/object.d.ts.map +1 -0
  236. package/dist/lib/object/object.js +432 -0
  237. package/dist/lib/object/object.mjs +1 -0
  238. package/dist/lib/object/omit.cjs +1 -0
  239. package/dist/lib/object/omit.d.ts +351 -0
  240. package/dist/lib/object/omit.d.ts.map +1 -0
  241. package/dist/lib/object/omit.js +656 -0
  242. package/dist/lib/object/omit.mjs +1 -0
  243. package/dist/lib/object/reconcile.cjs +1 -0
  244. package/dist/lib/object/reconcile.d.ts +7 -0
  245. package/dist/lib/object/reconcile.d.ts.map +1 -0
  246. package/dist/lib/object/reconcile.js +122 -0
  247. package/dist/lib/object/reconcile.mjs +1 -0
  248. package/dist/lib/object/selector.cjs +1 -0
  249. package/dist/lib/object/selector.d.ts +50 -0
  250. package/dist/lib/object/selector.d.ts.map +1 -0
  251. package/dist/lib/object/selector.js +371 -0
  252. package/dist/lib/object/selector.mjs +1 -0
  253. package/dist/lib/object/sort.cjs +1 -0
  254. package/dist/lib/object/sort.d.ts +149 -0
  255. package/dist/lib/object/sort.d.ts.map +1 -0
  256. package/dist/lib/object/sort.js +298 -0
  257. package/dist/lib/object/sort.mjs +1 -0
  258. package/dist/lib/object/transform.cjs +1 -0
  259. package/dist/lib/object/transform.d.ts +620 -0
  260. package/dist/lib/object/transform.d.ts.map +1 -0
  261. package/dist/lib/object/transform.js +1058 -0
  262. package/dist/lib/object/transform.mjs +1 -0
  263. package/dist/lib/object/types.cjs +1 -0
  264. package/dist/lib/object/types.d.ts +250 -0
  265. package/dist/lib/object/types.d.ts.map +1 -0
  266. package/dist/lib/object/types.js +1 -0
  267. package/dist/lib/object/types.mjs +0 -0
  268. package/dist/lib/object/utils.cjs +6 -0
  269. package/dist/lib/object/utils.d.ts +165 -0
  270. package/dist/lib/object/utils.d.ts.map +1 -0
  271. package/dist/lib/object/utils.js +444 -0
  272. package/dist/lib/object/utils.mjs +6 -0
  273. package/dist/lib/primitive/boolean/boolean.cjs +1 -0
  274. package/dist/lib/primitive/boolean/boolean.d.ts +276 -0
  275. package/dist/lib/primitive/boolean/boolean.d.ts.map +1 -0
  276. package/dist/lib/primitive/boolean/boolean.js +615 -0
  277. package/dist/lib/primitive/boolean/boolean.mjs +1 -0
  278. package/dist/lib/primitive/boolean/index.cjs +1 -0
  279. package/dist/lib/primitive/boolean/index.d.ts +3 -0
  280. package/dist/lib/primitive/boolean/index.d.ts.map +1 -0
  281. package/dist/lib/primitive/boolean/index.js +2 -0
  282. package/dist/lib/primitive/boolean/index.mjs +1 -0
  283. package/dist/lib/primitive/boolean/types.cjs +1 -0
  284. package/dist/lib/primitive/boolean/types.d.ts +14 -0
  285. package/dist/lib/primitive/boolean/types.d.ts.map +1 -0
  286. package/dist/lib/primitive/boolean/types.js +1 -0
  287. package/dist/lib/primitive/boolean/types.mjs +0 -0
  288. package/dist/lib/primitive/date/date.cjs +1 -0
  289. package/dist/lib/primitive/date/date.d.ts +641 -0
  290. package/dist/lib/primitive/date/date.d.ts.map +1 -0
  291. package/dist/lib/primitive/date/date.js +1998 -0
  292. package/dist/lib/primitive/date/date.mjs +1 -0
  293. package/dist/lib/primitive/date/index.cjs +1 -0
  294. package/dist/lib/primitive/date/index.d.ts +3 -0
  295. package/dist/lib/primitive/date/index.d.ts.map +1 -0
  296. package/dist/lib/primitive/date/index.js +2 -0
  297. package/dist/lib/primitive/date/index.mjs +1 -0
  298. package/dist/lib/primitive/date/types.cjs +1 -0
  299. package/dist/lib/primitive/date/types.d.ts +205 -0
  300. package/dist/lib/primitive/date/types.d.ts.map +1 -0
  301. package/dist/lib/primitive/date/types.js +7 -0
  302. package/dist/lib/primitive/date/types.mjs +0 -0
  303. package/dist/lib/primitive/index.cjs +5 -0
  304. package/dist/lib/primitive/index.d.ts +5 -0
  305. package/dist/lib/primitive/index.d.ts.map +1 -0
  306. package/dist/lib/primitive/index.js +4 -0
  307. package/dist/lib/primitive/index.mjs +5 -0
  308. package/dist/lib/primitive/string/index.cjs +5 -0
  309. package/dist/lib/primitive/string/index.d.ts +3 -0
  310. package/dist/lib/primitive/string/index.d.ts.map +1 -0
  311. package/dist/lib/primitive/string/index.js +2 -0
  312. package/dist/lib/primitive/string/index.mjs +5 -0
  313. package/dist/lib/primitive/string/parser-2.cjs +8 -0
  314. package/dist/lib/primitive/string/parser-2.d.ts +17 -0
  315. package/dist/lib/primitive/string/parser-2.d.ts.map +1 -0
  316. package/dist/lib/primitive/string/parser-2.js +656 -0
  317. package/dist/lib/primitive/string/parser-2.mjs +8 -0
  318. package/dist/lib/primitive/string/parser.cjs +3 -0
  319. package/dist/lib/primitive/string/parser.d.ts +9 -0
  320. package/dist/lib/primitive/string/parser.d.ts.map +1 -0
  321. package/dist/lib/primitive/string/parser.js +775 -0
  322. package/dist/lib/primitive/string/parser.mjs +3 -0
  323. package/dist/lib/primitive/string/string.cjs +5 -0
  324. package/dist/lib/primitive/string/string.d.ts +535 -0
  325. package/dist/lib/primitive/string/string.d.ts.map +1 -0
  326. package/dist/lib/primitive/string/string.js +1301 -0
  327. package/dist/lib/primitive/string/string.mjs +5 -0
  328. package/dist/lib/primitive/string/types.cjs +1 -0
  329. package/dist/lib/primitive/string/types.d.ts +318 -0
  330. package/dist/lib/primitive/string/types.d.ts.map +1 -0
  331. package/dist/lib/primitive/string/types.js +5 -0
  332. package/dist/lib/primitive/string/types.mjs +0 -0
  333. package/dist/lib/primitive/types.cjs +1 -0
  334. package/dist/lib/primitive/types.d.ts +27 -0
  335. package/dist/lib/primitive/types.d.ts.map +1 -0
  336. package/dist/lib/primitive/types.js +1 -0
  337. package/dist/lib/primitive/types.mjs +0 -0
  338. package/dist/lib/url/index.cjs +1 -0
  339. package/dist/lib/url/index.d.ts +3 -0
  340. package/dist/lib/url/index.d.ts.map +1 -0
  341. package/dist/lib/url/index.js +2 -0
  342. package/dist/lib/url/index.mjs +1 -0
  343. package/dist/lib/url/parser.cjs +1 -0
  344. package/dist/lib/url/parser.d.ts +216 -0
  345. package/dist/lib/url/parser.d.ts.map +1 -0
  346. package/dist/lib/url/parser.js +488 -0
  347. package/dist/lib/url/parser.mjs +1 -0
  348. package/dist/lib/url/types.cjs +1 -0
  349. package/dist/lib/url/types.d.ts +18 -0
  350. package/dist/lib/url/types.d.ts.map +1 -0
  351. package/dist/lib/url/types.js +1 -0
  352. package/dist/lib/url/types.mjs +0 -0
  353. package/dist/tsconfig.lib.tsbuildinfo +1 -0
  354. package/package.json +150 -0
@@ -0,0 +1 @@
1
+ function u(r,t){if(typeof r!="number"||!Number.isFinite(r))throw new Error(`${t} must be a finite number, got ${r}`)}function y(r){return Math.abs(r)<1e-9}function m(r,t){return Math.abs(r-t)<1e-6}function n(r,t="Vector2D"){if(!r||typeof r!="object")throw new Error(`${t} must be an object`);u(r.x,`${t}.x`),u(r.y,`${t}.y`)}function x(r,t="Vector3D"){if(!r||typeof r!="object")throw new Error(`${t} must be an object`);u(r.x,`${t}.x`),u(r.y,`${t}.y`),u(r.z,`${t}.z`)}function i(r,t="Vector4D"){if(!r||typeof r!="object")throw new Error(`${t} must be an object`);u(r.x,`${t}.x`),u(r.y,`${t}.y`),u(r.z,`${t}.z`),u(r.w,`${t}.w`)}function $(r,t){return u(r,"x"),u(t,"y"),{x:r,y:t}}function C(r,t,e){return u(r,"x"),u(t,"y"),u(e,"z"),{x:r,y:t,z:e}}function j(r,t,e,o){return u(r,"x"),u(t,"y"),u(e,"z"),u(o,"w"),{x:r,y:t,z:e,w:o}}function d(r){n(r);let t=Math.sqrt(r.x*r.x+r.y*r.y);return y(t)?0:t}function M(r){return n(r),r.x*r.x+r.y*r.y}function p(r){x(r);let t=Math.sqrt(r.x*r.x+r.y*r.y+r.z*r.z);return y(t)?0:t}function B(r){return x(r),r.x*r.x+r.y*r.y+r.z*r.z}function g(r){i(r);let t=Math.sqrt(r.x*r.x+r.y*r.y+r.z*r.z+r.w*r.w);return y(t)?0:t}function N(r){return i(r),r.x*r.x+r.y*r.y+r.z*r.z+r.w*r.w}function P(r){n(r);let t=d(r);if(y(t))throw new Error("Cannot normalize zero or near-zero vector");return{x:r.x/t,y:r.y/t}}function A(r){n(r);let t=d(r);return y(t)?{x:0,y:0}:{x:r.x/t,y:r.y/t}}function E(r){x(r);let t=p(r);if(y(t))throw new Error("Cannot normalize zero or near-zero vector");return{x:r.x/t,y:r.y/t,z:r.z/t}}function R(r){x(r);let t=p(r);return y(t)?{x:0,y:0,z:0}:{x:r.x/t,y:r.y/t,z:r.z/t}}function X(r){i(r);let t=g(r);if(y(t))throw new Error("Cannot normalize zero or near-zero vector");return{x:r.x/t,y:r.y/t,z:r.z/t,w:r.w/t}}function Y(r){i(r);let t=g(r);return y(t)?{x:0,y:0,z:0,w:0}:{x:r.x/t,y:r.y/t,z:r.z/t,w:r.w/t}}function a(r,t){return n(r,"First vector"),n(t,"Second vector"),r.x*t.x+r.y*t.y}function S(r,t){return x(r,"First vector"),x(t,"Second vector"),r.x*t.x+r.y*t.y+r.z*t.z}function Z(r,t){return i(r,"First vector"),i(t,"Second vector"),r.x*t.x+r.y*t.y+r.z*t.z+r.w*t.w}function I(r,t){return x(r,"First vector"),x(t,"Second vector"),{x:r.y*t.z-r.z*t.y,y:r.z*t.x-r.x*t.z,z:r.x*t.y-r.y*t.x}}function L(r,t){return n(r,"First vector"),n(t,"Second vector"),{x:r.x+t.x,y:r.y+t.y}}function F(r,t){return x(r,"First vector"),x(t,"Second vector"),{x:r.x+t.x,y:r.y+t.y,z:r.z+t.z}}function k(r,t){return i(r,"First vector"),i(t,"Second vector"),{x:r.x+t.x,y:r.y+t.y,z:r.z+t.z,w:r.w+t.w}}function G(r,t){return n(r,"First vector"),n(t,"Second vector"),{x:r.x-t.x,y:r.y-t.y}}function H(r,t){return x(r,"First vector"),x(t,"Second vector"),{x:r.x-t.x,y:r.y-t.y,z:r.z-t.z}}function J(r,t){return i(r,"First vector"),i(t,"Second vector"),{x:r.x-t.x,y:r.y-t.y,z:r.z-t.z,w:r.w-t.w}}function K(r,t){return n(r),u(t,"scalar"),{x:r.x*t,y:r.y*t}}function l(r,t){return x(r),u(t,"scalar"),{x:r.x*t,y:r.y*t,z:r.z*t}}function O(r,t){return i(r),u(t,"scalar"),{x:r.x*t,y:r.y*t,z:r.z*t,w:r.w*t}}function b(r,t){n(r,"First vector"),n(t,"Second vector");let e=a(r,t),o=d(r),c=d(t);if(y(o)||y(c))throw new Error("Cannot calculate angle with zero or near-zero vector");let D=Math.max(-1,Math.min(1,e/(o*c)));return Math.acos(D)}function Q(r,t){x(r,"First vector"),x(t,"Second vector");let e=S(r,t),o=p(r),c=p(t);if(y(o)||y(c))throw new Error("Cannot calculate angle with zero or near-zero vector");let D=Math.max(-1,Math.min(1,e/(o*c)));return Math.acos(D)}function U(r,t){n(r,"First vector"),n(t,"Second vector");let e=b(r,t);return r.x*t.y-r.y*t.x>=0?e:-e}function W(r,t){n(r,"First point"),n(t,"Second point");let e=t.x-r.x,o=t.y-r.y,c=Math.sqrt(e*e+o*o);return y(c)?0:c}function _(r,t){n(r,"First point"),n(t,"Second point");let e=t.x-r.x,o=t.y-r.y;return e*e+o*o}function v(r,t){x(r,"First point"),x(t,"Second point");let e=t.x-r.x,o=t.y-r.y,c=t.z-r.z,D=Math.sqrt(e*e+o*o+c*c);return y(D)?0:D}function rr(r,t){x(r,"First point"),x(t,"Second point");let e=t.x-r.x,o=t.y-r.y,c=t.z-r.z;return e*e+o*o+c*c}function tr(r,t){i(r,"First point"),i(t,"Second point");let e=t.x-r.x,o=t.y-r.y,c=t.z-r.z,D=t.w-r.w,V=Math.sqrt(e*e+o*o+c*c+D*D);return y(V)?0:V}function er(r,t){i(r,"First point"),i(t,"Second point");let e=t.x-r.x,o=t.y-r.y,c=t.z-r.z,D=t.w-r.w;return e*e+o*o+c*c+D*D}function or(r,t,e){return n(r,"Start vector"),n(t,"End vector"),u(e,"t"),{x:r.x+(t.x-r.x)*e,y:r.y+(t.y-r.y)*e}}function nr(r,t,e){n(r,"Start vector"),n(t,"End vector"),u(e,"t");let o=Math.max(0,Math.min(1,e));return{x:r.x+(t.x-r.x)*o,y:r.y+(t.y-r.y)*o}}function q(r,t,e){return x(r,"Start vector"),x(t,"End vector"),u(e,"t"),{x:r.x+(t.x-r.x)*e,y:r.y+(t.y-r.y)*e,z:r.z+(t.z-r.z)*e}}function cr(r,t,e){x(r,"Start vector"),x(t,"End vector"),u(e,"t");let o=Math.max(0,Math.min(1,e));return{x:r.x+(t.x-r.x)*o,y:r.y+(t.y-r.y)*o,z:r.z+(t.z-r.z)*o}}function ur(r,t,e){return i(r,"Start vector"),i(t,"End vector"),u(e,"t"),{x:r.x+(t.x-r.x)*e,y:r.y+(t.y-r.y)*e,z:r.z+(t.z-r.z)*e,w:r.w+(t.w-r.w)*e}}function xr(r,t,e){i(r,"Start vector"),i(t,"End vector"),u(e,"t");let o=Math.max(0,Math.min(1,e));return{x:r.x+(t.x-r.x)*o,y:r.y+(t.y-r.y)*o,z:r.z+(t.z-r.z)*o,w:r.w+(t.w-r.w)*o}}function Dr(r,t,e){x(r,"Start vector"),x(t,"End vector"),u(e,"t");let o=p(r),c=p(t);if(Math.abs(o-1)>1e-8||Math.abs(c-1)>1e-8)throw new Error("SLERP requires unit vectors");let D=Math.max(0,Math.min(1,e)),V=S(r,t),z=Math.max(-1,Math.min(1,V));if(z>.9995)return E(q(r,t,D));let s=Math.acos(z),f=Math.sin(s),w=Math.sin((1-D)*s)/f,h=Math.sin(D*s)/f;return F(l(r,w),l(t,h))}function ir(r,t,e){n(r,"Start vector"),n(t,"End vector"),u(e,"t");let o=e*e*(3-2*e);return{x:r.x+(t.x-r.x)*o,y:r.y+(t.y-r.y)*o}}function yr(r,t,e){n(r,"Start vector"),n(t,"End vector"),u(e,"t");let o=Math.max(0,Math.min(1,e)),c=o*o*(3-2*o);return{x:r.x+(t.x-r.x)*c,y:r.y+(t.y-r.y)*c}}function Vr(r,t,e){n(r,"Start vector"),n(t,"End vector"),u(e,"t");let o=e*e*e*(e*(e*6-15)+10);return{x:r.x+(t.x-r.x)*o,y:r.y+(t.y-r.y)*o}}function mr(r,t,e,o){n(r,"Start point"),n(t,"Control point"),n(e,"End point"),u(o,"t");let c=1-o,D=c*c*r.x+2*c*o*t.x+o*o*e.x,V=c*c*r.y+2*c*o*t.y+o*o*e.y;return{x:D,y:V}}function sr(r,t,e,o,c){n(r,"Start point"),n(t,"First control point"),n(e,"Second control point"),n(o,"End point"),u(c,"t");let D=1-c,V=D*D,z=V*D,s=c*c,f=s*c,w=z*r.x+3*V*c*t.x+3*D*s*e.x+f*o.x,h=z*r.y+3*V*c*t.y+3*D*s*e.y+f*o.y;return{x:w,y:h}}function pr(r,t,e,o,c){return u(r,"value"),u(t,"inMin"),u(e,"inMax"),u(o,"outMin"),u(c,"outMax"),m(t,e)?o:o+(c-o)*(r-t)/(e-t)}function zr(r,t,e,o,c){if(u(r,"value"),u(t,"inMin"),u(e,"inMax"),u(o,"outMin"),u(c,"outMax"),m(t,e))return o;let D=(r-t)/(e-t),V=Math.max(0,Math.min(1,D));return o+(c-o)*V}function T(r,t){n(r),u(t,"angle");let e=Math.cos(t),o=Math.sin(t);return{x:r.x*e-r.y*o,y:r.x*o+r.y*e}}function fr(r,t){return T(r,t*(Math.PI/180))}function dr(r,t){n(r,"Vector"),n(t,"Normal");let e=d(t);if(Math.abs(e-1)>1e-10)throw new Error("Normal vector must be unit length for reflection");let o=a(r,t);return{x:r.x-2*o*t.x,y:r.y-2*o*t.y}}function wr(r,t){n(r,"First vector"),n(t,"Second vector");let e=M(t);if(y(e))throw new Error("Cannot project onto zero or near-zero vector");let o=a(r,t)/e;return{x:t.x*o,y:t.y*o}}function hr(r,t){return n(r,"First vector"),n(t,"Second vector"),m(r.x,t.x)&&m(r.y,t.y)}function ar(r,t){return x(r,"First vector"),x(t,"Second vector"),m(r.x,t.x)&&m(r.y,t.y)&&m(r.z,t.z)}function lr(r,t){return i(r,"First vector"),i(t,"Second vector"),m(r.x,t.x)&&m(r.y,t.y)&&m(r.z,t.z)&&m(r.w,t.w)}function gr(r,t){return n(r,"First point"),n(t,"Second point"),{x:(r.x+t.x)/2,y:(r.y+t.y)/2}}function Sr(r){if(!Array.isArray(r)||r.length===0)throw new Error("Points array must not be empty");let t=0,e=0;for(let o=0;o<r.length;o++)n(r[o],`points[${o}]`),t+=r[o].x,e+=r[o].y;return{x:t/r.length,y:e/r.length}}function Mr(r){return n(r),{x:-r.x,y:-r.y}}function Er(r){return x(r),{x:-r.x,y:-r.y,z:-r.z}}function Fr(r){return i(r),{x:-r.x,y:-r.y,z:-r.z,w:-r.w}}function br(r,t=!0){return n(r),t?{x:r.y,y:-r.x}:{x:-r.y,y:r.x}}function qr(){return{x:0,y:0}}function Tr(){return{x:0,y:0,z:0}}function $r(){return{x:0,y:0,z:0,w:0}}function Cr(){return{x:1,y:0}}function jr(){return{x:0,y:1}}function Br(){return{x:1,y:0,z:0}}function Nr(){return{x:0,y:1,z:0}}function Pr(){return{x:0,y:0,z:1}}export{L as addVectors2D,F as addVectors3D,k as addVectors4D,b as angleBetween2D,Q as angleBetween3D,Sr as centroid2D,$ as createVector2D,C as createVector3D,j as createVector4D,I as crossProduct3D,sr as cubicBezier2D,W as distance2D,v as distance3D,tr as distance4D,_ as distanceSquared2D,rr as distanceSquared3D,er as distanceSquared4D,a as dotProduct2D,S as dotProduct3D,Z as dotProduct4D,or as lerp2D,q as lerp3D,ur as lerp4D,nr as lerpClamped2D,cr as lerpClamped3D,xr as lerpClamped4D,d as magnitude2D,p as magnitude3D,g as magnitude4D,M as magnitudeSquared2D,B as magnitudeSquared3D,N as magnitudeSquared4D,pr as mapRange,zr as mapRangeClamped,gr as midpoint2D,Mr as negateVector2D,Er as negateVector3D,Fr as negateVector4D,P as normalize2D,E as normalize3D,X as normalize4D,br as perpendicular2D,wr as project2D,mr as quadraticBezier2D,dr as reflect2D,T as rotate2D,fr as rotate2DDegrees,A as safeNormalize2D,R as safeNormalize3D,Y as safeNormalize4D,K as scaleVector2D,l as scaleVector3D,O as scaleVector4D,U as signedAngleBetween2D,Dr as slerp3D,Vr as smootherstep2D,ir as smoothstep2D,yr as smoothstepClamped2D,G as subtractVectors2D,H as subtractVectors3D,J as subtractVectors4D,Cr as unitX2D,Br as unitX3D,jr as unitY2D,Nr as unitY3D,Pr as unitZ3D,hr as vectorsEqual2D,ar as vectorsEqual3D,lr as vectorsEqual4D,qr as zeroVector2D,Tr as zeroVector3D,$r as zeroVector4D};
@@ -0,0 +1 @@
1
+ "use strict";var o=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var c=(r,t)=>{for(var n in t)o(r,n,{get:t[n],enumerable:!0})},g=(r,t,n,m)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of s(t))!u.call(r,e)&&e!==n&&o(r,e,{get:()=>t[e],enumerable:!(m=a(t,e))||m.enumerable});return r};var l=r=>g(o({},"__esModule",{value:!0}),r);var x={};c(x,{formatBytes:()=>b,formatCurrency:()=>F,formatNumber:()=>B,formatPercent:()=>f});module.exports=l(x);var B=(r,t={})=>{let{locale:n="en-US",minimumFractionDigits:m=0,maximumFractionDigits:e=20}=t;return new Intl.NumberFormat(n,{minimumFractionDigits:m,maximumFractionDigits:e}).format(r)},F=(r,t="USD",n="en-US")=>new Intl.NumberFormat(n,{style:"currency",currency:t}).format(r),b=(r,t=2)=>{if(r===0)return"0 Bytes";let n=1024,m=t<0?0:t,e=["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"],i=Math.floor(Math.log(r)/Math.log(n));return`${parseFloat((r/Math.pow(n,i)).toFixed(m))} ${e[i]}`},f=(r,t=2,n="en-US")=>{let m=r*100;return new Intl.NumberFormat(n,{style:"percent",minimumFractionDigits:0,maximumFractionDigits:Math.max(0,t)}).format(m/100)};
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Formats a number with thousand separators and decimal places
3
+ * @param value - Number to format
4
+ * @param options - Options object with locale, minimumFractionDigits, and maximumFractionDigits
5
+ * Optimized: Uses Intl.NumberFormat for locale-aware formatting
6
+ */
7
+ export declare const formatNumber: (value: number, options?: {
8
+ locale?: Intl.LocalesArgument;
9
+ minimumFractionDigits?: number;
10
+ maximumFractionDigits?: number;
11
+ }) => string;
12
+ /**
13
+ * Formats a number as currency
14
+ * @param value - Number to format
15
+ * @param currency - Currency code (default: 'USD')
16
+ * @param locale - Locale string (default: 'en-US')
17
+ * Optimized: Uses Intl.NumberFormat
18
+ */
19
+ export declare const formatCurrency: (value: number, currency?: string, locale?: string) => string;
20
+ /**
21
+ * Formats bytes to human-readable string (KB, MB, GB, etc.)
22
+ * @param bytes - Number of bytes to format
23
+ * @param decimals - Number of decimal places to include (default: 2)
24
+ * Optimized: Logarithmic calculation for units
25
+ */
26
+ export declare const formatBytes: (bytes: number, decimals?: number) => string;
27
+ /**
28
+ * Formats a number as a percentage
29
+ * @param value - Number to format
30
+ * @param decimals - Number of decimal places to include (default: 2)
31
+ * @param locale - Locale string (default: 'en-US')
32
+ * Optimized: Single multiplication and formatting
33
+ */
34
+ export declare const formatPercent: (value: number, decimals?: number, locale?: string) => string;
35
+ //# sourceMappingURL=formatter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatter.d.ts","sourceRoot":"","sources":["../../../src/lib/maths/formatter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,YAAY,GACvB,OAAO,MAAM,EACb,UAAS;IACP,MAAM,CAAC,EAAE,IAAI,CAAC,eAAe,CAAC;IAC9B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAC3B,KACL,MAWF,CAAC;AAGF;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,GACzB,OAAO,MAAM,EACb,WAAU,MAAc,EACxB,SAAQ,MAAgB,KACvB,MAKF,CAAC;AAGF;;;;;GAKG;AACH,eAAO,MAAM,WAAW,GACtB,OAAO,MAAM,EACb,WAAU,MAAU,KACnB,MASF,CAAC;AAGF;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,GACxB,OAAO,MAAM,EACb,WAAU,MAAU,EACpB,SAAQ,MAAgB,KACvB,MAOF,CAAC"}
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Formats a number with thousand separators and decimal places
3
+ * @param value - Number to format
4
+ * @param options - Options object with locale, minimumFractionDigits, and maximumFractionDigits
5
+ * Optimized: Uses Intl.NumberFormat for locale-aware formatting
6
+ */
7
+ export const formatNumber = (value, options = {}) => {
8
+ const { locale = 'en-US', minimumFractionDigits = 0, maximumFractionDigits = 20 } = options;
9
+ return new Intl.NumberFormat(locale, {
10
+ minimumFractionDigits,
11
+ maximumFractionDigits
12
+ }).format(value);
13
+ };
14
+ /**
15
+ * Formats a number as currency
16
+ * @param value - Number to format
17
+ * @param currency - Currency code (default: 'USD')
18
+ * @param locale - Locale string (default: 'en-US')
19
+ * Optimized: Uses Intl.NumberFormat
20
+ */
21
+ export const formatCurrency = (value, currency = 'USD', locale = 'en-US') => {
22
+ return new Intl.NumberFormat(locale, {
23
+ style: 'currency',
24
+ currency
25
+ }).format(value);
26
+ };
27
+ /**
28
+ * Formats bytes to human-readable string (KB, MB, GB, etc.)
29
+ * @param bytes - Number of bytes to format
30
+ * @param decimals - Number of decimal places to include (default: 2)
31
+ * Optimized: Logarithmic calculation for units
32
+ */
33
+ export const formatBytes = (bytes, decimals = 2) => {
34
+ if (bytes === 0)
35
+ return '0 Bytes';
36
+ const k = 1024;
37
+ const dm = decimals < 0 ? 0 : decimals;
38
+ const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
39
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
40
+ return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`;
41
+ };
42
+ /**
43
+ * Formats a number as a percentage
44
+ * @param value - Number to format
45
+ * @param decimals - Number of decimal places to include (default: 2)
46
+ * @param locale - Locale string (default: 'en-US')
47
+ * Optimized: Single multiplication and formatting
48
+ */
49
+ export const formatPercent = (value, decimals = 2, locale = 'en-US') => {
50
+ const percent = value * 100;
51
+ return new Intl.NumberFormat(locale, {
52
+ style: 'percent',
53
+ minimumFractionDigits: 0,
54
+ maximumFractionDigits: Math.max(0, decimals),
55
+ }).format(percent / 100);
56
+ };
@@ -0,0 +1 @@
1
+ var i=(t,r={})=>{let{locale:n="en-US",minimumFractionDigits:e=0,maximumFractionDigits:m=20}=r;return new Intl.NumberFormat(n,{minimumFractionDigits:e,maximumFractionDigits:m}).format(t)},a=(t,r="USD",n="en-US")=>new Intl.NumberFormat(n,{style:"currency",currency:r}).format(t),s=(t,r=2)=>{if(t===0)return"0 Bytes";let n=1024,e=r<0?0:r,m=["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"],o=Math.floor(Math.log(t)/Math.log(n));return`${parseFloat((t/Math.pow(n,o)).toFixed(e))} ${m[o]}`},u=(t,r=2,n="en-US")=>{let e=t*100;return new Intl.NumberFormat(n,{style:"percent",minimumFractionDigits:0,maximumFractionDigits:Math.max(0,r)}).format(e/100)};export{s as formatBytes,a as formatCurrency,i as formatNumber,u as formatPercent};
@@ -0,0 +1 @@
1
+ "use strict";var s=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var a=(r,n)=>{for(var e in n)s(r,e,{get:n[e],enumerable:!0})},p=(r,n,e,t)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of b(n))!f.call(r,o)&&o!==e&&s(r,o,{get:()=>n[o],enumerable:!(t=m(n,o))||t.enumerable});return r};var y=r=>p(s({},"__esModule",{value:!0}),r);var T={};a(T,{approxEqual:()=>O,isComplexNumber:()=>A,isEven:()=>S,isFiniteNumber:()=>w,isFloat:()=>F,isFraction:()=>E,isInRange:()=>P,isInt:()=>N,isInteger:()=>d,isMatrix:()=>M,isNegative:()=>l,isNonNegative:()=>h,isNonPositive:()=>D,isNumber:()=>x,isNumeric:()=>c,isNumericString:()=>u,isOdd:()=>C,isPositive:()=>j,isPowerOfTwo:()=>R,isPrime:()=>z,isSafeInteger:()=>g,isVector2D:()=>I,isVector3D:()=>k,isZero:()=>V});module.exports=y(T);var u=r=>{let n=r.trim();if(n===""||!/^[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?$/.test(n))return!1;let e=Number(n);return Number.isFinite(e)},c=r=>typeof r=="number"?Number.isFinite(r):typeof r=="string"?u(r):!1,N=r=>{if(typeof r=="number")return Number.isInteger(r);if(typeof r=="string"){let e=r.trim();if(!e||!/^[-+]?\d+$/.test(e))return!1;let t=Number(e);return Number.isInteger(t)&&Number.isFinite(t)}if(typeof r=="boolean"||r==null||Array.isArray(r))return!1;let n=Number(r);return!Number.isNaN(n)&&Number.isInteger(n)&&Number.isFinite(n)},x=r=>typeof r=="number"&&Number.isFinite(r),g=r=>typeof r=="number"&&Number.isSafeInteger(r),F=r=>typeof r!="number"||!Number.isFinite(r)?!1:!Number.isInteger(r);function d(r){return Number.isInteger(r)}function w(r){return Number.isFinite(r)}function I(r){return typeof r=="object"&&r!==null&&"x"in r&&"y"in r&&typeof r.x=="number"&&typeof r.y=="number"}function k(r){return typeof r=="object"&&r!==null&&"x"in r&&"y"in r&&"z"in r&&typeof r.x=="number"&&typeof r.y=="number"&&typeof r.z=="number"}function A(r){return typeof r=="object"&&r!==null&&"real"in r&&"imag"in r&&typeof r.real=="number"&&typeof r.imag=="number"}function E(r){return typeof r=="object"&&r!==null&&"numerator"in r&&"denominator"in r&&typeof r.numerator=="number"&&typeof r.denominator=="number"&&r.denominator!==0}function M(r){return typeof r=="object"&&r!==null&&"rows"in r&&"columns"in r&&"data"in r&&typeof r.rows=="number"&&typeof r.columns=="number"&&Array.isArray(r.data)&&r.data.every(n=>Array.isArray(n))}var j=r=>Number.isFinite(r)&&r>0,l=r=>Number.isFinite(r)&&r<0;function h(r){return Number.isFinite(r)&&r>=0}function D(r){return Number.isFinite(r)&&r<=0}var V=(r,n=1e-10)=>Number.isFinite(r)&&Math.abs(r)<n;function P(r,n,e,t=!0){return t?r>=n&&r<=e:r>n&&r<e}function S(r){return(r&1)===0}function C(r){return(r&1)===1}var z=r=>{if(!Number.isInteger(r)||r<=1)return!1;if(r<=3)return!0;if(r%2===0||r%3===0)return!1;for(let n=5;n*n<=r;n+=6)if(r%n===0||r%(n+2)===0)return!1;return!0},O=(r,n,e=Math.E)=>{if(r===n)return!0;if(!Number.isFinite(r)||!Number.isFinite(n))return r===n;let t=Math.abs(r),o=Math.abs(n),i=Math.abs(r-n);return r===0||n===0||i<e?i<e:i>e?!1:i/Math.min(t+o,Number.MAX_SAFE_INTEGER)<e},R=r=>r>0&&(r&r-1)===0;
@@ -0,0 +1,166 @@
1
+ /**
2
+ * Type guard functions for mathematical types.
3
+ * @module TypeGuards
4
+ */
5
+ import type { Integer, Vector2D, Vector3D, ComplexNumber, Fraction } from './types/index.js';
6
+ /**
7
+ * Checks if a string is a valid numeric string.
8
+ * @param value - The string to check
9
+ * @returns True if the string is a valid numeric string
10
+ */
11
+ export declare const isNumericString: (value: string) => boolean;
12
+ /**
13
+ * Type guard to check if a value is numeric.
14
+ * @param value - The value to check
15
+ * @returns True if the value is numeric
16
+ */
17
+ export declare const isNumeric: (value: unknown) => value is number | string;
18
+ /**
19
+ * Checks if a value is an integer with high performance
20
+ * @param value - The value to check
21
+ * @returns True if the value is a valid integer
22
+ * @example
23
+ * isInt(42) // true
24
+ * isInt("42") // true
25
+ * isInt("42.5") // false
26
+ * isInt(null) // false
27
+ */
28
+ export declare const isInt: (value: unknown) => value is number;
29
+ /**
30
+ * Checks if a value is a finite number (not NaN, Infinity, or string)
31
+ * @param value - The value to check
32
+ * @returns True if the value is a finite number
33
+ * @example
34
+ * isNumber(42) // true
35
+ * isNumber(NaN) // false
36
+ * isNumber(Infinity) // false
37
+ * isNumber("42") // false
38
+ */
39
+ export declare const isNumber: (value: unknown) => value is number;
40
+ /**
41
+ * Checks if a value is a safe integer within Number.MAX_SAFE_INTEGER range
42
+ * @param value - The value to check
43
+ * @returns True if value is a safe integer
44
+ * @example
45
+ * isSafeInteger(42) // true
46
+ * isSafeInteger(9007199254740992) // false (beyond safe range)
47
+ */
48
+ export declare const isSafeInteger: (value: unknown) => boolean;
49
+ /**
50
+ * Checks if a value is a float (not an integer)
51
+ * @param value - The value to check
52
+ * @returns True if the value is a float
53
+ */
54
+ export declare const isFloat: (value: unknown) => boolean;
55
+ /**
56
+ * Type guard to check if a number is an integer.
57
+ * @param value - The number to check
58
+ * @returns True if the number is an integer
59
+ */
60
+ export declare function isInteger(value: unknown): value is Integer;
61
+ /**
62
+ * Type guard to check if a number is a finite number.
63
+ * @param value - The number to check
64
+ * @returns True if the number is finite
65
+ */
66
+ export declare function isFiniteNumber(value: number): boolean;
67
+ /**
68
+ * Type guard to check if a value is a valid Vector2D.
69
+ * @param value - The value to check
70
+ * @returns True if the value is a valid Vector2D
71
+ */
72
+ export declare function isVector2D(value: unknown): value is Vector2D;
73
+ /**
74
+ * Type guard to check if a value is a valid Vector3D.
75
+ * @param value - The value to check
76
+ * @returns True if the value is a valid Vector3D
77
+ */
78
+ export declare function isVector3D(value: unknown): value is Vector3D;
79
+ /**
80
+ * Type guard to check if a value is a valid ComplexNumber.
81
+ * @param value - The value to check
82
+ * @returns True if the value is a valid ComplexNumber
83
+ */
84
+ export declare function isComplexNumber(value: unknown): value is ComplexNumber;
85
+ /**
86
+ * Type guard to check if a value is a valid Fraction.
87
+ * @param value - The value to check
88
+ * @returns True if the value is a valid Fraction
89
+ */
90
+ export declare function isFraction(value: unknown): value is Fraction;
91
+ /**
92
+ * Type guard to check if a value is a valid Matrix.
93
+ * @param value - The value to check
94
+ * @returns True if the value is a valid Matrix
95
+ */
96
+ export declare function isMatrix(value: unknown): value is import('./types/index.js').Matrix<any, any>;
97
+ /**
98
+ * Type guard to check if a number is positive (> 0).
99
+ * @param value - The number to check
100
+ * @returns True if the number is positive
101
+ */
102
+ export declare const isPositive: (value: number) => boolean;
103
+ /**
104
+ * Type guard to check if a number is negative (< 0).
105
+ * @param value - The number to check
106
+ * @returns True if the number is negative
107
+ */
108
+ export declare const isNegative: (value: number) => boolean;
109
+ /**
110
+ * Type guard to check if a number is non-negative (>= 0).
111
+ * @param value - The number to check
112
+ * @returns True if the number is non-negative
113
+ */
114
+ export declare function isNonNegative(value: number): boolean;
115
+ /**
116
+ * Type guard to check if a number is non-positive (<= 0).
117
+ * @param value - The number to check
118
+ * @returns True if the number is non-positive
119
+ */
120
+ export declare function isNonPositive(value: number): boolean;
121
+ /**
122
+ * Checks if a number is zero (or very close to zero)
123
+ */
124
+ export declare const isZero: (value: number, epsilon?: number) => boolean;
125
+ /**
126
+ * Type guard to check if a number is within a range (inclusive).
127
+ * @param value - The number to check
128
+ * @param min - Minimum value
129
+ * @param max - Maximum value
130
+ * @param inclusive - Whether the range is inclusive
131
+ * @returns True if the number is within the range
132
+ */
133
+ export declare function isInRange(value: number, min: number, max: number, inclusive?: boolean): boolean;
134
+ /**
135
+ * Type guard to check if a number is even.
136
+ * @param value - The number to check
137
+ * @returns True if the number is even
138
+ */
139
+ export declare function isEven(value: number): boolean;
140
+ /**
141
+ * Type guard to check if a number is odd.
142
+ * @param value - The number to check
143
+ * @returns True if the number is odd
144
+ */
145
+ export declare function isOdd(value: number): boolean;
146
+ /**
147
+ * Checks if a number is prime.
148
+ * @param n - The number to check
149
+ * @returns True if the number is prime, false otherwise
150
+ */
151
+ export declare const isPrime: (n: number) => boolean;
152
+ /**
153
+ * Checks if two numbers are approximately equal.
154
+ * @param a - First number
155
+ * @param b - Second number
156
+ * @param epsilon - The maximum allowed difference between the numbers
157
+ * @returns True if the numbers are approximately equal, false otherwise
158
+ */
159
+ export declare const approxEqual: (a: number, b: number, epsilon?: number) => boolean;
160
+ /**
161
+ * Checks if a number is a power of two
162
+ * @param n - The number to check
163
+ * Optimized: Bitwise trick
164
+ */
165
+ export declare const isPowerOfTwo: (n: number) => boolean;
166
+ //# sourceMappingURL=guards.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"guards.d.ts","sourceRoot":"","sources":["../../../src/lib/maths/guards.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE7F;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAAI,OAAO,MAAM,KAAG,OAS/C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,SAAS,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,MAAM,GAAG,MAI5D,CAAC;AAEF;;;;;;;;;EASE;AACF,eAAO,MAAM,KAAK,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,MA4B/C,CAAC;AAIF;;;;;;;;;EASE;AACF,eAAO,MAAM,QAAQ,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,MAElD,CAAC;AAGF;;;;;;;EAOE;AACF,eAAO,MAAM,aAAa,GAAI,OAAO,OAAO,KAAG,OAE9C,CAAC;AAGF;;;;EAIE;AACF,eAAO,MAAM,OAAO,GAAI,OAAO,OAAO,KAAG,OAGxC,CAAC;AACF;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,OAAO,CAE1D;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAErD;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,QAAQ,CAS5D;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,QAAQ,CAW5D;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,aAAa,CAStE;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,QAAQ,CAU5D;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,OAAO,kBAAkB,EAAE,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,CAY7F;AAED;;;;GAIG;AACH,eAAO,MAAM,UAAU,GAAI,OAAO,MAAM,KAAG,OAE1C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,UAAU,GAAI,OAAO,MAAM,KAAG,OAE1C,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED;;GAEG;AACH,eAAO,MAAM,MAAM,GAAI,OAAO,MAAM,EAAE,UAAS,MAAc,KAAG,OAE/D,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,SAAS,GAAE,OAAc,GAAG,OAAO,CAErG;AAED;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAG7C;AAED;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAG5C;AAED;;;;GAIG;AACH,eAAO,MAAM,OAAO,GAAI,GAAG,MAAM,KAAG,OAenC,CAAC;AAEF;;;;;;EAME;AACF,eAAO,MAAM,WAAW,GACtB,GAAG,MAAM,EACT,GAAG,MAAM,EACT,UAAS,MAAe,KACvB,OAqBF,CAAC;AAGF;;;;GAIG;AACH,eAAO,MAAM,YAAY,GAAI,GAAG,MAAM,KAAG,OAExC,CAAC"}
@@ -0,0 +1,315 @@
1
+ /**
2
+ * Type guard functions for mathematical types.
3
+ * @module TypeGuards
4
+ */
5
+ /**
6
+ * Checks if a string is a valid numeric string.
7
+ * @param value - The string to check
8
+ * @returns True if the string is a valid numeric string
9
+ */
10
+ export const isNumericString = (value) => {
11
+ const trimmed = value.trim();
12
+ if (trimmed === '')
13
+ return false;
14
+ // Allow: optional sign, digits, optional decimal with digits, optional exponent
15
+ if (!/^[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?$/.test(trimmed))
16
+ return false;
17
+ const num = Number(trimmed);
18
+ return Number.isFinite(num);
19
+ };
20
+ /**
21
+ * Type guard to check if a value is numeric.
22
+ * @param value - The value to check
23
+ * @returns True if the value is numeric
24
+ */
25
+ export const isNumeric = (value) => {
26
+ if (typeof value === 'number')
27
+ return Number.isFinite(value);
28
+ if (typeof value === 'string')
29
+ return isNumericString(value);
30
+ return false;
31
+ };
32
+ /**
33
+ * Checks if a value is an integer with high performance
34
+ * @param value - The value to check
35
+ * @returns True if the value is a valid integer
36
+ * @example
37
+ * isInt(42) // true
38
+ * isInt("42") // true
39
+ * isInt("42.5") // false
40
+ * isInt(null) // false
41
+ */
42
+ export const isInt = (value) => {
43
+ // Fast path: number type
44
+ if (typeof value === 'number') {
45
+ return Number.isInteger(value);
46
+ }
47
+ // Fast path: string type
48
+ if (typeof value === 'string') {
49
+ const trimmed = value.trim();
50
+ if (!trimmed)
51
+ return false;
52
+ // Fast regex check: optional sign, digits only
53
+ if (!/^[-+]?\d+$/.test(trimmed))
54
+ return false;
55
+ // Parse and validate
56
+ const num = Number(trimmed);
57
+ return Number.isInteger(num) && Number.isFinite(num);
58
+ }
59
+ // Fast reject for non-numeric types
60
+ if (typeof value === 'boolean' || value == null) {
61
+ return false;
62
+ }
63
+ if (Array.isArray(value))
64
+ return false;
65
+ // For other types, attempt conversion
66
+ const num = Number(value);
67
+ return !Number.isNaN(num) && Number.isInteger(num) && Number.isFinite(num);
68
+ };
69
+ /**
70
+ * Checks if a value is a finite number (not NaN, Infinity, or string)
71
+ * @param value - The value to check
72
+ * @returns True if the value is a finite number
73
+ * @example
74
+ * isNumber(42) // true
75
+ * isNumber(NaN) // false
76
+ * isNumber(Infinity) // false
77
+ * isNumber("42") // false
78
+ */
79
+ export const isNumber = (value) => {
80
+ return typeof value === 'number' && Number.isFinite(value);
81
+ };
82
+ /**
83
+ * Checks if a value is a safe integer within Number.MAX_SAFE_INTEGER range
84
+ * @param value - The value to check
85
+ * @returns True if value is a safe integer
86
+ * @example
87
+ * isSafeInteger(42) // true
88
+ * isSafeInteger(9007199254740992) // false (beyond safe range)
89
+ */
90
+ export const isSafeInteger = (value) => {
91
+ return typeof value === 'number' && Number.isSafeInteger(value);
92
+ };
93
+ /**
94
+ * Checks if a value is a float (not an integer)
95
+ * @param value - The value to check
96
+ * @returns True if the value is a float
97
+ */
98
+ export const isFloat = (value) => {
99
+ if (typeof value !== 'number' || !Number.isFinite(value))
100
+ return false;
101
+ return !Number.isInteger(value);
102
+ };
103
+ /**
104
+ * Type guard to check if a number is an integer.
105
+ * @param value - The number to check
106
+ * @returns True if the number is an integer
107
+ */
108
+ export function isInteger(value) {
109
+ return Number.isInteger(value);
110
+ }
111
+ /**
112
+ * Type guard to check if a number is a finite number.
113
+ * @param value - The number to check
114
+ * @returns True if the number is finite
115
+ */
116
+ export function isFiniteNumber(value) {
117
+ return Number.isFinite(value);
118
+ }
119
+ /**
120
+ * Type guard to check if a value is a valid Vector2D.
121
+ * @param value - The value to check
122
+ * @returns True if the value is a valid Vector2D
123
+ */
124
+ export function isVector2D(value) {
125
+ return (typeof value === 'object' &&
126
+ value !== null &&
127
+ 'x' in value &&
128
+ 'y' in value &&
129
+ typeof value.x === 'number' &&
130
+ typeof value.y === 'number');
131
+ }
132
+ /**
133
+ * Type guard to check if a value is a valid Vector3D.
134
+ * @param value - The value to check
135
+ * @returns True if the value is a valid Vector3D
136
+ */
137
+ export function isVector3D(value) {
138
+ return (typeof value === 'object' &&
139
+ value !== null &&
140
+ 'x' in value &&
141
+ 'y' in value &&
142
+ 'z' in value &&
143
+ typeof value.x === 'number' &&
144
+ typeof value.y === 'number' &&
145
+ typeof value.z === 'number');
146
+ }
147
+ /**
148
+ * Type guard to check if a value is a valid ComplexNumber.
149
+ * @param value - The value to check
150
+ * @returns True if the value is a valid ComplexNumber
151
+ */
152
+ export function isComplexNumber(value) {
153
+ return (typeof value === 'object' &&
154
+ value !== null &&
155
+ 'real' in value &&
156
+ 'imag' in value &&
157
+ typeof value.real === 'number' &&
158
+ typeof value.imag === 'number');
159
+ }
160
+ /**
161
+ * Type guard to check if a value is a valid Fraction.
162
+ * @param value - The value to check
163
+ * @returns True if the value is a valid Fraction
164
+ */
165
+ export function isFraction(value) {
166
+ return (typeof value === 'object' &&
167
+ value !== null &&
168
+ 'numerator' in value &&
169
+ 'denominator' in value &&
170
+ typeof value.numerator === 'number' &&
171
+ typeof value.denominator === 'number' &&
172
+ value.denominator !== 0);
173
+ }
174
+ /**
175
+ * Type guard to check if a value is a valid Matrix.
176
+ * @param value - The value to check
177
+ * @returns True if the value is a valid Matrix
178
+ */
179
+ export function isMatrix(value) {
180
+ return (typeof value === 'object' &&
181
+ value !== null &&
182
+ 'rows' in value &&
183
+ 'columns' in value &&
184
+ 'data' in value &&
185
+ typeof value.rows === 'number' &&
186
+ typeof value.columns === 'number' &&
187
+ Array.isArray(value.data) &&
188
+ value.data.every((row) => Array.isArray(row)));
189
+ }
190
+ /**
191
+ * Type guard to check if a number is positive (> 0).
192
+ * @param value - The number to check
193
+ * @returns True if the number is positive
194
+ */
195
+ export const isPositive = (value) => {
196
+ return Number.isFinite(value) && value > 0;
197
+ };
198
+ /**
199
+ * Type guard to check if a number is negative (< 0).
200
+ * @param value - The number to check
201
+ * @returns True if the number is negative
202
+ */
203
+ export const isNegative = (value) => {
204
+ return Number.isFinite(value) && value < 0;
205
+ };
206
+ /**
207
+ * Type guard to check if a number is non-negative (>= 0).
208
+ * @param value - The number to check
209
+ * @returns True if the number is non-negative
210
+ */
211
+ export function isNonNegative(value) {
212
+ return Number.isFinite(value) && value >= 0;
213
+ }
214
+ /**
215
+ * Type guard to check if a number is non-positive (<= 0).
216
+ * @param value - The number to check
217
+ * @returns True if the number is non-positive
218
+ */
219
+ export function isNonPositive(value) {
220
+ return Number.isFinite(value) && value <= 0;
221
+ }
222
+ /**
223
+ * Checks if a number is zero (or very close to zero)
224
+ */
225
+ export const isZero = (value, epsilon = 1e-10) => {
226
+ return Number.isFinite(value) && Math.abs(value) < epsilon;
227
+ };
228
+ /**
229
+ * Type guard to check if a number is within a range (inclusive).
230
+ * @param value - The number to check
231
+ * @param min - Minimum value
232
+ * @param max - Maximum value
233
+ * @param inclusive - Whether the range is inclusive
234
+ * @returns True if the number is within the range
235
+ */
236
+ export function isInRange(value, min, max, inclusive = true) {
237
+ return inclusive ? value >= min && value <= max : value > min && value < max;
238
+ }
239
+ /**
240
+ * Type guard to check if a number is even.
241
+ * @param value - The number to check
242
+ * @returns True if the number is even
243
+ */
244
+ export function isEven(value) {
245
+ // return value % 2 === 0;
246
+ return (value & 1) === 0;
247
+ }
248
+ /**
249
+ * Type guard to check if a number is odd.
250
+ * @param value - The number to check
251
+ * @returns True if the number is odd
252
+ */
253
+ export function isOdd(value) {
254
+ // return value % 2 !== 0;
255
+ return (value & 1) === 1;
256
+ }
257
+ /**
258
+ * Checks if a number is prime.
259
+ * @param n - The number to check
260
+ * @returns True if the number is prime, false otherwise
261
+ */
262
+ export const isPrime = (n) => {
263
+ // First check if it's an integer
264
+ if (!Number.isInteger(n)) {
265
+ return false;
266
+ }
267
+ if (n <= 1)
268
+ return false;
269
+ if (n <= 3)
270
+ return true;
271
+ if (n % 2 === 0 || n % 3 === 0)
272
+ return false;
273
+ for (let i = 5; i * i <= n; i += 6) {
274
+ if (n % i === 0 || n % (i + 2) === 0)
275
+ return false;
276
+ }
277
+ return true;
278
+ };
279
+ /**
280
+ * Checks if two numbers are approximately equal.
281
+ * @param a - First number
282
+ * @param b - Second number
283
+ * @param epsilon - The maximum allowed difference between the numbers
284
+ * @returns True if the numbers are approximately equal, false otherwise
285
+ */
286
+ export const approxEqual = (a, b, epsilon = Math.E) => {
287
+ // Handle edge cases
288
+ if (a === b)
289
+ return true;
290
+ if (!Number.isFinite(a) || !Number.isFinite(b)) {
291
+ // Both are NaN or both are same infinity
292
+ return a === b;
293
+ }
294
+ // Use relative epsilon for better precision across different magnitudes
295
+ const absA = Math.abs(a);
296
+ const absB = Math.abs(b);
297
+ const diff = Math.abs(a - b);
298
+ // For very small numbers, use absolute epsilon
299
+ if (a === 0 || b === 0 || diff < epsilon) {
300
+ return diff < epsilon;
301
+ }
302
+ if (diff > epsilon)
303
+ return false;
304
+ // For larger numbers, use relative epsilon
305
+ const relativeError = diff / Math.min(absA + absB, Number.MAX_SAFE_INTEGER);
306
+ return relativeError < epsilon;
307
+ };
308
+ /**
309
+ * Checks if a number is a power of two
310
+ * @param n - The number to check
311
+ * Optimized: Bitwise trick
312
+ */
313
+ export const isPowerOfTwo = (n) => {
314
+ return n > 0 && (n & (n - 1)) === 0;
315
+ };
@@ -0,0 +1 @@
1
+ var s=r=>{let n=r.trim();if(n===""||!/^[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?$/.test(n))return!1;let e=Number(n);return Number.isFinite(e)},m=r=>typeof r=="number"?Number.isFinite(r):typeof r=="string"?s(r):!1,b=r=>{if(typeof r=="number")return Number.isInteger(r);if(typeof r=="string"){let e=r.trim();if(!e||!/^[-+]?\d+$/.test(e))return!1;let t=Number(e);return Number.isInteger(t)&&Number.isFinite(t)}if(typeof r=="boolean"||r==null||Array.isArray(r))return!1;let n=Number(r);return!Number.isNaN(n)&&Number.isInteger(n)&&Number.isFinite(n)},f=r=>typeof r=="number"&&Number.isFinite(r),a=r=>typeof r=="number"&&Number.isSafeInteger(r),p=r=>typeof r!="number"||!Number.isFinite(r)?!1:!Number.isInteger(r);function y(r){return Number.isInteger(r)}function c(r){return Number.isFinite(r)}function N(r){return typeof r=="object"&&r!==null&&"x"in r&&"y"in r&&typeof r.x=="number"&&typeof r.y=="number"}function x(r){return typeof r=="object"&&r!==null&&"x"in r&&"y"in r&&"z"in r&&typeof r.x=="number"&&typeof r.y=="number"&&typeof r.z=="number"}function g(r){return typeof r=="object"&&r!==null&&"real"in r&&"imag"in r&&typeof r.real=="number"&&typeof r.imag=="number"}function F(r){return typeof r=="object"&&r!==null&&"numerator"in r&&"denominator"in r&&typeof r.numerator=="number"&&typeof r.denominator=="number"&&r.denominator!==0}function d(r){return typeof r=="object"&&r!==null&&"rows"in r&&"columns"in r&&"data"in r&&typeof r.rows=="number"&&typeof r.columns=="number"&&Array.isArray(r.data)&&r.data.every(n=>Array.isArray(n))}var w=r=>Number.isFinite(r)&&r>0,I=r=>Number.isFinite(r)&&r<0;function k(r){return Number.isFinite(r)&&r>=0}function A(r){return Number.isFinite(r)&&r<=0}var E=(r,n=1e-10)=>Number.isFinite(r)&&Math.abs(r)<n;function M(r,n,e,t=!0){return t?r>=n&&r<=e:r>n&&r<e}function j(r){return(r&1)===0}function l(r){return(r&1)===1}var h=r=>{if(!Number.isInteger(r)||r<=1)return!1;if(r<=3)return!0;if(r%2===0||r%3===0)return!1;for(let n=5;n*n<=r;n+=6)if(r%n===0||r%(n+2)===0)return!1;return!0},D=(r,n,e=Math.E)=>{if(r===n)return!0;if(!Number.isFinite(r)||!Number.isFinite(n))return r===n;let t=Math.abs(r),i=Math.abs(n),o=Math.abs(r-n);return r===0||n===0||o<e?o<e:o>e?!1:o/Math.min(t+i,Number.MAX_SAFE_INTEGER)<e},V=r=>r>0&&(r&r-1)===0;export{D as approxEqual,g as isComplexNumber,j as isEven,c as isFiniteNumber,p as isFloat,F as isFraction,M as isInRange,b as isInt,y as isInteger,d as isMatrix,I as isNegative,k as isNonNegative,A as isNonPositive,f as isNumber,m as isNumeric,s as isNumericString,l as isOdd,w as isPositive,V as isPowerOfTwo,h as isPrime,a as isSafeInteger,N as isVector2D,x as isVector3D,E as isZero};