ts-data-forge 5.0.1 → 5.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (527) hide show
  1. package/README.md +55 -6
  2. package/dist/array/impl/array-utils-creation.d.mts +14 -0
  3. package/dist/array/impl/array-utils-creation.d.mts.map +1 -1
  4. package/dist/array/impl/array-utils-creation.mjs +12 -0
  5. package/dist/array/impl/array-utils-creation.mjs.map +1 -1
  6. package/dist/array/impl/array-utils-element-access.d.mts +10 -0
  7. package/dist/array/impl/array-utils-element-access.d.mts.map +1 -1
  8. package/dist/array/impl/array-utils-element-access.mjs +6 -0
  9. package/dist/array/impl/array-utils-element-access.mjs.map +1 -1
  10. package/dist/array/impl/array-utils-modification.d.mts +14 -0
  11. package/dist/array/impl/array-utils-modification.d.mts.map +1 -1
  12. package/dist/array/impl/array-utils-modification.mjs.map +1 -1
  13. package/dist/array/impl/array-utils-reducing-value.d.mts +26 -2
  14. package/dist/array/impl/array-utils-reducing-value.d.mts.map +1 -1
  15. package/dist/array/impl/array-utils-reducing-value.mjs.map +1 -1
  16. package/dist/array/impl/array-utils-search.d.mts +30 -0
  17. package/dist/array/impl/array-utils-search.d.mts.map +1 -1
  18. package/dist/array/impl/array-utils-search.mjs.map +1 -1
  19. package/dist/array/impl/array-utils-set-op.d.mts +13 -0
  20. package/dist/array/impl/array-utils-set-op.d.mts.map +1 -1
  21. package/dist/array/impl/array-utils-set-op.mjs +13 -0
  22. package/dist/array/impl/array-utils-set-op.mjs.map +1 -1
  23. package/dist/array/impl/array-utils-size.d.mts +3 -0
  24. package/dist/array/impl/array-utils-size.d.mts.map +1 -1
  25. package/dist/array/impl/array-utils-size.mjs +3 -0
  26. package/dist/array/impl/array-utils-size.mjs.map +1 -1
  27. package/dist/array/impl/array-utils-slice-clamped.d.mts +2 -0
  28. package/dist/array/impl/array-utils-slice-clamped.d.mts.map +1 -1
  29. package/dist/array/impl/array-utils-slice-clamped.mjs.map +1 -1
  30. package/dist/array/impl/array-utils-slicing.d.mts +15 -0
  31. package/dist/array/impl/array-utils-slicing.d.mts.map +1 -1
  32. package/dist/array/impl/array-utils-slicing.mjs +7 -0
  33. package/dist/array/impl/array-utils-slicing.mjs.map +1 -1
  34. package/dist/array/impl/array-utils-transformation.d.mts +27 -0
  35. package/dist/array/impl/array-utils-transformation.d.mts.map +1 -1
  36. package/dist/array/impl/array-utils-transformation.mjs +6 -0
  37. package/dist/array/impl/array-utils-transformation.mjs.map +1 -1
  38. package/dist/array/impl/array-utils-validation.d.mts +17 -0
  39. package/dist/array/impl/array-utils-validation.d.mts.map +1 -1
  40. package/dist/array/impl/array-utils-validation.mjs +11 -0
  41. package/dist/array/impl/array-utils-validation.mjs.map +1 -1
  42. package/dist/collections/imap-mapped.mjs.map +1 -1
  43. package/dist/collections/imap.d.mts +20 -0
  44. package/dist/collections/imap.d.mts.map +1 -1
  45. package/dist/collections/imap.mjs +2 -0
  46. package/dist/collections/imap.mjs.map +1 -1
  47. package/dist/collections/iset-mapped.d.mts +27 -0
  48. package/dist/collections/iset-mapped.d.mts.map +1 -1
  49. package/dist/collections/iset-mapped.mjs +7 -0
  50. package/dist/collections/iset-mapped.mjs.map +1 -1
  51. package/dist/collections/iset.d.mts +29 -0
  52. package/dist/collections/iset.d.mts.map +1 -1
  53. package/dist/collections/iset.mjs +7 -0
  54. package/dist/collections/iset.mjs.map +1 -1
  55. package/dist/collections/queue.d.mts +40 -0
  56. package/dist/collections/queue.d.mts.map +1 -1
  57. package/dist/collections/queue.mjs +8 -0
  58. package/dist/collections/queue.mjs.map +1 -1
  59. package/dist/collections/stack.d.mts +35 -0
  60. package/dist/collections/stack.d.mts.map +1 -1
  61. package/dist/collections/stack.mjs +7 -0
  62. package/dist/collections/stack.mjs.map +1 -1
  63. package/dist/entry-point.mjs +1 -1
  64. package/dist/functional/match.d.mts.map +1 -1
  65. package/dist/functional/match.mjs.map +1 -1
  66. package/dist/functional/optional/impl/optional-expect-to-be.d.mts +1 -0
  67. package/dist/functional/optional/impl/optional-expect-to-be.d.mts.map +1 -1
  68. package/dist/functional/optional/impl/optional-expect-to-be.mjs.map +1 -1
  69. package/dist/functional/optional/impl/optional-filter.d.mts +3 -0
  70. package/dist/functional/optional/impl/optional-filter.d.mts.map +1 -1
  71. package/dist/functional/optional/impl/optional-filter.mjs.map +1 -1
  72. package/dist/functional/optional/impl/optional-flat-map.d.mts +2 -0
  73. package/dist/functional/optional/impl/optional-flat-map.d.mts.map +1 -1
  74. package/dist/functional/optional/impl/optional-flat-map.mjs.map +1 -1
  75. package/dist/functional/optional/impl/optional-from-nullable.d.mts +2 -0
  76. package/dist/functional/optional/impl/optional-from-nullable.d.mts.map +1 -1
  77. package/dist/functional/optional/impl/optional-from-nullable.mjs +2 -0
  78. package/dist/functional/optional/impl/optional-from-nullable.mjs.map +1 -1
  79. package/dist/functional/optional/impl/optional-is-optional.d.mts +2 -0
  80. package/dist/functional/optional/impl/optional-is-optional.d.mts.map +1 -1
  81. package/dist/functional/optional/impl/optional-is-optional.mjs +2 -0
  82. package/dist/functional/optional/impl/optional-is-optional.mjs.map +1 -1
  83. package/dist/functional/optional/impl/optional-is-some.d.mts +1 -0
  84. package/dist/functional/optional/impl/optional-is-some.d.mts.map +1 -1
  85. package/dist/functional/optional/impl/optional-is-some.mjs +1 -0
  86. package/dist/functional/optional/impl/optional-is-some.mjs.map +1 -1
  87. package/dist/functional/optional/impl/optional-map.d.mts +2 -0
  88. package/dist/functional/optional/impl/optional-map.d.mts.map +1 -1
  89. package/dist/functional/optional/impl/optional-map.mjs.map +1 -1
  90. package/dist/functional/optional/impl/optional-none.d.mts +2 -0
  91. package/dist/functional/optional/impl/optional-none.d.mts.map +1 -1
  92. package/dist/functional/optional/impl/optional-none.mjs +2 -0
  93. package/dist/functional/optional/impl/optional-none.mjs.map +1 -1
  94. package/dist/functional/optional/impl/optional-or-else.d.mts +4 -0
  95. package/dist/functional/optional/impl/optional-or-else.d.mts.map +1 -1
  96. package/dist/functional/optional/impl/optional-or-else.mjs.map +1 -1
  97. package/dist/functional/optional/impl/optional-some.d.mts +3 -1
  98. package/dist/functional/optional/impl/optional-some.d.mts.map +1 -1
  99. package/dist/functional/optional/impl/optional-some.mjs +2 -0
  100. package/dist/functional/optional/impl/optional-some.mjs.map +1 -1
  101. package/dist/functional/optional/impl/optional-to-nullable.d.mts +2 -0
  102. package/dist/functional/optional/impl/optional-to-nullable.d.mts.map +1 -1
  103. package/dist/functional/optional/impl/optional-to-nullable.mjs +2 -0
  104. package/dist/functional/optional/impl/optional-to-nullable.mjs.map +1 -1
  105. package/dist/functional/optional/impl/optional-unwrap-or.d.mts +3 -0
  106. package/dist/functional/optional/impl/optional-unwrap-or.d.mts.map +1 -1
  107. package/dist/functional/optional/impl/optional-unwrap-or.mjs.map +1 -1
  108. package/dist/functional/optional/impl/optional-unwrap-throw.d.mts +1 -0
  109. package/dist/functional/optional/impl/optional-unwrap-throw.d.mts.map +1 -1
  110. package/dist/functional/optional/impl/optional-unwrap-throw.mjs +1 -0
  111. package/dist/functional/optional/impl/optional-unwrap-throw.mjs.map +1 -1
  112. package/dist/functional/optional/impl/optional-unwrap.d.mts +2 -0
  113. package/dist/functional/optional/impl/optional-unwrap.d.mts.map +1 -1
  114. package/dist/functional/optional/impl/optional-unwrap.mjs.map +1 -1
  115. package/dist/functional/optional/impl/optional-zip.d.mts +2 -0
  116. package/dist/functional/optional/impl/optional-zip.d.mts.map +1 -1
  117. package/dist/functional/optional/impl/optional-zip.mjs +2 -0
  118. package/dist/functional/optional/impl/optional-zip.mjs.map +1 -1
  119. package/dist/functional/result/impl/result-err.d.mts +3 -1
  120. package/dist/functional/result/impl/result-err.d.mts.map +1 -1
  121. package/dist/functional/result/impl/result-err.mjs +2 -0
  122. package/dist/functional/result/impl/result-err.mjs.map +1 -1
  123. package/dist/functional/result/impl/result-expect-to-be.d.mts +1 -0
  124. package/dist/functional/result/impl/result-expect-to-be.d.mts.map +1 -1
  125. package/dist/functional/result/impl/result-expect-to-be.mjs.map +1 -1
  126. package/dist/functional/result/impl/result-flat-map.d.mts +5 -0
  127. package/dist/functional/result/impl/result-flat-map.d.mts.map +1 -1
  128. package/dist/functional/result/impl/result-flat-map.mjs.map +1 -1
  129. package/dist/functional/result/impl/result-fold.d.mts +4 -0
  130. package/dist/functional/result/impl/result-fold.d.mts.map +1 -1
  131. package/dist/functional/result/impl/result-fold.mjs.map +1 -1
  132. package/dist/functional/result/impl/result-from-promise.d.mts +3 -0
  133. package/dist/functional/result/impl/result-from-promise.d.mts.map +1 -1
  134. package/dist/functional/result/impl/result-from-promise.mjs +3 -0
  135. package/dist/functional/result/impl/result-from-promise.mjs.map +1 -1
  136. package/dist/functional/result/impl/result-from-throwable.d.mts +2 -0
  137. package/dist/functional/result/impl/result-from-throwable.d.mts.map +1 -1
  138. package/dist/functional/result/impl/result-from-throwable.mjs +2 -0
  139. package/dist/functional/result/impl/result-from-throwable.mjs.map +1 -1
  140. package/dist/functional/result/impl/result-is-err.d.mts +2 -0
  141. package/dist/functional/result/impl/result-is-err.d.mts.map +1 -1
  142. package/dist/functional/result/impl/result-is-err.mjs +2 -0
  143. package/dist/functional/result/impl/result-is-err.mjs.map +1 -1
  144. package/dist/functional/result/impl/result-is-ok.d.mts +2 -0
  145. package/dist/functional/result/impl/result-is-ok.d.mts.map +1 -1
  146. package/dist/functional/result/impl/result-is-ok.mjs +2 -0
  147. package/dist/functional/result/impl/result-is-ok.mjs.map +1 -1
  148. package/dist/functional/result/impl/result-is-result.d.mts +4 -0
  149. package/dist/functional/result/impl/result-is-result.d.mts.map +1 -1
  150. package/dist/functional/result/impl/result-is-result.mjs +4 -0
  151. package/dist/functional/result/impl/result-is-result.mjs.map +1 -1
  152. package/dist/functional/result/impl/result-map-err.d.mts +3 -0
  153. package/dist/functional/result/impl/result-map-err.d.mts.map +1 -1
  154. package/dist/functional/result/impl/result-map-err.mjs.map +1 -1
  155. package/dist/functional/result/impl/result-map.d.mts +4 -0
  156. package/dist/functional/result/impl/result-map.d.mts.map +1 -1
  157. package/dist/functional/result/impl/result-map.mjs.map +1 -1
  158. package/dist/functional/result/impl/result-ok.d.mts +3 -1
  159. package/dist/functional/result/impl/result-ok.d.mts.map +1 -1
  160. package/dist/functional/result/impl/result-ok.mjs +2 -0
  161. package/dist/functional/result/impl/result-ok.mjs.map +1 -1
  162. package/dist/functional/result/impl/result-or-else.d.mts +4 -0
  163. package/dist/functional/result/impl/result-or-else.d.mts.map +1 -1
  164. package/dist/functional/result/impl/result-or-else.mjs.map +1 -1
  165. package/dist/functional/result/impl/result-swap.d.mts +2 -0
  166. package/dist/functional/result/impl/result-swap.d.mts.map +1 -1
  167. package/dist/functional/result/impl/result-swap.mjs +2 -0
  168. package/dist/functional/result/impl/result-swap.mjs.map +1 -1
  169. package/dist/functional/result/impl/result-to-optional.d.mts +2 -0
  170. package/dist/functional/result/impl/result-to-optional.d.mts.map +1 -1
  171. package/dist/functional/result/impl/result-to-optional.mjs +2 -0
  172. package/dist/functional/result/impl/result-to-optional.mjs.map +1 -1
  173. package/dist/functional/result/impl/result-unwrap-err-or.d.mts +3 -0
  174. package/dist/functional/result/impl/result-unwrap-err-or.d.mts.map +1 -1
  175. package/dist/functional/result/impl/result-unwrap-err-or.mjs.map +1 -1
  176. package/dist/functional/result/impl/result-unwrap-err-throw.d.mts +2 -0
  177. package/dist/functional/result/impl/result-unwrap-err-throw.d.mts.map +1 -1
  178. package/dist/functional/result/impl/result-unwrap-err-throw.mjs +2 -0
  179. package/dist/functional/result/impl/result-unwrap-err-throw.mjs.map +1 -1
  180. package/dist/functional/result/impl/result-unwrap-err.d.mts +1 -0
  181. package/dist/functional/result/impl/result-unwrap-err.d.mts.map +1 -1
  182. package/dist/functional/result/impl/result-unwrap-err.mjs +1 -0
  183. package/dist/functional/result/impl/result-unwrap-err.mjs.map +1 -1
  184. package/dist/functional/result/impl/result-unwrap-ok-or.d.mts +3 -0
  185. package/dist/functional/result/impl/result-unwrap-ok-or.d.mts.map +1 -1
  186. package/dist/functional/result/impl/result-unwrap-ok-or.mjs.map +1 -1
  187. package/dist/functional/result/impl/result-unwrap-ok.d.mts +1 -0
  188. package/dist/functional/result/impl/result-unwrap-ok.d.mts.map +1 -1
  189. package/dist/functional/result/impl/result-unwrap-ok.mjs.map +1 -1
  190. package/dist/functional/result/impl/result-unwrap-throw.d.mts +2 -0
  191. package/dist/functional/result/impl/result-unwrap-throw.d.mts.map +1 -1
  192. package/dist/functional/result/impl/result-unwrap-throw.mjs +2 -0
  193. package/dist/functional/result/impl/result-unwrap-throw.mjs.map +1 -1
  194. package/dist/functional/result/impl/result-zip.d.mts +3 -1
  195. package/dist/functional/result/impl/result-zip.d.mts.map +1 -1
  196. package/dist/functional/result/impl/result-zip.mjs +3 -1
  197. package/dist/functional/result/impl/result-zip.mjs.map +1 -1
  198. package/dist/functional/ternary-result/impl/ternary-result-err.d.mts +2 -1
  199. package/dist/functional/ternary-result/impl/ternary-result-err.d.mts.map +1 -1
  200. package/dist/functional/ternary-result/impl/ternary-result-err.mjs +1 -0
  201. package/dist/functional/ternary-result/impl/ternary-result-err.mjs.map +1 -1
  202. package/dist/functional/ternary-result/impl/ternary-result-expect-to-be.d.mts +1 -0
  203. package/dist/functional/ternary-result/impl/ternary-result-expect-to-be.d.mts.map +1 -1
  204. package/dist/functional/ternary-result/impl/ternary-result-expect-to-be.mjs.map +1 -1
  205. package/dist/functional/ternary-result/impl/ternary-result-flat-map.d.mts +4 -0
  206. package/dist/functional/ternary-result/impl/ternary-result-flat-map.d.mts.map +1 -1
  207. package/dist/functional/ternary-result/impl/ternary-result-flat-map.mjs.map +1 -1
  208. package/dist/functional/ternary-result/impl/ternary-result-fold.d.mts +2 -0
  209. package/dist/functional/ternary-result/impl/ternary-result-fold.d.mts.map +1 -1
  210. package/dist/functional/ternary-result/impl/ternary-result-fold.mjs.map +1 -1
  211. package/dist/functional/ternary-result/impl/ternary-result-from-promise.d.mts +2 -0
  212. package/dist/functional/ternary-result/impl/ternary-result-from-promise.d.mts.map +1 -1
  213. package/dist/functional/ternary-result/impl/ternary-result-from-promise.mjs +2 -0
  214. package/dist/functional/ternary-result/impl/ternary-result-from-promise.mjs.map +1 -1
  215. package/dist/functional/ternary-result/impl/ternary-result-from-throwable.d.mts +2 -0
  216. package/dist/functional/ternary-result/impl/ternary-result-from-throwable.d.mts.map +1 -1
  217. package/dist/functional/ternary-result/impl/ternary-result-from-throwable.mjs +2 -0
  218. package/dist/functional/ternary-result/impl/ternary-result-from-throwable.mjs.map +1 -1
  219. package/dist/functional/ternary-result/impl/ternary-result-is-ok.d.mts +1 -0
  220. package/dist/functional/ternary-result/impl/ternary-result-is-ok.d.mts.map +1 -1
  221. package/dist/functional/ternary-result/impl/ternary-result-is-ok.mjs +1 -0
  222. package/dist/functional/ternary-result/impl/ternary-result-is-ok.mjs.map +1 -1
  223. package/dist/functional/ternary-result/impl/ternary-result-is-ternary-result.d.mts +4 -0
  224. package/dist/functional/ternary-result/impl/ternary-result-is-ternary-result.d.mts.map +1 -1
  225. package/dist/functional/ternary-result/impl/ternary-result-is-ternary-result.mjs +4 -0
  226. package/dist/functional/ternary-result/impl/ternary-result-is-ternary-result.mjs.map +1 -1
  227. package/dist/functional/ternary-result/impl/ternary-result-is-warn.d.mts +1 -0
  228. package/dist/functional/ternary-result/impl/ternary-result-is-warn.d.mts.map +1 -1
  229. package/dist/functional/ternary-result/impl/ternary-result-is-warn.mjs +1 -0
  230. package/dist/functional/ternary-result/impl/ternary-result-is-warn.mjs.map +1 -1
  231. package/dist/functional/ternary-result/impl/ternary-result-map-err.d.mts +3 -0
  232. package/dist/functional/ternary-result/impl/ternary-result-map-err.d.mts.map +1 -1
  233. package/dist/functional/ternary-result/impl/ternary-result-map-err.mjs.map +1 -1
  234. package/dist/functional/ternary-result/impl/ternary-result-map-warn.d.mts +3 -0
  235. package/dist/functional/ternary-result/impl/ternary-result-map-warn.d.mts.map +1 -1
  236. package/dist/functional/ternary-result/impl/ternary-result-map-warn.mjs.map +1 -1
  237. package/dist/functional/ternary-result/impl/ternary-result-map.d.mts +6 -0
  238. package/dist/functional/ternary-result/impl/ternary-result-map.d.mts.map +1 -1
  239. package/dist/functional/ternary-result/impl/ternary-result-map.mjs.map +1 -1
  240. package/dist/functional/ternary-result/impl/ternary-result-ok.d.mts +1 -1
  241. package/dist/functional/ternary-result/impl/ternary-result-ok.d.mts.map +1 -1
  242. package/dist/functional/ternary-result/impl/ternary-result-ok.mjs.map +1 -1
  243. package/dist/functional/ternary-result/impl/ternary-result-or-else.d.mts +2 -0
  244. package/dist/functional/ternary-result/impl/ternary-result-or-else.d.mts.map +1 -1
  245. package/dist/functional/ternary-result/impl/ternary-result-or-else.mjs.map +1 -1
  246. package/dist/functional/ternary-result/impl/ternary-result-to-optional.d.mts +2 -0
  247. package/dist/functional/ternary-result/impl/ternary-result-to-optional.d.mts.map +1 -1
  248. package/dist/functional/ternary-result/impl/ternary-result-to-optional.mjs +2 -0
  249. package/dist/functional/ternary-result/impl/ternary-result-to-optional.mjs.map +1 -1
  250. package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-or.d.mts +2 -0
  251. package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-or.d.mts.map +1 -1
  252. package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-or.mjs.map +1 -1
  253. package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-throw.d.mts +1 -0
  254. package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-throw.d.mts.map +1 -1
  255. package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-throw.mjs +1 -0
  256. package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-throw.mjs.map +1 -1
  257. package/dist/functional/ternary-result/impl/ternary-result-unwrap-err.d.mts +2 -0
  258. package/dist/functional/ternary-result/impl/ternary-result-unwrap-err.d.mts.map +1 -1
  259. package/dist/functional/ternary-result/impl/ternary-result-unwrap-err.mjs +2 -0
  260. package/dist/functional/ternary-result/impl/ternary-result-unwrap-err.mjs.map +1 -1
  261. package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok-or.d.mts +2 -0
  262. package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok-or.d.mts.map +1 -1
  263. package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok-or.mjs.map +1 -1
  264. package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok.d.mts +2 -0
  265. package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok.d.mts.map +1 -1
  266. package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok.mjs.map +1 -1
  267. package/dist/functional/ternary-result/impl/ternary-result-unwrap-throw.d.mts +1 -0
  268. package/dist/functional/ternary-result/impl/ternary-result-unwrap-throw.d.mts.map +1 -1
  269. package/dist/functional/ternary-result/impl/ternary-result-unwrap-throw.mjs +1 -0
  270. package/dist/functional/ternary-result/impl/ternary-result-unwrap-throw.mjs.map +1 -1
  271. package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-or.d.mts +2 -0
  272. package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-or.d.mts.map +1 -1
  273. package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-or.mjs.map +1 -1
  274. package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-throw.d.mts +1 -0
  275. package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-throw.d.mts.map +1 -1
  276. package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-throw.mjs +1 -0
  277. package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-throw.mjs.map +1 -1
  278. package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn.d.mts +2 -0
  279. package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn.d.mts.map +1 -1
  280. package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn.mjs +2 -0
  281. package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn.mjs.map +1 -1
  282. package/dist/functional/ternary-result/impl/ternary-result-warn.d.mts +1 -1
  283. package/dist/functional/ternary-result/impl/ternary-result-warn.d.mts.map +1 -1
  284. package/dist/functional/ternary-result/impl/ternary-result-warn.mjs.map +1 -1
  285. package/dist/functional/ternary-result/impl/ternary-result-zip.d.mts +4 -0
  286. package/dist/functional/ternary-result/impl/ternary-result-zip.d.mts.map +1 -1
  287. package/dist/functional/ternary-result/impl/ternary-result-zip.mjs +4 -0
  288. package/dist/functional/ternary-result/impl/ternary-result-zip.mjs.map +1 -1
  289. package/dist/globals.d.mts +10 -0
  290. package/dist/guard/index.mjs +1 -1
  291. package/dist/guard/is-record.d.mts +31 -0
  292. package/dist/guard/is-record.d.mts.map +1 -1
  293. package/dist/guard/is-record.mjs +32 -1
  294. package/dist/guard/is-record.mjs.map +1 -1
  295. package/dist/guard/is-type.d.mts +3 -0
  296. package/dist/guard/is-type.d.mts.map +1 -1
  297. package/dist/guard/is-type.mjs +3 -0
  298. package/dist/guard/is-type.mjs.map +1 -1
  299. package/dist/guard/key-is-in.d.mts +1 -0
  300. package/dist/guard/key-is-in.d.mts.map +1 -1
  301. package/dist/guard/key-is-in.mjs +1 -0
  302. package/dist/guard/key-is-in.mjs.map +1 -1
  303. package/dist/index.mjs +1 -1
  304. package/dist/iterator/range.d.mts +4 -0
  305. package/dist/iterator/range.d.mts.map +1 -1
  306. package/dist/iterator/range.mjs +1 -0
  307. package/dist/iterator/range.mjs.map +1 -1
  308. package/dist/json/json.d.mts +21 -0
  309. package/dist/json/json.d.mts.map +1 -1
  310. package/dist/json/json.mjs +21 -0
  311. package/dist/json/json.mjs.map +1 -1
  312. package/dist/number/branded-types/int.d.mts +14 -0
  313. package/dist/number/branded-types/int.d.mts.map +1 -1
  314. package/dist/number/branded-types/int.mjs +14 -0
  315. package/dist/number/branded-types/int.mjs.map +1 -1
  316. package/dist/number/branded-types/non-zero-safe-int.mjs +2 -2
  317. package/dist/number/branded-types/positive-int.d.mts +14 -0
  318. package/dist/number/branded-types/positive-int.d.mts.map +1 -1
  319. package/dist/number/branded-types/positive-int.mjs +14 -0
  320. package/dist/number/branded-types/positive-int.mjs.map +1 -1
  321. package/dist/number/branded-types/positive-safe-int.d.mts +21 -0
  322. package/dist/number/branded-types/positive-safe-int.d.mts.map +1 -1
  323. package/dist/number/branded-types/positive-safe-int.mjs +22 -1
  324. package/dist/number/branded-types/positive-safe-int.mjs.map +1 -1
  325. package/dist/number/branded-types/safe-int.d.mts +21 -0
  326. package/dist/number/branded-types/safe-int.d.mts.map +1 -1
  327. package/dist/number/branded-types/safe-int.mjs +23 -2
  328. package/dist/number/branded-types/safe-int.mjs.map +1 -1
  329. package/dist/number/branded-types/safe-uint.mjs +1 -1
  330. package/dist/number/branded-types/uint.d.mts +12 -0
  331. package/dist/number/branded-types/uint.d.mts.map +1 -1
  332. package/dist/number/branded-types/uint.mjs +12 -0
  333. package/dist/number/branded-types/uint.mjs.map +1 -1
  334. package/dist/number/num.d.mts +9 -0
  335. package/dist/number/num.d.mts.map +1 -1
  336. package/dist/number/num.mjs +8 -1
  337. package/dist/number/num.mjs.map +1 -1
  338. package/dist/number/refined-number-utils.d.mts +22 -0
  339. package/dist/number/refined-number-utils.d.mts.map +1 -1
  340. package/dist/number/refined-number-utils.mjs +22 -0
  341. package/dist/number/refined-number-utils.mjs.map +1 -1
  342. package/dist/object/object.d.mts +9 -0
  343. package/dist/object/object.d.mts.map +1 -1
  344. package/dist/object/object.mjs +7 -0
  345. package/dist/object/object.mjs.map +1 -1
  346. package/dist/others/map-nullable.mjs.map +1 -1
  347. package/dist/others/tuple.d.mts +11 -0
  348. package/dist/others/tuple.d.mts.map +1 -1
  349. package/dist/others/tuple.mjs +11 -0
  350. package/dist/others/tuple.mjs.map +1 -1
  351. package/dist/others/unknown-to-string.d.mts.map +1 -1
  352. package/dist/others/unknown-to-string.mjs.map +1 -1
  353. package/dist/promise/promise.d.mts +4 -0
  354. package/dist/promise/promise.d.mts.map +1 -1
  355. package/dist/promise/promise.mjs +4 -0
  356. package/dist/promise/promise.mjs.map +1 -1
  357. package/package.json +18 -22
  358. package/src/array/impl/array-utils-creation.mts +20 -0
  359. package/src/array/impl/array-utils-creation.test.mts +71 -0
  360. package/src/array/impl/array-utils-element-access.mts +13 -0
  361. package/src/array/impl/array-utils-element-access.test.mts +21 -0
  362. package/src/array/impl/array-utils-iterators.test.mts +17 -0
  363. package/src/array/impl/array-utils-modification.mts +40 -0
  364. package/src/array/impl/array-utils-modification.test.mts +75 -0
  365. package/src/array/impl/array-utils-overload-type-error.test.mts +19 -0
  366. package/src/array/impl/array-utils-reducing-value.mts +53 -8
  367. package/src/array/impl/array-utils-reducing-value.test.mts +90 -0
  368. package/src/array/impl/array-utils-search.mts +53 -0
  369. package/src/array/impl/array-utils-search.test.mts +51 -0
  370. package/src/array/impl/array-utils-set-op.mts +19 -0
  371. package/src/array/impl/array-utils-set-op.test.mts +116 -0
  372. package/src/array/impl/array-utils-size.mts +3 -0
  373. package/src/array/impl/array-utils-size.test.mts +1 -0
  374. package/src/array/impl/array-utils-slice-clamped.mts +7 -0
  375. package/src/array/impl/array-utils-slice-clamped.test.mts +20 -0
  376. package/src/array/impl/array-utils-slicing.mts +27 -0
  377. package/src/array/impl/array-utils-slicing.test.mts +57 -0
  378. package/src/array/impl/array-utils-transformation.mts +58 -0
  379. package/src/array/impl/array-utils-transformation.test.mts +113 -1
  380. package/src/array/impl/array-utils-validation.mts +23 -0
  381. package/src/array/impl/array-utils-validation.test.mts +96 -0
  382. package/src/array/impl/array.test.mts +12 -0
  383. package/src/collections/imap-mapped.mts +11 -0
  384. package/src/collections/imap-mapped.test.mts +70 -0
  385. package/src/collections/imap.mts +32 -0
  386. package/src/collections/imap.test.mts +106 -0
  387. package/src/collections/iset-mapped.mts +35 -0
  388. package/src/collections/iset-mapped.test.mts +111 -0
  389. package/src/collections/iset.mts +34 -0
  390. package/src/collections/iset.test.mts +193 -0
  391. package/src/collections/queue.mts +53 -0
  392. package/src/collections/queue.test.mts +32 -0
  393. package/src/collections/stack.mts +42 -0
  394. package/src/collections/stack.test.mts +44 -0
  395. package/src/functional/match.mts +16 -0
  396. package/src/functional/match.test.mts +2 -0
  397. package/src/functional/optional/impl/optional-expect-to-be.mts +3 -0
  398. package/src/functional/optional/impl/optional-filter.mts +6 -0
  399. package/src/functional/optional/impl/optional-flat-map.mts +4 -0
  400. package/src/functional/optional/impl/optional-from-nullable.mts +2 -0
  401. package/src/functional/optional/impl/optional-is-optional.mts +2 -0
  402. package/src/functional/optional/impl/optional-is-some.mts +1 -0
  403. package/src/functional/optional/impl/optional-map.mts +5 -0
  404. package/src/functional/optional/impl/optional-none.mts +2 -0
  405. package/src/functional/optional/impl/optional-or-else.mts +6 -0
  406. package/src/functional/optional/impl/optional-some.mts +3 -1
  407. package/src/functional/optional/impl/optional-to-nullable.mts +2 -0
  408. package/src/functional/optional/impl/optional-unwrap-or.mts +5 -0
  409. package/src/functional/optional/impl/optional-unwrap-throw.mts +1 -0
  410. package/src/functional/optional/impl/optional-unwrap.mts +2 -0
  411. package/src/functional/optional/impl/optional-zip.mts +2 -0
  412. package/src/functional/optional.test.mts +73 -0
  413. package/src/functional/pipe.test.mts +3 -0
  414. package/src/functional/result/impl/result-err.mts +3 -1
  415. package/src/functional/result/impl/result-expect-to-be.mts +3 -0
  416. package/src/functional/result/impl/result-flat-map.mts +7 -0
  417. package/src/functional/result/impl/result-fold.mts +6 -0
  418. package/src/functional/result/impl/result-from-promise.mts +3 -0
  419. package/src/functional/result/impl/result-from-throwable.mts +4 -0
  420. package/src/functional/result/impl/result-is-err.mts +2 -0
  421. package/src/functional/result/impl/result-is-ok.mts +2 -0
  422. package/src/functional/result/impl/result-is-result.mts +4 -0
  423. package/src/functional/result/impl/result-map-err.mts +5 -0
  424. package/src/functional/result/impl/result-map.mts +6 -0
  425. package/src/functional/result/impl/result-ok.mts +3 -1
  426. package/src/functional/result/impl/result-or-else.mts +6 -0
  427. package/src/functional/result/impl/result-swap.mts +2 -0
  428. package/src/functional/result/impl/result-to-optional.mts +2 -0
  429. package/src/functional/result/impl/result-unwrap-err-or.mts +5 -0
  430. package/src/functional/result/impl/result-unwrap-err-throw.mts +2 -0
  431. package/src/functional/result/impl/result-unwrap-err.mts +1 -0
  432. package/src/functional/result/impl/result-unwrap-ok-or.mts +5 -0
  433. package/src/functional/result/impl/result-unwrap-ok.mts +2 -0
  434. package/src/functional/result/impl/result-unwrap-throw.mts +2 -0
  435. package/src/functional/result/impl/result-zip.mts +3 -1
  436. package/src/functional/result.test.mts +88 -0
  437. package/src/functional/ternary-result/impl/ternary-result-err.mts +2 -1
  438. package/src/functional/ternary-result/impl/ternary-result-expect-to-be.mts +4 -0
  439. package/src/functional/ternary-result/impl/ternary-result-flat-map.mts +7 -0
  440. package/src/functional/ternary-result/impl/ternary-result-fold.mts +5 -0
  441. package/src/functional/ternary-result/impl/ternary-result-from-promise.mts +2 -0
  442. package/src/functional/ternary-result/impl/ternary-result-from-throwable.mts +3 -0
  443. package/src/functional/ternary-result/impl/ternary-result-is-ok.mts +1 -0
  444. package/src/functional/ternary-result/impl/ternary-result-is-ternary-result.mts +4 -0
  445. package/src/functional/ternary-result/impl/ternary-result-is-warn.mts +1 -0
  446. package/src/functional/ternary-result/impl/ternary-result-map-err.mts +6 -0
  447. package/src/functional/ternary-result/impl/ternary-result-map-warn.mts +6 -0
  448. package/src/functional/ternary-result/impl/ternary-result-map.mts +9 -0
  449. package/src/functional/ternary-result/impl/ternary-result-ok.mts +1 -1
  450. package/src/functional/ternary-result/impl/ternary-result-or-else.mts +5 -0
  451. package/src/functional/ternary-result/impl/ternary-result-to-optional.mts +2 -0
  452. package/src/functional/ternary-result/impl/ternary-result-unwrap-err-or.mts +5 -0
  453. package/src/functional/ternary-result/impl/ternary-result-unwrap-err-throw.mts +1 -0
  454. package/src/functional/ternary-result/impl/ternary-result-unwrap-err.mts +2 -0
  455. package/src/functional/ternary-result/impl/ternary-result-unwrap-ok-or.mts +5 -0
  456. package/src/functional/ternary-result/impl/ternary-result-unwrap-ok.mts +3 -0
  457. package/src/functional/ternary-result/impl/ternary-result-unwrap-throw.mts +1 -0
  458. package/src/functional/ternary-result/impl/ternary-result-unwrap-warn-or.mts +5 -0
  459. package/src/functional/ternary-result/impl/ternary-result-unwrap-warn-throw.mts +1 -0
  460. package/src/functional/ternary-result/impl/ternary-result-unwrap-warn.mts +2 -0
  461. package/src/functional/ternary-result/impl/ternary-result-warn.mts +4 -1
  462. package/src/functional/ternary-result/impl/ternary-result-zip.mts +4 -0
  463. package/src/functional/ternary-result.test.mts +91 -0
  464. package/src/globals.d.mts +10 -0
  465. package/src/guard/has-key.test.mts +9 -0
  466. package/src/guard/is-non-empty-string.test.mts +20 -0
  467. package/src/guard/is-non-null-object.test.mts +19 -0
  468. package/src/guard/is-primitive.test.mts +23 -0
  469. package/src/guard/is-record.mts +34 -0
  470. package/src/guard/is-record.test.mts +21 -0
  471. package/src/guard/is-type.mts +3 -0
  472. package/src/guard/is-type.test.mts +134 -0
  473. package/src/guard/key-is-in.mts +1 -0
  474. package/src/iterator/range.mts +9 -0
  475. package/src/json/json.mts +29 -0
  476. package/src/json/json.test.mts +87 -0
  477. package/src/number/branded-types/finite-number.test.mts +38 -0
  478. package/src/number/branded-types/int.mts +14 -0
  479. package/src/number/branded-types/int.test.mts +42 -0
  480. package/src/number/branded-types/int16.test.mts +47 -0
  481. package/src/number/branded-types/int32.test.mts +47 -0
  482. package/src/number/branded-types/non-negative-finite-number.test.mts +40 -0
  483. package/src/number/branded-types/non-negative-int16.test.mts +43 -0
  484. package/src/number/branded-types/non-negative-int32.test.mts +43 -0
  485. package/src/number/branded-types/non-zero-finite-number.test.mts +51 -0
  486. package/src/number/branded-types/non-zero-int.test.mts +53 -0
  487. package/src/number/branded-types/non-zero-int16.test.mts +44 -0
  488. package/src/number/branded-types/non-zero-int32.test.mts +44 -0
  489. package/src/number/branded-types/non-zero-safe-int.mts +2 -2
  490. package/src/number/branded-types/non-zero-safe-int.test.mts +62 -0
  491. package/src/number/branded-types/non-zero-uint16.test.mts +37 -0
  492. package/src/number/branded-types/non-zero-uint32.test.mts +37 -0
  493. package/src/number/branded-types/positive-finite-number.test.mts +45 -0
  494. package/src/number/branded-types/positive-int.mts +14 -0
  495. package/src/number/branded-types/positive-int.test.mts +47 -0
  496. package/src/number/branded-types/positive-int16.test.mts +35 -0
  497. package/src/number/branded-types/positive-int32.test.mts +35 -0
  498. package/src/number/branded-types/positive-safe-int.mts +22 -1
  499. package/src/number/branded-types/positive-safe-int.test.mts +49 -0
  500. package/src/number/branded-types/positive-uint16.test.mts +37 -0
  501. package/src/number/branded-types/positive-uint32.test.mts +37 -0
  502. package/src/number/branded-types/safe-int.mts +23 -2
  503. package/src/number/branded-types/safe-int.test.mts +52 -0
  504. package/src/number/branded-types/safe-uint.mts +1 -1
  505. package/src/number/branded-types/safe-uint.test.mts +48 -0
  506. package/src/number/branded-types/uint.mts +12 -0
  507. package/src/number/branded-types/uint.test.mts +43 -0
  508. package/src/number/branded-types/uint16.test.mts +41 -0
  509. package/src/number/branded-types/uint32.test.mts +41 -0
  510. package/src/number/enum/int8.test.mts +6 -0
  511. package/src/number/enum/uint8.test.mts +6 -0
  512. package/src/number/num.mts +12 -1
  513. package/src/number/num.test.mts +62 -0
  514. package/src/number/refined-number-utils.mts +25 -0
  515. package/src/object/object.mts +15 -0
  516. package/src/object/object.test.mts +10 -0
  517. package/src/others/cast-mutable.test.mts +7 -0
  518. package/src/others/cast-readonly.test.mts +17 -0
  519. package/src/others/if-then.test.mts +16 -0
  520. package/src/others/map-nullable.mts +3 -0
  521. package/src/others/map-nullable.test.mts +27 -0
  522. package/src/others/memoize-function.test.mts +41 -0
  523. package/src/others/tuple.mts +11 -0
  524. package/src/others/unknown-to-string.mts +2 -0
  525. package/src/others/unknown-to-string.test.mts +10 -0
  526. package/src/promise/promise.mts +4 -0
  527. package/src/promise/promise.test.mts +1 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-data-forge",
