@fluixi/utils 1.0.0-alpha.100

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 (364) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +68 -0
  3. package/dist/index.cjs +2858 -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 +2838 -0
  8. package/dist/lib/array/advanced.cjs +2227 -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 +2204 -0
  13. package/dist/lib/array/array.cjs +57 -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 +36 -0
  18. package/dist/lib/array/index.cjs +2344 -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 +2322 -0
  23. package/dist/lib/array/utils.cjs +103 -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 +82 -0
  28. package/dist/lib/color/color.cjs +2190 -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 +2167 -0
  33. package/dist/lib/color/constants.cjs +380 -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 +359 -0
  38. package/dist/lib/color/conversions.cjs +629 -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 +608 -0
  43. package/dist/lib/color/helpers.cjs +2534 -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 +2511 -0
  48. package/dist/lib/color/index.cjs +2641 -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 +2619 -0
  53. package/dist/lib/color/types.cjs +18 -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 +962 -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 +939 -0
  63. package/dist/lib/compare/comparators.cjs +171 -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 +150 -0
  68. package/dist/lib/compare/index.cjs +172 -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 +152 -0
  73. package/dist/lib/cookie/codec.cjs +72 -0
  74. package/dist/lib/cookie/codec.d.ts +22 -0
  75. package/dist/lib/cookie/codec.d.ts.map +1 -0
  76. package/dist/lib/cookie/codec.js +67 -0
  77. package/dist/lib/cookie/codec.mjs +51 -0
  78. package/dist/lib/cookie/index.cjs +75 -0
  79. package/dist/lib/cookie/index.d.ts +2 -0
  80. package/dist/lib/cookie/index.d.ts.map +1 -0
  81. package/dist/lib/cookie/index.js +1 -0
  82. package/dist/lib/cookie/index.mjs +53 -0
  83. package/dist/lib/crypto/hash.cjs +83 -0
  84. package/dist/lib/crypto/hash.d.ts +6 -0
  85. package/dist/lib/crypto/hash.d.ts.map +1 -0
  86. package/dist/lib/crypto/hash.js +53 -0
  87. package/dist/lib/crypto/hash.mjs +62 -0
  88. package/dist/lib/crypto/index.cjs +85 -0
  89. package/dist/lib/crypto/index.d.ts +2 -0
  90. package/dist/lib/crypto/index.d.ts.map +1 -0
  91. package/dist/lib/crypto/index.js +1 -0
  92. package/dist/lib/crypto/index.mjs +62 -0
  93. package/dist/lib/dom/events.cjs +40 -0
  94. package/dist/lib/dom/events.d.ts +159 -0
  95. package/dist/lib/dom/events.d.ts.map +1 -0
  96. package/dist/lib/dom/events.js +50 -0
  97. package/dist/lib/dom/events.mjs +19 -0
  98. package/dist/lib/dom/index.cjs +78 -0
  99. package/dist/lib/dom/index.d.ts +3 -0
  100. package/dist/lib/dom/index.d.ts.map +1 -0
  101. package/dist/lib/dom/index.js +2 -0
  102. package/dist/lib/dom/index.mjs +56 -0
  103. package/dist/lib/dom/utils.cjs +57 -0
  104. package/dist/lib/dom/utils.d.ts +6 -0
  105. package/dist/lib/dom/utils.d.ts.map +1 -0
  106. package/dist/lib/dom/utils.js +37 -0
  107. package/dist/lib/dom/utils.mjs +36 -0
  108. package/dist/lib/functions/functions.cjs +366 -0
  109. package/dist/lib/functions/functions.d.ts +329 -0
  110. package/dist/lib/functions/functions.d.ts.map +1 -0
  111. package/dist/lib/functions/functions.js +585 -0
  112. package/dist/lib/functions/functions.mjs +345 -0
  113. package/dist/lib/functions/index.cjs +369 -0
  114. package/dist/lib/functions/index.d.ts +3 -0
  115. package/dist/lib/functions/index.d.ts.map +1 -0
  116. package/dist/lib/functions/index.js +1 -0
  117. package/dist/lib/functions/index.mjs +347 -0
  118. package/dist/lib/functions/types.cjs +18 -0
  119. package/dist/lib/functions/types.d.ts +2 -0
  120. package/dist/lib/functions/types.d.ts.map +1 -0
  121. package/dist/lib/functions/types.js +1 -0
  122. package/dist/lib/functions/types.mjs +0 -0
  123. package/dist/lib/helpers.cjs +78 -0
  124. package/dist/lib/helpers.d.ts +13 -0
  125. package/dist/lib/helpers.d.ts.map +1 -0
  126. package/dist/lib/helpers.js +66 -0
  127. package/dist/lib/helpers.mjs +59 -0
  128. package/dist/lib/index.cjs +2857 -0
  129. package/dist/lib/index.d.ts +6 -0
  130. package/dist/lib/index.d.ts.map +1 -0
  131. package/dist/lib/index.js +8 -0
  132. package/dist/lib/index.mjs +2836 -0
  133. package/dist/lib/maths/constants.cjs +70 -0
  134. package/dist/lib/maths/constants.d.ts +84 -0
  135. package/dist/lib/maths/constants.d.ts.map +1 -0
  136. package/dist/lib/maths/constants.js +79 -0
  137. package/dist/lib/maths/constants.mjs +50 -0
  138. package/dist/lib/maths/fn/advanced.cjs +231 -0
  139. package/dist/lib/maths/fn/advanced.d.ts +149 -0
  140. package/dist/lib/maths/fn/advanced.d.ts.map +1 -0
  141. package/dist/lib/maths/fn/advanced.js +264 -0
  142. package/dist/lib/maths/fn/advanced.mjs +208 -0
  143. package/dist/lib/maths/fn/basic.cjs +212 -0
  144. package/dist/lib/maths/fn/basic.d.ts +182 -0
  145. package/dist/lib/maths/fn/basic.d.ts.map +1 -0
  146. package/dist/lib/maths/fn/basic.js +343 -0
  147. package/dist/lib/maths/fn/basic.mjs +191 -0
  148. package/dist/lib/maths/fn/complex.cjs +268 -0
  149. package/dist/lib/maths/fn/complex.d.ts +153 -0
  150. package/dist/lib/maths/fn/complex.d.ts.map +1 -0
  151. package/dist/lib/maths/fn/complex.js +383 -0
  152. package/dist/lib/maths/fn/complex.mjs +247 -0
  153. package/dist/lib/maths/fn/index.cjs +877 -0
  154. package/dist/lib/maths/fn/index.d.ts +10 -0
  155. package/dist/lib/maths/fn/index.d.ts.map +1 -0
  156. package/dist/lib/maths/fn/index.js +9 -0
  157. package/dist/lib/maths/fn/index.mjs +855 -0
  158. package/dist/lib/maths/fn/trigo.cjs +179 -0
  159. package/dist/lib/maths/fn/trigo.d.ts +147 -0
  160. package/dist/lib/maths/fn/trigo.d.ts.map +1 -0
  161. package/dist/lib/maths/fn/trigo.js +227 -0
  162. package/dist/lib/maths/fn/trigo.mjs +156 -0
  163. package/dist/lib/maths/fn/vector.cjs +728 -0
  164. package/dist/lib/maths/fn/vector.d.ts +512 -0
  165. package/dist/lib/maths/fn/vector.d.ts.map +1 -0
  166. package/dist/lib/maths/fn/vector.js +1136 -0
  167. package/dist/lib/maths/fn/vector.mjs +707 -0
  168. package/dist/lib/maths/formatter.cjs +61 -0
  169. package/dist/lib/maths/formatter.d.ts +35 -0
  170. package/dist/lib/maths/formatter.d.ts.map +1 -0
  171. package/dist/lib/maths/formatter.js +56 -0
  172. package/dist/lib/maths/formatter.mjs +40 -0
  173. package/dist/lib/maths/guards.cjs +164 -0
  174. package/dist/lib/maths/guards.d.ts +166 -0
  175. package/dist/lib/maths/guards.d.ts.map +1 -0
  176. package/dist/lib/maths/guards.js +315 -0
  177. package/dist/lib/maths/guards.mjs +144 -0
  178. package/dist/lib/maths/index.cjs +1152 -0
  179. package/dist/lib/maths/index.d.ts +24 -0
  180. package/dist/lib/maths/index.d.ts.map +1 -0
  181. package/dist/lib/maths/index.js +29 -0
  182. package/dist/lib/maths/index.mjs +1130 -0
  183. package/dist/lib/maths/parser.cjs +75 -0
  184. package/dist/lib/maths/parser.d.ts +20 -0
  185. package/dist/lib/maths/parser.d.ts.map +1 -0
  186. package/dist/lib/maths/parser.js +78 -0
  187. package/dist/lib/maths/parser.mjs +54 -0
  188. package/dist/lib/maths/random.cjs +49 -0
  189. package/dist/lib/maths/random.d.ts +27 -0
  190. package/dist/lib/maths/random.d.ts.map +1 -0
  191. package/dist/lib/maths/random.js +49 -0
  192. package/dist/lib/maths/random.mjs +28 -0
  193. package/dist/lib/maths/types/advanced.cjs +18 -0
  194. package/dist/lib/maths/types/advanced.d.ts +357 -0
  195. package/dist/lib/maths/types/advanced.d.ts.map +1 -0
  196. package/dist/lib/maths/types/advanced.js +5 -0
  197. package/dist/lib/maths/types/advanced.mjs +0 -0
  198. package/dist/lib/maths/types/basic.cjs +18 -0
  199. package/dist/lib/maths/types/basic.d.ts +95 -0
  200. package/dist/lib/maths/types/basic.d.ts.map +1 -0
  201. package/dist/lib/maths/types/basic.js +5 -0
  202. package/dist/lib/maths/types/basic.mjs +0 -0
  203. package/dist/lib/maths/types/index.cjs +19 -0
  204. package/dist/lib/maths/types/index.d.ts +4 -0
  205. package/dist/lib/maths/types/index.d.ts.map +1 -0
  206. package/dist/lib/maths/types/index.js +3 -0
  207. package/dist/lib/maths/types/index.mjs +1 -0
  208. package/dist/lib/maths/types/negative.cjs +18 -0
  209. package/dist/lib/maths/types/negative.d.ts +51 -0
  210. package/dist/lib/maths/types/negative.d.ts.map +1 -0
  211. package/dist/lib/maths/types/negative.js +5 -0
  212. package/dist/lib/maths/types/negative.mjs +0 -0
  213. package/dist/lib/maths/types/operations.cjs +18 -0
  214. package/dist/lib/maths/types/operations.d.ts +188 -0
  215. package/dist/lib/maths/types/operations.d.ts.map +1 -0
  216. package/dist/lib/maths/types/operations.js +6 -0
  217. package/dist/lib/maths/types/operations.mjs +0 -0
  218. package/dist/lib/object/clone.cjs +88 -0
  219. package/dist/lib/object/clone.d.ts +46 -0
  220. package/dist/lib/object/clone.d.ts.map +1 -0
  221. package/dist/lib/object/clone.js +104 -0
  222. package/dist/lib/object/clone.mjs +65 -0
  223. package/dist/lib/object/diff.cjs +573 -0
  224. package/dist/lib/object/diff.d.ts +203 -0
  225. package/dist/lib/object/diff.d.ts.map +1 -0
  226. package/dist/lib/object/diff.js +805 -0
  227. package/dist/lib/object/diff.mjs +550 -0
  228. package/dist/lib/object/getter-setter.cjs +2351 -0
  229. package/dist/lib/object/getter-setter.d.ts +361 -0
  230. package/dist/lib/object/getter-setter.d.ts.map +1 -0
  231. package/dist/lib/object/getter-setter.js +1771 -0
  232. package/dist/lib/object/getter-setter.mjs +2330 -0
  233. package/dist/lib/object/index.cjs +3956 -0
  234. package/dist/lib/object/index.d.ts +13 -0
  235. package/dist/lib/object/index.d.ts.map +1 -0
  236. package/dist/lib/object/index.js +12 -0
  237. package/dist/lib/object/index.mjs +3936 -0
  238. package/dist/lib/object/merge.cjs +1029 -0
  239. package/dist/lib/object/merge.d.ts +93 -0
  240. package/dist/lib/object/merge.d.ts.map +1 -0
  241. package/dist/lib/object/merge.js +474 -0
  242. package/dist/lib/object/merge.mjs +1006 -0
  243. package/dist/lib/object/object.cjs +280 -0
  244. package/dist/lib/object/object.d.ts +128 -0
  245. package/dist/lib/object/object.d.ts.map +1 -0
  246. package/dist/lib/object/object.js +432 -0
  247. package/dist/lib/object/object.mjs +257 -0
  248. package/dist/lib/object/omit.cjs +2022 -0
  249. package/dist/lib/object/omit.d.ts +351 -0
  250. package/dist/lib/object/omit.d.ts.map +1 -0
  251. package/dist/lib/object/omit.js +656 -0
  252. package/dist/lib/object/omit.mjs +1999 -0
  253. package/dist/lib/object/reconcile.cjs +126 -0
  254. package/dist/lib/object/reconcile.d.ts +7 -0
  255. package/dist/lib/object/reconcile.d.ts.map +1 -0
  256. package/dist/lib/object/reconcile.js +122 -0
  257. package/dist/lib/object/reconcile.mjs +105 -0
  258. package/dist/lib/object/selector.cjs +303 -0
  259. package/dist/lib/object/selector.d.ts +50 -0
  260. package/dist/lib/object/selector.d.ts.map +1 -0
  261. package/dist/lib/object/selector.js +371 -0
  262. package/dist/lib/object/selector.mjs +282 -0
  263. package/dist/lib/object/sort.cjs +209 -0
  264. package/dist/lib/object/sort.d.ts +149 -0
  265. package/dist/lib/object/sort.d.ts.map +1 -0
  266. package/dist/lib/object/sort.js +298 -0
  267. package/dist/lib/object/sort.mjs +186 -0
  268. package/dist/lib/object/transform.cjs +2211 -0
  269. package/dist/lib/object/transform.d.ts +620 -0
  270. package/dist/lib/object/transform.d.ts.map +1 -0
  271. package/dist/lib/object/transform.js +1058 -0
  272. package/dist/lib/object/transform.mjs +2190 -0
  273. package/dist/lib/object/types.cjs +18 -0
  274. package/dist/lib/object/types.d.ts +250 -0
  275. package/dist/lib/object/types.d.ts.map +1 -0
  276. package/dist/lib/object/types.js +1 -0
  277. package/dist/lib/object/types.mjs +0 -0
  278. package/dist/lib/object/utils.cjs +326 -0
  279. package/dist/lib/object/utils.d.ts +165 -0
  280. package/dist/lib/object/utils.d.ts.map +1 -0
  281. package/dist/lib/object/utils.js +444 -0
  282. package/dist/lib/object/utils.mjs +305 -0
  283. package/dist/lib/primitive/boolean/boolean.cjs +407 -0
  284. package/dist/lib/primitive/boolean/boolean.d.ts +276 -0
  285. package/dist/lib/primitive/boolean/boolean.d.ts.map +1 -0
  286. package/dist/lib/primitive/boolean/boolean.js +615 -0
  287. package/dist/lib/primitive/boolean/boolean.mjs +386 -0
  288. package/dist/lib/primitive/boolean/index.cjs +382 -0
  289. package/dist/lib/primitive/boolean/index.d.ts +3 -0
  290. package/dist/lib/primitive/boolean/index.d.ts.map +1 -0
  291. package/dist/lib/primitive/boolean/index.js +2 -0
  292. package/dist/lib/primitive/boolean/index.mjs +359 -0
  293. package/dist/lib/primitive/boolean/types.cjs +18 -0
  294. package/dist/lib/primitive/boolean/types.d.ts +14 -0
  295. package/dist/lib/primitive/boolean/types.d.ts.map +1 -0
  296. package/dist/lib/primitive/boolean/types.js +1 -0
  297. package/dist/lib/primitive/boolean/types.mjs +0 -0
  298. package/dist/lib/primitive/date/date.cjs +1126 -0
  299. package/dist/lib/primitive/date/date.d.ts +641 -0
  300. package/dist/lib/primitive/date/date.d.ts.map +1 -0
  301. package/dist/lib/primitive/date/date.js +1998 -0
  302. package/dist/lib/primitive/date/date.mjs +1105 -0
  303. package/dist/lib/primitive/date/index.cjs +1128 -0
  304. package/dist/lib/primitive/date/index.d.ts +3 -0
  305. package/dist/lib/primitive/date/index.d.ts.map +1 -0
  306. package/dist/lib/primitive/date/index.js +2 -0
  307. package/dist/lib/primitive/date/index.mjs +1105 -0
  308. package/dist/lib/primitive/date/types.cjs +18 -0
  309. package/dist/lib/primitive/date/types.d.ts +205 -0
  310. package/dist/lib/primitive/date/types.d.ts.map +1 -0
  311. package/dist/lib/primitive/date/types.js +7 -0
  312. package/dist/lib/primitive/date/types.mjs +0 -0
  313. package/dist/lib/primitive/index.cjs +2338 -0
  314. package/dist/lib/primitive/index.d.ts +5 -0
  315. package/dist/lib/primitive/index.d.ts.map +1 -0
  316. package/dist/lib/primitive/index.js +4 -0
  317. package/dist/lib/primitive/index.mjs +2316 -0
  318. package/dist/lib/primitive/string/index.cjs +875 -0
  319. package/dist/lib/primitive/string/index.d.ts +3 -0
  320. package/dist/lib/primitive/string/index.d.ts.map +1 -0
  321. package/dist/lib/primitive/string/index.js +2 -0
  322. package/dist/lib/primitive/string/index.mjs +852 -0
  323. package/dist/lib/primitive/string/parser-2.cjs +543 -0
  324. package/dist/lib/primitive/string/parser-2.d.ts +17 -0
  325. package/dist/lib/primitive/string/parser-2.d.ts.map +1 -0
  326. package/dist/lib/primitive/string/parser-2.js +656 -0
  327. package/dist/lib/primitive/string/parser-2.mjs +522 -0
  328. package/dist/lib/primitive/string/parser.cjs +236 -0
  329. package/dist/lib/primitive/string/parser.d.ts +9 -0
  330. package/dist/lib/primitive/string/parser.d.ts.map +1 -0
  331. package/dist/lib/primitive/string/parser.js +775 -0
  332. package/dist/lib/primitive/string/parser.mjs +215 -0
  333. package/dist/lib/primitive/string/string.cjs +926 -0
  334. package/dist/lib/primitive/string/string.d.ts +535 -0
  335. package/dist/lib/primitive/string/string.d.ts.map +1 -0
  336. package/dist/lib/primitive/string/string.js +1301 -0
  337. package/dist/lib/primitive/string/string.mjs +903 -0
  338. package/dist/lib/primitive/string/types.cjs +18 -0
  339. package/dist/lib/primitive/string/types.d.ts +318 -0
  340. package/dist/lib/primitive/string/types.d.ts.map +1 -0
  341. package/dist/lib/primitive/string/types.js +5 -0
  342. package/dist/lib/primitive/string/types.mjs +0 -0
  343. package/dist/lib/primitive/types.cjs +18 -0
  344. package/dist/lib/primitive/types.d.ts +27 -0
  345. package/dist/lib/primitive/types.d.ts.map +1 -0
  346. package/dist/lib/primitive/types.js +1 -0
  347. package/dist/lib/primitive/types.mjs +0 -0
  348. package/dist/lib/url/index.cjs +327 -0
  349. package/dist/lib/url/index.d.ts +3 -0
  350. package/dist/lib/url/index.d.ts.map +1 -0
  351. package/dist/lib/url/index.js +2 -0
  352. package/dist/lib/url/index.mjs +304 -0
  353. package/dist/lib/url/parser.cjs +325 -0
  354. package/dist/lib/url/parser.d.ts +216 -0
  355. package/dist/lib/url/parser.d.ts.map +1 -0
  356. package/dist/lib/url/parser.js +488 -0
  357. package/dist/lib/url/parser.mjs +304 -0
  358. package/dist/lib/url/types.cjs +18 -0
  359. package/dist/lib/url/types.d.ts +18 -0
  360. package/dist/lib/url/types.d.ts.map +1 -0
  361. package/dist/lib/url/types.js +1 -0
  362. package/dist/lib/url/types.mjs +0 -0
  363. package/dist/tsconfig.lib.tsbuildinfo +1 -0
  364. package/package.json +127 -0
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/lib/array/utils.ts
21
+ var utils_exports = {};
22
+ __export(utils_exports, {
23
+ at: () => at,
24
+ first: () => first,
25
+ flattenArray: () => flattenArray,
26
+ groupArrayBy: () => groupArrayBy,
27
+ isArray: () => isArray,
28
+ isArrayLike: () => isArrayLike,
29
+ isDoubleArray: () => isDoubleArray,
30
+ isEmptyArray: () => isEmptyArray,
31
+ isIterable: () => isIterable,
32
+ isNonEmptyArray: () => isNonEmptyArray,
33
+ isObjectArray: () => isObjectArray,
34
+ isReadonlyArray: () => isReadonlyArray,
35
+ isStaticArray: () => isStaticArray,
36
+ isTypedArray: () => isTypedArray,
37
+ last: () => last,
38
+ toArray: () => toArray
39
+ });
40
+ module.exports = __toCommonJS(utils_exports);
41
+ var import_object = require("@fluixi/utils/object");
42
+ var isObjectArray = (value) => {
43
+ return Array.isArray(value) && value.every((item) => (0, import_object.isObject)(item));
44
+ };
45
+ function isArray(v) {
46
+ return Array.isArray(v);
47
+ }
48
+ function isStaticArray(v) {
49
+ return Array.isArray(v);
50
+ }
51
+ function isDoubleArray(v) {
52
+ return Array.isArray(v) && v.every((item) => Array.isArray(item) && item.length === 2);
53
+ }
54
+ function isIterable(v) {
55
+ return v != null && typeof v[Symbol.iterator] === "function";
56
+ }
57
+ function isArrayLike(v) {
58
+ return v != null && typeof v === "object" && "length" in v && typeof v.length === "number" && v.length >= 0 && (v.length === 0 || v.length - 1 in v);
59
+ }
60
+ function isEmptyArray(v) {
61
+ return Array.isArray(v) && v.length === 0;
62
+ }
63
+ function isNonEmptyArray(v) {
64
+ return Array.isArray(v) && v.length > 0;
65
+ }
66
+ function isTypedArray(v) {
67
+ return ArrayBuffer.isView(v) && !(v instanceof DataView);
68
+ }
69
+ function isReadonlyArray(v) {
70
+ return Array.isArray(v);
71
+ }
72
+ function last(arr) {
73
+ return arr.length > 0 ? arr[arr.length - 1] : void 0;
74
+ }
75
+ function first(arr) {
76
+ return arr.length > 0 ? arr[0] : void 0;
77
+ }
78
+ function toArray(iterable) {
79
+ if (Array.isArray(iterable)) {
80
+ return [...iterable];
81
+ }
82
+ if (isIterable(iterable)) {
83
+ return [...iterable];
84
+ }
85
+ return Array.from(iterable);
86
+ }
87
+ function groupArrayBy(arr, keyFn) {
88
+ return arr.reduce((groups, item) => {
89
+ const key = keyFn(item);
90
+ if (!groups[key]) {
91
+ groups[key] = [];
92
+ }
93
+ groups[key].push(item);
94
+ return groups;
95
+ }, {});
96
+ }
97
+ function flattenArray(arr) {
98
+ return arr.flat();
99
+ }
100
+ function at(arr, index) {
101
+ const normalizedIndex = index < 0 ? arr.length + index : index;
102
+ return arr[normalizedIndex];
103
+ }
@@ -0,0 +1,100 @@
1
+ import { type AnyObject } from '@fluixi/utils/object';
2
+ /**
3
+ * Type guard to check if a value is an object array
4
+ * @param value - Value to check
5
+ * @returns True if value is an object array
6
+ */
7
+ export declare const isObjectArray: (value: any) => value is AnyObject[];
8
+ /**
9
+ * Type guard to check if a value is an array
10
+ * @param v - Value to check
11
+ * @returns True if value is an array
12
+ */
13
+ export declare function isArray<T = any>(v: unknown): v is T[];
14
+ /**
15
+ * Type guard to check if a value is a static array
16
+ * @param v - Value to check
17
+ * @returns True if value is a static array
18
+ */
19
+ export declare function isStaticArray<T = any, U = any>(v: unknown): v is [T, U];
20
+ /**
21
+ * Type guard to check if a value is an array of 2-item tuples: [T, U][]
22
+ * @param v - Value to check
23
+ * @returns True if value is an array of 2-item tuples
24
+ */
25
+ export declare function isDoubleArray<T = any, U = any>(v: unknown): v is [T, U][];
26
+ /**
27
+ * Type guard to check if a value is iterable
28
+ * @param v - Value to check
29
+ * @returns True if value is iterable
30
+ */
31
+ export declare function isIterable(v: unknown): v is Iterable<unknown>;
32
+ /**
33
+ * Type guard to check if a value is array-like
34
+ * @param v - Value to check
35
+ * @returns True if value is array-like
36
+ */
37
+ export declare function isArrayLike(v: unknown): v is ArrayLike<unknown>;
38
+ /**
39
+ * Type guard to check if an array is empty
40
+ * @param v - Array to check
41
+ * @returns True if array is empty
42
+ */
43
+ export declare function isEmptyArray<T>(v: T[]): boolean;
44
+ /**
45
+ * Type guard to check if a value is a non-empty array
46
+ * @param v - Value to check
47
+ * @returns True if value is a non-empty array
48
+ */
49
+ export declare function isNonEmptyArray<T>(v: unknown): v is [T, ...T[]];
50
+ /**
51
+ * Type guard to check if a value is a typed array
52
+ * @param v - Value to check
53
+ * @returns True if value is a typed array (Int8Array, Uint8Array, etc.)
54
+ */
55
+ export declare function isTypedArray(v: unknown): v is Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array;
56
+ /**
57
+ * Type guard to check if a value is a readonly array
58
+ * @param v - Value to check
59
+ * @returns True if value is a readonly array
60
+ */
61
+ export declare function isReadonlyArray<T = any>(v: unknown): v is readonly T[];
62
+ /**
63
+ * Safely get the last element of an array
64
+ * @param arr - Array to get last element from
65
+ * @returns Last element or undefined if array is empty
66
+ */
67
+ export declare function last<T>(arr: T[]): T | undefined;
68
+ /**
69
+ * Safely get the first element of an array
70
+ * @param arr - Array to get first element from
71
+ * @returns First element or undefined if array is empty
72
+ */
73
+ export declare function first<T>(arr: T[]): T | undefined;
74
+ /**
75
+ * Create an array from an iterable or array-like object with type safety
76
+ * @param iterable - Iterable or array-like object
77
+ * @returns Array from the iterable
78
+ */
79
+ export declare function toArray<T>(iterable: Iterable<T> | ArrayLike<T>): T[];
80
+ /**
81
+ * Group array items by a key
82
+ * @param arr - Array to group
83
+ * @param keyFn - Function to extract group key
84
+ * @returns Object with keys mapping to arrays of items
85
+ */
86
+ export declare function groupArrayBy<T, K extends string | number | symbol>(arr: T[], keyFn: (item: T) => K): Record<K, T[]>;
87
+ /**
88
+ * Flatten an array of arrays
89
+ * @param arr - Array of arrays to flatten
90
+ * @returns Flattened array
91
+ */
92
+ export declare function flattenArray<T>(arr: T[][]): T[];
93
+ /**
94
+ * Get array element by index with support for negative indices
95
+ * @param arr - Array to get element from
96
+ * @param index - Index (negative counts from end)
97
+ * @returns Element at index or undefined if out of bounds
98
+ */
99
+ export declare function at<T>(arr: T[], index: number): T | undefined;
100
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/lib/array/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEhE;;;;GAIG;AACH,eAAO,MAAM,aAAa,GAAI,OAAO,GAAG,KAAG,KAAK,IAAI,SAAS,EAE5D,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,CAAC,EAAE,CAErD;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAEvE;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAKzE;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,QAAQ,CAAC,OAAO,CAAC,CAE7D;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,SAAS,CAAC,OAAO,CAAC,CAS/D;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,OAAO,CAE/C;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAE/D;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAC1B,CAAC,EAAE,OAAO,GACT,CAAC,IACA,SAAS,GACT,UAAU,GACV,iBAAiB,GACjB,UAAU,GACV,WAAW,GACX,UAAU,GACV,WAAW,GACX,YAAY,GACZ,YAAY,GACZ,aAAa,GACb,cAAc,CAEjB;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,SAAS,CAAC,EAAE,CAEtE;AAED;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,CAAC,GAAG,SAAS,CAE/C;AAED;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,CAAC,GAAG,SAAS,CAEhD;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAQpE;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,EAChE,GAAG,EAAE,CAAC,EAAE,EACR,KAAK,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GACpB,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAShB;AAkBD;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,GAAG,CAAC,EAAE,CAE/C;AAED;;;;;GAKG;AACH,wBAAgB,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS,CAG5D"}
@@ -0,0 +1,165 @@
1
+ import { isObject } from '@fluixi/utils/object';
2
+ /**
3
+ * Type guard to check if a value is an object array
4
+ * @param value - Value to check
5
+ * @returns True if value is an object array
6
+ */
7
+ export const isObjectArray = (value) => {
8
+ return Array.isArray(value) && value.every((item) => isObject(item));
9
+ };
10
+ /**
11
+ * Type guard to check if a value is an array
12
+ * @param v - Value to check
13
+ * @returns True if value is an array
14
+ */
15
+ export function isArray(v) {
16
+ return Array.isArray(v);
17
+ }
18
+ /**
19
+ * Type guard to check if a value is a static array
20
+ * @param v - Value to check
21
+ * @returns True if value is a static array
22
+ */
23
+ export function isStaticArray(v) {
24
+ return Array.isArray(v);
25
+ }
26
+ /**
27
+ * Type guard to check if a value is an array of 2-item tuples: [T, U][]
28
+ * @param v - Value to check
29
+ * @returns True if value is an array of 2-item tuples
30
+ */
31
+ export function isDoubleArray(v) {
32
+ return (Array.isArray(v) &&
33
+ v.every((item) => Array.isArray(item) && item.length === 2));
34
+ }
35
+ /**
36
+ * Type guard to check if a value is iterable
37
+ * @param v - Value to check
38
+ * @returns True if value is iterable
39
+ */
40
+ export function isIterable(v) {
41
+ return v != null && typeof v[Symbol.iterator] === 'function';
42
+ }
43
+ /**
44
+ * Type guard to check if a value is array-like
45
+ * @param v - Value to check
46
+ * @returns True if value is array-like
47
+ */
48
+ export function isArrayLike(v) {
49
+ return (v != null &&
50
+ typeof v === 'object' &&
51
+ 'length' in v &&
52
+ typeof v.length === 'number' &&
53
+ v.length >= 0 &&
54
+ (v.length === 0 || v.length - 1 in v));
55
+ }
56
+ /**
57
+ * Type guard to check if an array is empty
58
+ * @param v - Array to check
59
+ * @returns True if array is empty
60
+ */
61
+ export function isEmptyArray(v) {
62
+ return Array.isArray(v) && v.length === 0;
63
+ }
64
+ /**
65
+ * Type guard to check if a value is a non-empty array
66
+ * @param v - Value to check
67
+ * @returns True if value is a non-empty array
68
+ */
69
+ export function isNonEmptyArray(v) {
70
+ return Array.isArray(v) && v.length > 0;
71
+ }
72
+ /**
73
+ * Type guard to check if a value is a typed array
74
+ * @param v - Value to check
75
+ * @returns True if value is a typed array (Int8Array, Uint8Array, etc.)
76
+ */
77
+ export function isTypedArray(v) {
78
+ return ArrayBuffer.isView(v) && !(v instanceof DataView);
79
+ }
80
+ /**
81
+ * Type guard to check if a value is a readonly array
82
+ * @param v - Value to check
83
+ * @returns True if value is a readonly array
84
+ */
85
+ export function isReadonlyArray(v) {
86
+ return Array.isArray(v);
87
+ }
88
+ /**
89
+ * Safely get the last element of an array
90
+ * @param arr - Array to get last element from
91
+ * @returns Last element or undefined if array is empty
92
+ */
93
+ export function last(arr) {
94
+ return arr.length > 0 ? arr[arr.length - 1] : undefined;
95
+ }
96
+ /**
97
+ * Safely get the first element of an array
98
+ * @param arr - Array to get first element from
99
+ * @returns First element or undefined if array is empty
100
+ */
101
+ export function first(arr) {
102
+ return arr.length > 0 ? arr[0] : undefined;
103
+ }
104
+ /**
105
+ * Create an array from an iterable or array-like object with type safety
106
+ * @param iterable - Iterable or array-like object
107
+ * @returns Array from the iterable
108
+ */
109
+ export function toArray(iterable) {
110
+ if (Array.isArray(iterable)) {
111
+ return [...iterable];
112
+ }
113
+ if (isIterable(iterable)) {
114
+ return [...iterable];
115
+ }
116
+ return Array.from(iterable);
117
+ }
118
+ /**
119
+ * Group array items by a key
120
+ * @param arr - Array to group
121
+ * @param keyFn - Function to extract group key
122
+ * @returns Object with keys mapping to arrays of items
123
+ */
124
+ export function groupArrayBy(arr, keyFn) {
125
+ return arr.reduce((groups, item) => {
126
+ const key = keyFn(item);
127
+ if (!groups[key]) {
128
+ groups[key] = [];
129
+ }
130
+ groups[key].push(item);
131
+ return groups;
132
+ }, {});
133
+ }
134
+ // /**
135
+ // * Chunk an array into smaller arrays of specified size
136
+ // * @param arr - Array to chunk
137
+ // * @param size - Size of each chunk
138
+ // * @returns Array of chunks
139
+ // */
140
+ // export function chunk<T>(arr: T[], size: number): T[][] {
141
+ // if (size <= 0) return [];
142
+ // const chunks: T[][] = [];
143
+ // for (let i = 0; i < arr.length; i += size) {
144
+ // chunks.push(arr.slice(i, i + size));
145
+ // }
146
+ // return chunks;
147
+ // }
148
+ /**
149
+ * Flatten an array of arrays
150
+ * @param arr - Array of arrays to flatten
151
+ * @returns Flattened array
152
+ */
153
+ export function flattenArray(arr) {
154
+ return arr.flat();
155
+ }
156
+ /**
157
+ * Get array element by index with support for negative indices
158
+ * @param arr - Array to get element from
159
+ * @param index - Index (negative counts from end)
160
+ * @returns Element at index or undefined if out of bounds
161
+ */
162
+ export function at(arr, index) {
163
+ const normalizedIndex = index < 0 ? arr.length + index : index;
164
+ return arr[normalizedIndex];
165
+ }
@@ -0,0 +1,82 @@
1
+ // src/lib/array/utils.ts
2
+ import { isObject } from "@fluixi/utils/object";
3
+ var isObjectArray = (value) => {
4
+ return Array.isArray(value) && value.every((item) => isObject(item));
5
+ };
6
+ function isArray(v) {
7
+ return Array.isArray(v);
8
+ }
9
+ function isStaticArray(v) {
10
+ return Array.isArray(v);
11
+ }
12
+ function isDoubleArray(v) {
13
+ return Array.isArray(v) && v.every((item) => Array.isArray(item) && item.length === 2);
14
+ }
15
+ function isIterable(v) {
16
+ return v != null && typeof v[Symbol.iterator] === "function";
17
+ }
18
+ function isArrayLike(v) {
19
+ return v != null && typeof v === "object" && "length" in v && typeof v.length === "number" && v.length >= 0 && (v.length === 0 || v.length - 1 in v);
20
+ }
21
+ function isEmptyArray(v) {
22
+ return Array.isArray(v) && v.length === 0;
23
+ }
24
+ function isNonEmptyArray(v) {
25
+ return Array.isArray(v) && v.length > 0;
26
+ }
27
+ function isTypedArray(v) {
28
+ return ArrayBuffer.isView(v) && !(v instanceof DataView);
29
+ }
30
+ function isReadonlyArray(v) {
31
+ return Array.isArray(v);
32
+ }
33
+ function last(arr) {
34
+ return arr.length > 0 ? arr[arr.length - 1] : void 0;
35
+ }
36
+ function first(arr) {
37
+ return arr.length > 0 ? arr[0] : void 0;
38
+ }
39
+ function toArray(iterable) {
40
+ if (Array.isArray(iterable)) {
41
+ return [...iterable];
42
+ }
43
+ if (isIterable(iterable)) {
44
+ return [...iterable];
45
+ }
46
+ return Array.from(iterable);
47
+ }
48
+ function groupArrayBy(arr, keyFn) {
49
+ return arr.reduce((groups, item) => {
50
+ const key = keyFn(item);
51
+ if (!groups[key]) {
52
+ groups[key] = [];
53
+ }
54
+ groups[key].push(item);
55
+ return groups;
56
+ }, {});
57
+ }
58
+ function flattenArray(arr) {
59
+ return arr.flat();
60
+ }
61
+ function at(arr, index) {
62
+ const normalizedIndex = index < 0 ? arr.length + index : index;
63
+ return arr[normalizedIndex];
64
+ }
65
+ export {
66
+ at,
67
+ first,
68
+ flattenArray,
69
+ groupArrayBy,
70
+ isArray,
71
+ isArrayLike,
72
+ isDoubleArray,
73
+ isEmptyArray,
74
+ isIterable,
75
+ isNonEmptyArray,
76
+ isObjectArray,
77
+ isReadonlyArray,
78
+ isStaticArray,
79
+ isTypedArray,
80
+ last,
81
+ toArray
82
+ };