3
- "version": "5.0.1",
3
+ "version": "5.1.0",
4
4
  "private": false,
5
5
  "keywords": [
6
6
  "typescript",
@@ -48,15 +48,14 @@
48
48
  "fmt": "format-uncommitted",
49
49
  "fmt:diff": "format-diff-from origin/main",
50
50
  "fmt:full": "prettier --write .",
51
- "gh:apply-all": "run-s gh:apply-variables gh:apply-rulesets gh:apply-repository-settings",
52
- "gh:apply-repository-settings": "tsx --env-file=.env scripts/github/repository/apply.mts",
53
- "gh:apply-rulesets": "tsx --env-file=.env scripts/github/ruleset/apply.mts",
54
- "gh:apply-variables": "tsx --env-file=.env scripts/github/variables/apply.mts",
55
- "gh:backup-all": "run-s gh:backup-rulesets gh:backup-repository-settings",
56
- "gh:backup-repository-settings": "tsx --env-file=.env scripts/github/repository/backup.mts",
57
- "gh:backup-rulesets": "tsx --env-file=.env scripts/github/ruleset/backup.mts",
58
- "gi": "run-s gi:scripts gi:src fmt",
59
- "gi:scripts": "gen-index-ts ./scripts/github --index-ext .mts --export-ext .mjs --target-ext .mts --exclude cmd --exclude apply.mts --exclude octokit.mts",
51
+ "gh:apply-all": "gh-apply-all",
52
+ "gh:apply-repository-settings": "gh-apply-repository-settings",
53
+ "gh:apply-rulesets": "gh-apply-rulesets",
54
+ "gh:apply-variables": "gh-apply-variables",
55
+ "gh:backup-all": "gh-backup-all",
56
+ "gh:backup-repository-settings": "gh-backup-repository-settings",
57
+ "gh:backup-rulesets": "gh-backup-rulesets",
58
+ "gi": "run-s gi:src fmt",
60
59
  "gi:src": "tsx scripts/cmd/gen-index.mts",
61
60
  "lint": "eslint .",
62
61
  "lint:fix": "eslint . --fix",
@@ -79,7 +78,6 @@
79
78
  "@emotion/react": "^11.14.0",
80
79
  "@emotion/styled": "^11.14.1",
81
80
  "@mui/material": "^7.3.5",
82
- "@octokit/core": "7.0.6",
83
81
  "@rollup/plugin-replace": "^6.0.3",
84
82
  "@rollup/plugin-strip": "^3.0.4",
85
83
  "@rollup/plugin-typescript": "^12.3.0",
@@ -88,38 +86,36 @@
88
86
  "@semantic-release/exec": "^7.1.0",
89
87
  "@semantic-release/git": "^10.0.1",
90
88
  "@semantic-release/github": "^12.0.2",
91
- "@semantic-release/npm": "^13.1.1",
89
+ "@semantic-release/npm": "^13.1.2",
92
90
  "@semantic-release/release-notes-generator": "^14.1.0",
93
91
  "@sindresorhus/is": "^7.1.1",
94
92
  "@types/node": "^24.10.1",
95
- "@types/react": "^19.2.4",
96
- "@vitest/coverage-v8": "^4.0.8",
97
- "@vitest/ui": "^4.0.8",
93
+ "@types/react": "^19.2.5",
94
+ "@vitest/coverage-v8": "^4.0.9",
95
+ "@vitest/ui": "^4.0.9",
98
96
  "conventional-changelog-conventionalcommits": "^9.1.0",
99
- "cspell": "^9.3.1",
97
+ "cspell": "^9.3.2",
100
98
  "eslint": "9.39.1",
101
- "eslint-config-typed": "^3.5.2",
102
- "fast-glob": "^3.3.3",
99
+ "eslint-config-typed": "^3.13.3",
100
+ "github-settings-as-code": "^1.0.6",
103
101
  "immer": "^10.2.0",
104
102
  "jiti": "^2.6.1",
105
103
  "markdownlint": "^0.39.0",
106
104
  "markdownlint-cli2": "^0.19.0",
107
105
  "npm-run-all2": "^8.0.4",
108
- "octokit-safe-types": "^1.2.0",
109
106
  "prettier": "^3.6.2",
110
107
  "prettier-plugin-organize-imports": "^4.3.0",
111
108
  "prettier-plugin-packagejson": "^2.5.19",
112
109
  "rollup": "^4.53.2",
113
110
  "semantic-release": "^25.0.2",
114
- "ts-fortress": "^6.0.0",
115
- "ts-repo-utils": "^7.8.1",
111
+ "ts-repo-utils": "^7.8.2",
116
112
  "tslib": "^2.8.1",
117
113
  "tsx": "^4.20.6",
118
114
  "typedoc": "^0.28.14",
119
115
  "typedoc-github-theme": "^0.3.1",
120
116
  "typescript": "^5.9.3",
121
117
  "vite": "^7.2.2",
122
- "vitest": "^4.0.8"
118
+ "vitest": "^4.0.9"
123
119
  },
124
120
  "peerDependencies": {
125
121
  "typescript": ">=4.8"
@@ -8,9 +8,11 @@ import { range as rangeIterator } from '../../iterator/index.mjs';
8
8
  *
9
9
  * ```ts
10
10
  * const emptyZeros = Arr.zeros(0);
11
+ *
11
12
  * const threeZeros = Arr.zeros(3);
12
13
  *
13
14
  * assert.deepStrictEqual(emptyZeros, []);
15
+ *
14
16
  * assert.deepStrictEqual(threeZeros, [0, 0, 0]);
15
17
  * ```
16
18
  */
@@ -31,9 +33,11 @@ export const zeros = <N extends SizeType.ArgArr>(
31
33
  *
32
34
  * ```ts
33
35
  * const emptySeq = Arr.seq(0);
36
+ *
34
37
  * const firstFive = Arr.seq(5);
35
38
  *
36
39
  * assert.deepStrictEqual(emptySeq, []);
40
+ *
37
41
  * assert.deepStrictEqual(firstFive, [0, 1, 2, 3, 4]);
38
42
  * ```
39
43
  */
@@ -54,9 +58,11 @@ export const seq = <N extends SizeType.ArgArr>(
54
58
  *
55
59
  * ```ts
56
60
  * const threeOnes = Arr.create(3, 1);
61
+ *
57
62
  * const emptyStrings = Arr.create(0, 'Ada');
58
63
  *
59
64
  * assert.deepStrictEqual(threeOnes, [1, 1, 1]);
65
+ *
60
66
  * assert.deepStrictEqual(emptyStrings, []);
61
67
  * ```
62
68
  */
@@ -86,7 +92,9 @@ export const newArray = create;
86
92
  * ```ts
87
93
  * const numbers = Arr.generate(function* () {
88
94
  * yield 1;
95
+ *
89
96
  * yield 2;
97
+ *
90
98
  * yield 3;
91
99
  * });
92
100
  *
@@ -105,7 +113,9 @@ export const generate = <T,>(
105
113
  * ```ts
106
114
  * const values = await Arr.generateAsync(async function* () {
107
115
  * yield 'Ada';
116
+ *
108
117
  * await Promise.resolve();
118
+ *
109
119
  * yield 'Lovelace';
110
120
  * });
111
121
  *
@@ -123,9 +133,11 @@ export const generateAsync = <T,>(
123
133
  *
124
134
  * ```ts
125
135
  * const original = [{ id: 1 }, { id: 2 }] as const;
136
+ *
126
137
  * const cloned = Arr.copy(original);
127
138
  *
128
139
  * assert.deepStrictEqual(cloned, original);
140
+ *
129
141
  * assert.notStrictEqual(cloned, original);
130
142
  * ```
131
143
  */
@@ -143,13 +155,19 @@ type RangeList<S extends SmallUint, E extends SmallUint> =
143
155
  : List.Skip<S, Seq<E>>;
144
156
 
145
157
  expectType<RangeList<1, 5>, readonly [1, 2, 3, 4]>('=');
158
+
146
159
  expectType<RangeList<1, 2>, readonly [1]>('=');
160
+
147
161
  expectType<RangeList<1, 1>, readonly []>('=');
162
+
148
163
  expectType<RangeList<1, 1 | 3>, readonly (1 | 2)[]>('=');
164
+
149
165
  expectType<RangeList<1 | 3, 3 | 5>, readonly (1 | 2 | 3 | 4)[]>('=');
166
+
150
167
  expectType<RangeList<1 | 2 | 3, 5 | 6 | 7>, readonly (1 | 2 | 3 | 4 | 5 | 6)[]>(
151
168
  '=',
152
169
  );
170
+
153
171
  expectType<RangeList<5, 1>, readonly []>('=');
154
172
 
155
173
  /**
@@ -159,9 +177,11 @@ expectType<RangeList<5, 1>, readonly []>('=');
159
177
  *
160
178
  * ```ts
161
179
  * const ascending = Arr.range(asUint32(1), asUint32(5));
180
+ *
162
181
  * const empty = Arr.range(asUint32(2), asUint32(2));
163
182
  *
164
183
  * assert.deepStrictEqual(ascending, [1, 2, 3, 4]);
184
+ *
165
185
  * assert.deepStrictEqual(empty, []);
166
186
  * ```
167
187
  */
@@ -21,6 +21,7 @@ describe('Arr creations', () => {
21
21
  describe(zeros, () => {
22
22
  test('fixed length', () => {
23
23
  const result = zeros(3);
24
+
24
25
  expectType<typeof result, readonly [0, 0, 0]>('=');
25
26
 
26
27
  assert.deepStrictEqual(result, [0, 0, 0]);
@@ -28,6 +29,7 @@ describe('Arr creations', () => {
28
29
 
29
30
  test('fixed length (empty)', () => {
30
31
  const result = zeros(0);
32
+
31
33
  expectType<typeof result, readonly []>('=');
32
34
 
33
35
  assert.deepStrictEqual(result, []);
@@ -35,7 +37,9 @@ describe('Arr creations', () => {
35
37
 
36
38
  test('unknown length', () => {
37
39
  const n: number = 3;
40
+
38
41
  const result = zeros(asUint32(n));
42
+
39
43
  expectType<typeof result, readonly 0[]>('=');
40
44
 
41
45
  assert.deepStrictEqual(result, [0, 0, 0]);
@@ -53,6 +57,7 @@ describe('Arr creations', () => {
53
57
  const result = zeros(asUint32(1000));
54
58
 
55
59
  expect(result).toHaveLength(1000);
60
+
56
61
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
57
62
  expect(result.every((x) => x === 0)).toBe(true);
58
63
  });
@@ -67,6 +72,7 @@ describe('Arr creations', () => {
67
72
  describe(seq, () => {
68
73
  test('fixed length', () => {
69
74
  const result = seq(5);
75
+
70
76
  expectType<typeof result, readonly [0, 1, 2, 3, 4]>('=');
71
77
 
72
78
  assert.deepStrictEqual(result, [0, 1, 2, 3, 4]);
@@ -74,6 +80,7 @@ describe('Arr creations', () => {
74
80
 
75
81
  test('fixed length (empty)', () => {
76
82
  const result = seq(0);
83
+
77
84
  expectType<typeof result, readonly []>('=');
78
85
 
79
86
  assert.deepStrictEqual(result, []);
@@ -81,7 +88,9 @@ describe('Arr creations', () => {
81
88
 
82
89
  test('unknown length', () => {
83
90
  const n: number = 3;
91
+
84
92
  const result = seq(asUint32(n));
93
+
85
94
  expectType<typeof result, readonly SizeType.Arr[]>('=');
86
95
 
87
96
  assert.deepStrictEqual(result, [asUint32(0), asUint32(1), asUint32(2)]);
@@ -97,7 +106,9 @@ describe('Arr creations', () => {
97
106
  const result = seq(asUint32(100));
98
107
 
99
108
  expect(result).toHaveLength(100);
109
+
100
110
  expect(result[0]).toBe(0);
111
+
101
112
  expect(result[99]).toBe(99);
102
113
  });
103
114
 
@@ -111,6 +122,7 @@ describe('Arr creations', () => {
111
122
  describe(create, () => {
112
123
  test('fixed length with primitive value', () => {
113
124
  const result = create(3, 'a');
125
+
114
126
  expectType<typeof result, readonly ['a', 'a', 'a']>('=');
115
127
 
116
128
  assert.deepStrictEqual(result, ['a', 'a', 'a']);
@@ -118,6 +130,7 @@ describe('Arr creations', () => {
118
130
 
119
131
  test('fixed length with null', () => {
120
132
  const result = create(2, null);
133
+
121
134
  expectType<typeof result, readonly [null, null]>('=');
122
135
 
123
136
  assert.deepStrictEqual(result, [null, null]);
@@ -125,7 +138,9 @@ describe('Arr creations', () => {
125
138
 
126
139
  test('fixed length with object (shallow copy)', () => {
127
140
  const obj = { id: 1 };
141
+
128
142
  const result = create(2, obj);
143
+
129
144
  expectType<typeof result, readonly [{ id: number }, { id: number }]>(
130
145
  '~=',
131
146
  );
@@ -133,11 +148,13 @@ describe('Arr creations', () => {
133
148
  assert.deepStrictEqual(result, [obj, obj]);
134
149
 
135
150
  expect(result[0]).toBe(obj);
151
+
136
152
  expect(result[1]).toBe(obj);
137
153
  });
138
154
 
139
155
  test('fixed length (empty)', () => {
140
156
  const result = create(0, 123);
157
+
141
158
  expectType<typeof result, readonly []>('=');
142
159
 
143
160
  assert.deepStrictEqual(result, []);
@@ -145,7 +162,9 @@ describe('Arr creations', () => {
145
162
 
146
163
  test('unknown length', () => {
147
164
  const n: number = 2;
165
+
148
166
  const result = create(asUint32(n), true);
167
+
149
168
  expectType<typeof result, readonly true[]>('=');
150
169
 
151
170
  assert.deepStrictEqual(result, [true, true]);
@@ -153,6 +172,7 @@ describe('Arr creations', () => {
153
172
 
154
173
  test('should create array with function values', () => {
155
174
  const fn = (): string => 'test';
175
+
156
176
  const result = create(3, fn);
157
177
 
158
178
  assert.deepStrictEqual(result, [fn, fn, fn]);
@@ -162,6 +182,7 @@ describe('Arr creations', () => {
162
182
 
163
183
  test('should create array with object values', () => {
164
184
  const obj = { a: 1 };
185
+
165
186
  const result = create(2, obj);
166
187
 
167
188
  assert.deepStrictEqual(result, [obj, obj]);
@@ -177,9 +198,11 @@ describe('Arr creations', () => {
177
198
 
178
199
  test('newArray is alias for create', () => {
179
200
  const created1 = create(3, 'test');
201
+
180
202
  const created2 = newArray(3, 'test');
181
203
 
182
204
  assert.deepStrictEqual(created1, created2);
205
+
183
206
  assert.deepStrictEqual(created1, ['test', 'test', 'test']);
184
207
  });
185
208
  });
@@ -187,7 +210,9 @@ describe('Arr creations', () => {
187
210
  describe(copy, () => {
188
211
  test('should create a shallow copy of an array of primitives', () => {
189
212
  const original = [1, 2, 3] as const;
213
+
190
214
  const copied = copy(original);
215
+
191
216
  expectType<typeof copied, readonly [1, 2, 3]>('=');
192
217
 
193
218
  assert.deepStrictEqual(copied, original);
@@ -197,8 +222,11 @@ describe('Arr creations', () => {
197
222
 
198
223
  test('should create a shallow copy of an array of objects', () => {
199
224
  const obj1 = { id: 1 };
225
+
200
226
  const obj2 = { id: 2 };
227
+
201
228
  const original = [obj1, obj2] as const;
229
+
202
230
  const copied = copy(original);
203
231
 
204
232
  expectType<typeof copied, readonly [{ id: number }, { id: number }]>('=');
@@ -206,13 +234,17 @@ describe('Arr creations', () => {
206
234
  assert.deepStrictEqual(copied, original);
207
235
 
208
236
  expect(copied).not.toBe(original);
237
+
209
238
  expect(copied[0]).toBe(original[0]); // Object references are the same
239
+
210
240
  expect(copied[1]).toBe(original[1]);
211
241
  });
212
242
 
213
243
  test('should create a copy of an empty array', () => {
214
244
  const original = [] as const;
245
+
215
246
  const copied = copy(original);
247
+
216
248
  expectType<typeof copied, readonly []>('=');
217
249
 
218
250
  assert.deepStrictEqual(copied, original);
@@ -222,7 +254,9 @@ describe('Arr creations', () => {
222
254
 
223
255
  test('should create a copy of an array with mixed types', () => {
224
256
  const original = [1, 'hello', true, null, undefined] as const;
257
+
225
258
  const copied = copy(original);
259
+
226
260
  expectType<typeof copied, readonly [1, 'hello', true, null, undefined]>(
227
261
  '=',
228
262
  );
@@ -234,7 +268,9 @@ describe('Arr creations', () => {
234
268
 
235
269
  test('should handle unknown array type', () => {
236
270
  const mut_original: number[] = [1, 2, 3];
271
+
237
272
  const copied = copy(mut_original);
273
+
238
274
  expectType<typeof copied, number[]>('=');
239
275
 
240
276
  assert.deepStrictEqual(copied, mut_original);
@@ -245,12 +281,15 @@ describe('Arr creations', () => {
245
281
  mut_original.push(4);
246
282
 
247
283
  assert.deepStrictEqual(mut_original, [1, 2, 3, 4]);
284
+
248
285
  assert.deepStrictEqual(copied, [1, 2, 3]);
249
286
  });
250
287
 
251
288
  test('should create shallow copy of array', () => {
252
289
  const original = [1, 2, 3] as const;
290
+
253
291
  const copied = copy(original);
292
+
254
293
  expectType<typeof copied, readonly [1, 2, 3]>('=');
255
294
 
256
295
  assert.deepStrictEqual(copied, original);
@@ -260,6 +299,7 @@ describe('Arr creations', () => {
260
299
 
261
300
  test('should work with empty array', () => {
262
301
  const empty = [] as const;
302
+
263
303
  const copied = copy(empty);
264
304
 
265
305
  assert.deepStrictEqual(copied, []);
@@ -269,7 +309,9 @@ describe('Arr creations', () => {
269
309
 
270
310
  test('should preserve array type', () => {
271
311
  const mixed = [1, 'hello', true] as const;
312
+
272
313
  const copied = copy(mixed);
314
+
273
315
  expectType<typeof copied, readonly [1, 'hello', true]>('=');
274
316
 
275
317
  assert.deepStrictEqual(copied, [1, 'hello', true]);
@@ -279,6 +321,7 @@ describe('Arr creations', () => {
279
321
  describe(range, () => {
280
322
  test('start < end, step = 1 (default)', () => {
281
323
  const result = range(1, 5);
324
+
282
325
  expectType<typeof result, readonly [1, 2, 3, 4]>('=');
283
326
 
284
327
  assert.deepStrictEqual(result, [1, 2, 3, 4]);
@@ -286,6 +329,7 @@ describe('Arr creations', () => {
286
329
 
287
330
  test('start === end, step = 1 (default)', () => {
288
331
  const result = range(3, 3);
332
+
289
333
  expectType<typeof result, readonly []>('=');
290
334
 
291
335
  assert.deepStrictEqual(result, []);
@@ -293,6 +337,7 @@ describe('Arr creations', () => {
293
337
 
294
338
  test('start > end, step = 1 (default)', () => {
295
339
  const result = range(5, 1);
340
+
296
341
  expectType<typeof result, readonly []>('=');
297
342
 
298
343
  assert.deepStrictEqual(result, []);
@@ -300,6 +345,7 @@ describe('Arr creations', () => {
300
345
 
301
346
  test('start < end, step > 1', () => {
302
347
  const result = range(0, 6, 2);
348
+
303
349
  expectType<typeof result, readonly SafeUint[]>('='); // Type is less specific with explicit step
304
350
 
305
351
  assert.deepStrictEqual(result, [
@@ -351,13 +397,17 @@ describe('Arr creations', () => {
351
397
 
352
398
  test('unknown start/end/step', () => {
353
399
  const start: number = 1;
400
+
354
401
  const end: number = 4;
402
+
355
403
  const step: number = 1;
404
+
356
405
  const result = range(
357
406
  asUint32(start),
358
407
  asUint32(end),
359
408
  asNonZeroSafeInt(step),
360
409
  );
410
+
361
411
  expectType<typeof result, readonly SafeInt[]>('=');
362
412
 
363
413
  assert.deepStrictEqual(result, [
@@ -551,7 +601,9 @@ describe('Arr creations', () => {
551
601
  test('basic generator usage', () => {
552
602
  const result = generate<number>(function* () {
553
603
  yield 1;
604
+
554
605
  yield 2;
606
+
555
607
  yield 3;
556
608
  });
557
609
 
@@ -563,7 +615,9 @@ describe('Arr creations', () => {
563
615
  test('generator with yield*', () => {
564
616
  const result = generate<number>(function* () {
565
617
  yield 1;
618
+
566
619
  yield* [2, 3];
620
+
567
621
  yield 4;
568
622
  });
569
623
 
@@ -584,11 +638,14 @@ describe('Arr creations', () => {
584
638
 
585
639
  test('generator with conditional logic', () => {
586
640
  const condition = true as boolean; // Simulating a condition
641
+
587
642
  const result = generate<number>(function* () {
588
643
  yield 1;
644
+
589
645
  if (condition) {
590
646
  yield 2;
591
647
  }
648
+
592
649
  yield 3;
593
650
  });
594
651
 
@@ -599,11 +656,14 @@ describe('Arr creations', () => {
599
656
 
600
657
  test('generator with early return', () => {
601
658
  const condition = true as boolean; // Simulating a condition
659
+
602
660
  const result = generate<number>(function* () {
603
661
  yield 1;
662
+
604
663
  if (condition) {
605
664
  return; // Early return is OK
606
665
  }
666
+
607
667
  yield 2; // This won't be reached
608
668
  });
609
669
 
@@ -615,6 +675,7 @@ describe('Arr creations', () => {
615
675
  test('generator with complex data types', () => {
616
676
  const result = generate<{ id: number; name: string }>(function* () {
617
677
  yield { id: 1, name: 'Alice' };
678
+
618
679
  yield { id: 2, name: 'Bob' };
619
680
  });
620
681
 
@@ -629,7 +690,9 @@ describe('Arr creations', () => {
629
690
  test('generator with different types', () => {
630
691
  const result = generate<string | number>(function* () {
631
692
  yield 'hello';
693
+
632
694
  yield 42;
695
+
633
696
  yield 'world';
634
697
  });
635
698
 
@@ -656,7 +719,9 @@ describe('Arr creations', () => {
656
719
  // eslint-disable-next-line @typescript-eslint/require-await
657
720
  const result = await generateAsync<number>(async function* () {
658
721
  yield 1;
722
+
659
723
  yield 2;
724
+
660
725
  yield 3;
661
726
  });
662
727
 
@@ -668,10 +733,15 @@ describe('Arr creations', () => {
668
733
  test('should handle async operations in generator', async () => {
669
734
  const result = await generateAsync<string>(async function* () {
670
735
  await Promise.resolve();
736
+
671
737
  yield 'a';
738
+
672
739
  await Promise.resolve();
740
+
673
741
  yield 'b';
742
+
674
743
  await Promise.resolve();
744
+
675
745
  yield 'c';
676
746
  });
677
747
 
@@ -692,6 +762,7 @@ describe('Arr creations', () => {
692
762
  for (let i = 0; i < 3; i++) {
693
763
  // eslint-disable-next-line no-promise-executor-return, no-await-in-loop
694
764
  await new Promise((resolve) => setTimeout(resolve, 0));
765
+
695
766
  yield i;
696
767
  }
697
768
  });
@@ -9,11 +9,15 @@ import { Optional, pipe } from '../../functional/index.mjs';
9
9
  * const letters: readonly string[] = ['a', 'b', 'c'];
10
10
  *
11
11
  * const two = Arr.at(letters, 1);
12
+ *
12
13
  * const last = Arr.at(-1)(letters);
14
+ *
13
15
  * const missing = Arr.at(letters, 5);
14
16
  *
15
17
  * assert.deepStrictEqual(two, Optional.some('b'));
18
+ *
16
19
  * assert.deepStrictEqual(last, Optional.some('c'));
20
+ *
17
21
  * assert.deepStrictEqual(missing, Optional.none);
18
22
  * ```
19
23
  */
@@ -36,6 +40,7 @@ export function at<E>(
36
40
  switch (args.length) {
37
41
  case 2: {
38
42
  const [array, index] = args;
43
+
39
44
  return pipe(index < 0 ? array.length + index : index).map(
40
45
  (normalizedIndex) =>
41
46
  normalizedIndex < 0 || normalizedIndex >= array.length
@@ -44,8 +49,10 @@ export function at<E>(
44
49
  Optional.some(array[normalizedIndex]!),
45
50
  ).value;
46
51
  }
52
+
47
53
  case 1: {
48
54
  const [index] = args;
55
+
49
56
  return (array) => at(array, index);
50
57
  }
51
58
  }
@@ -58,12 +65,15 @@ export function at<E>(
58
65
  *
59
66
  * ```ts
60
67
  * const users = [{ id: 1 }, { id: 2 }];
68
+ *
61
69
  * const empty: { id: number }[] = [];
62
70
  *
63
71
  * const first = Arr.head(users);
72
+ *
64
73
  * const none = Arr.head(empty);
65
74
  *
66
75
  * assert.deepStrictEqual(first, Optional.some({ id: 1 }));
76
+ *
67
77
  * assert.deepStrictEqual(none, Optional.none);
68
78
  * ```
69
79
  */
@@ -86,12 +96,15 @@ export const head = <const Ar extends readonly unknown[]>(
86
96
  *
87
97
  * ```ts
88
98
  * const queue = ['first', 'second'];
99
+ *
89
100
  * const emptyQueue: string[] = [];
90
101
  *
91
102
  * const lastValue = Arr.last(queue);
103
+ *
92
104
  * const none = Arr.last(emptyQueue);
93
105
  *
94
106
  * assert.deepStrictEqual(lastValue, Optional.some('second'));
107
+ *
95
108
  * assert.deepStrictEqual(none, Optional.none);
96
109
  * ```
97
110
  */