ts-data-forge 5.0.0 → 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 (532) 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 +7 -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 +1 -0
  13. package/dist/array/impl/array-utils-modification.mjs.map +1 -1
  14. package/dist/array/impl/array-utils-reducing-value.d.mts +26 -2
  15. package/dist/array/impl/array-utils-reducing-value.d.mts.map +1 -1
  16. package/dist/array/impl/array-utils-reducing-value.mjs +2 -1
  17. package/dist/array/impl/array-utils-reducing-value.mjs.map +1 -1
  18. package/dist/array/impl/array-utils-search.d.mts +30 -0
  19. package/dist/array/impl/array-utils-search.d.mts.map +1 -1
  20. package/dist/array/impl/array-utils-search.mjs +1 -0
  21. package/dist/array/impl/array-utils-search.mjs.map +1 -1
  22. package/dist/array/impl/array-utils-set-op.d.mts +13 -0
  23. package/dist/array/impl/array-utils-set-op.d.mts.map +1 -1
  24. package/dist/array/impl/array-utils-set-op.mjs +13 -0
  25. package/dist/array/impl/array-utils-set-op.mjs.map +1 -1
  26. package/dist/array/impl/array-utils-size.d.mts +3 -0
  27. package/dist/array/impl/array-utils-size.d.mts.map +1 -1
  28. package/dist/array/impl/array-utils-size.mjs +3 -0
  29. package/dist/array/impl/array-utils-size.mjs.map +1 -1
  30. package/dist/array/impl/array-utils-slice-clamped.d.mts +2 -0
  31. package/dist/array/impl/array-utils-slice-clamped.d.mts.map +1 -1
  32. package/dist/array/impl/array-utils-slice-clamped.mjs.map +1 -1
  33. package/dist/array/impl/array-utils-slicing.d.mts +15 -0
  34. package/dist/array/impl/array-utils-slicing.d.mts.map +1 -1
  35. package/dist/array/impl/array-utils-slicing.mjs +7 -0
  36. package/dist/array/impl/array-utils-slicing.mjs.map +1 -1
  37. package/dist/array/impl/array-utils-transformation.d.mts +27 -0
  38. package/dist/array/impl/array-utils-transformation.d.mts.map +1 -1
  39. package/dist/array/impl/array-utils-transformation.mjs +7 -0
  40. package/dist/array/impl/array-utils-transformation.mjs.map +1 -1
  41. package/dist/array/impl/array-utils-validation.d.mts +17 -0
  42. package/dist/array/impl/array-utils-validation.d.mts.map +1 -1
  43. package/dist/array/impl/array-utils-validation.mjs +11 -0
  44. package/dist/array/impl/array-utils-validation.mjs.map +1 -1
  45. package/dist/collections/imap-mapped.mjs +1 -0
  46. package/dist/collections/imap-mapped.mjs.map +1 -1
  47. package/dist/collections/imap.d.mts +20 -0
  48. package/dist/collections/imap.d.mts.map +1 -1
  49. package/dist/collections/imap.mjs +3 -0
  50. package/dist/collections/imap.mjs.map +1 -1
  51. package/dist/collections/iset-mapped.d.mts +27 -0
  52. package/dist/collections/iset-mapped.d.mts.map +1 -1
  53. package/dist/collections/iset-mapped.mjs +7 -0
  54. package/dist/collections/iset-mapped.mjs.map +1 -1
  55. package/dist/collections/iset.d.mts +29 -0
  56. package/dist/collections/iset.d.mts.map +1 -1
  57. package/dist/collections/iset.mjs +7 -0
  58. package/dist/collections/iset.mjs.map +1 -1
  59. package/dist/collections/queue.d.mts +40 -0
  60. package/dist/collections/queue.d.mts.map +1 -1
  61. package/dist/collections/queue.mjs +9 -0
  62. package/dist/collections/queue.mjs.map +1 -1
  63. package/dist/collections/stack.d.mts +35 -0
  64. package/dist/collections/stack.d.mts.map +1 -1
  65. package/dist/collections/stack.mjs +8 -0
  66. package/dist/collections/stack.mjs.map +1 -1
  67. package/dist/entry-point.mjs +1 -1
  68. package/dist/functional/match.d.mts.map +1 -1
  69. package/dist/functional/match.mjs.map +1 -1
  70. package/dist/functional/optional/impl/optional-expect-to-be.d.mts +1 -0
  71. package/dist/functional/optional/impl/optional-expect-to-be.d.mts.map +1 -1
  72. package/dist/functional/optional/impl/optional-expect-to-be.mjs.map +1 -1
  73. package/dist/functional/optional/impl/optional-filter.d.mts +3 -0
  74. package/dist/functional/optional/impl/optional-filter.d.mts.map +1 -1
  75. package/dist/functional/optional/impl/optional-filter.mjs.map +1 -1
  76. package/dist/functional/optional/impl/optional-flat-map.d.mts +2 -0
  77. package/dist/functional/optional/impl/optional-flat-map.d.mts.map +1 -1
  78. package/dist/functional/optional/impl/optional-flat-map.mjs.map +1 -1
  79. package/dist/functional/optional/impl/optional-from-nullable.d.mts +2 -0
  80. package/dist/functional/optional/impl/optional-from-nullable.d.mts.map +1 -1
  81. package/dist/functional/optional/impl/optional-from-nullable.mjs +2 -0
  82. package/dist/functional/optional/impl/optional-from-nullable.mjs.map +1 -1
  83. package/dist/functional/optional/impl/optional-is-optional.d.mts +2 -0
  84. package/dist/functional/optional/impl/optional-is-optional.d.mts.map +1 -1
  85. package/dist/functional/optional/impl/optional-is-optional.mjs +2 -0
  86. package/dist/functional/optional/impl/optional-is-optional.mjs.map +1 -1
  87. package/dist/functional/optional/impl/optional-is-some.d.mts +1 -0
  88. package/dist/functional/optional/impl/optional-is-some.d.mts.map +1 -1
  89. package/dist/functional/optional/impl/optional-is-some.mjs +1 -0
  90. package/dist/functional/optional/impl/optional-is-some.mjs.map +1 -1
  91. package/dist/functional/optional/impl/optional-map.d.mts +2 -0
  92. package/dist/functional/optional/impl/optional-map.d.mts.map +1 -1
  93. package/dist/functional/optional/impl/optional-map.mjs.map +1 -1
  94. package/dist/functional/optional/impl/optional-none.d.mts +2 -0
  95. package/dist/functional/optional/impl/optional-none.d.mts.map +1 -1
  96. package/dist/functional/optional/impl/optional-none.mjs +2 -0
  97. package/dist/functional/optional/impl/optional-none.mjs.map +1 -1
  98. package/dist/functional/optional/impl/optional-or-else.d.mts +4 -0
  99. package/dist/functional/optional/impl/optional-or-else.d.mts.map +1 -1
  100. package/dist/functional/optional/impl/optional-or-else.mjs.map +1 -1
  101. package/dist/functional/optional/impl/optional-some.d.mts +3 -1
  102. package/dist/functional/optional/impl/optional-some.d.mts.map +1 -1
  103. package/dist/functional/optional/impl/optional-some.mjs +2 -0
  104. package/dist/functional/optional/impl/optional-some.mjs.map +1 -1
  105. package/dist/functional/optional/impl/optional-to-nullable.d.mts +2 -0
  106. package/dist/functional/optional/impl/optional-to-nullable.d.mts.map +1 -1
  107. package/dist/functional/optional/impl/optional-to-nullable.mjs +2 -0
  108. package/dist/functional/optional/impl/optional-to-nullable.mjs.map +1 -1
  109. package/dist/functional/optional/impl/optional-unwrap-or.d.mts +3 -0
  110. package/dist/functional/optional/impl/optional-unwrap-or.d.mts.map +1 -1
  111. package/dist/functional/optional/impl/optional-unwrap-or.mjs.map +1 -1
  112. package/dist/functional/optional/impl/optional-unwrap-throw.d.mts +1 -0
  113. package/dist/functional/optional/impl/optional-unwrap-throw.d.mts.map +1 -1
  114. package/dist/functional/optional/impl/optional-unwrap-throw.mjs +1 -0
  115. package/dist/functional/optional/impl/optional-unwrap-throw.mjs.map +1 -1
  116. package/dist/functional/optional/impl/optional-unwrap.d.mts +2 -0
  117. package/dist/functional/optional/impl/optional-unwrap.d.mts.map +1 -1
  118. package/dist/functional/optional/impl/optional-unwrap.mjs.map +1 -1
  119. package/dist/functional/optional/impl/optional-zip.d.mts +2 -0
  120. package/dist/functional/optional/impl/optional-zip.d.mts.map +1 -1
  121. package/dist/functional/optional/impl/optional-zip.mjs +2 -0
  122. package/dist/functional/optional/impl/optional-zip.mjs.map +1 -1
  123. package/dist/functional/result/impl/result-err.d.mts +3 -1
  124. package/dist/functional/result/impl/result-err.d.mts.map +1 -1
  125. package/dist/functional/result/impl/result-err.mjs +2 -0
  126. package/dist/functional/result/impl/result-err.mjs.map +1 -1
  127. package/dist/functional/result/impl/result-expect-to-be.d.mts +1 -0
  128. package/dist/functional/result/impl/result-expect-to-be.d.mts.map +1 -1
  129. package/dist/functional/result/impl/result-expect-to-be.mjs.map +1 -1
  130. package/dist/functional/result/impl/result-flat-map.d.mts +5 -0
  131. package/dist/functional/result/impl/result-flat-map.d.mts.map +1 -1
  132. package/dist/functional/result/impl/result-flat-map.mjs.map +1 -1
  133. package/dist/functional/result/impl/result-fold.d.mts +4 -0
  134. package/dist/functional/result/impl/result-fold.d.mts.map +1 -1
  135. package/dist/functional/result/impl/result-fold.mjs.map +1 -1
  136. package/dist/functional/result/impl/result-from-promise.d.mts +3 -0
  137. package/dist/functional/result/impl/result-from-promise.d.mts.map +1 -1
  138. package/dist/functional/result/impl/result-from-promise.mjs +3 -0
  139. package/dist/functional/result/impl/result-from-promise.mjs.map +1 -1
  140. package/dist/functional/result/impl/result-from-throwable.d.mts +2 -0
  141. package/dist/functional/result/impl/result-from-throwable.d.mts.map +1 -1
  142. package/dist/functional/result/impl/result-from-throwable.mjs +4 -1
  143. package/dist/functional/result/impl/result-from-throwable.mjs.map +1 -1
  144. package/dist/functional/result/impl/result-is-err.d.mts +2 -0
  145. package/dist/functional/result/impl/result-is-err.d.mts.map +1 -1
  146. package/dist/functional/result/impl/result-is-err.mjs +2 -0
  147. package/dist/functional/result/impl/result-is-err.mjs.map +1 -1
  148. package/dist/functional/result/impl/result-is-ok.d.mts +2 -0
  149. package/dist/functional/result/impl/result-is-ok.d.mts.map +1 -1
  150. package/dist/functional/result/impl/result-is-ok.mjs +2 -0
  151. package/dist/functional/result/impl/result-is-ok.mjs.map +1 -1
  152. package/dist/functional/result/impl/result-is-result.d.mts +4 -0
  153. package/dist/functional/result/impl/result-is-result.d.mts.map +1 -1
  154. package/dist/functional/result/impl/result-is-result.mjs +4 -0
  155. package/dist/functional/result/impl/result-is-result.mjs.map +1 -1
  156. package/dist/functional/result/impl/result-map-err.d.mts +3 -0
  157. package/dist/functional/result/impl/result-map-err.d.mts.map +1 -1
  158. package/dist/functional/result/impl/result-map-err.mjs.map +1 -1
  159. package/dist/functional/result/impl/result-map.d.mts +4 -0
  160. package/dist/functional/result/impl/result-map.d.mts.map +1 -1
  161. package/dist/functional/result/impl/result-map.mjs.map +1 -1
  162. package/dist/functional/result/impl/result-ok.d.mts +3 -1
  163. package/dist/functional/result/impl/result-ok.d.mts.map +1 -1
  164. package/dist/functional/result/impl/result-ok.mjs +2 -0
  165. package/dist/functional/result/impl/result-ok.mjs.map +1 -1
  166. package/dist/functional/result/impl/result-or-else.d.mts +4 -0
  167. package/dist/functional/result/impl/result-or-else.d.mts.map +1 -1
  168. package/dist/functional/result/impl/result-or-else.mjs.map +1 -1
  169. package/dist/functional/result/impl/result-swap.d.mts +2 -0
  170. package/dist/functional/result/impl/result-swap.d.mts.map +1 -1
  171. package/dist/functional/result/impl/result-swap.mjs +2 -0
  172. package/dist/functional/result/impl/result-swap.mjs.map +1 -1
  173. package/dist/functional/result/impl/result-to-optional.d.mts +2 -0
  174. package/dist/functional/result/impl/result-to-optional.d.mts.map +1 -1
  175. package/dist/functional/result/impl/result-to-optional.mjs +2 -0
  176. package/dist/functional/result/impl/result-to-optional.mjs.map +1 -1
  177. package/dist/functional/result/impl/result-unwrap-err-or.d.mts +3 -0
  178. package/dist/functional/result/impl/result-unwrap-err-or.d.mts.map +1 -1
  179. package/dist/functional/result/impl/result-unwrap-err-or.mjs.map +1 -1
  180. package/dist/functional/result/impl/result-unwrap-err-throw.d.mts +2 -0
  181. package/dist/functional/result/impl/result-unwrap-err-throw.d.mts.map +1 -1
  182. package/dist/functional/result/impl/result-unwrap-err-throw.mjs +2 -0
  183. package/dist/functional/result/impl/result-unwrap-err-throw.mjs.map +1 -1
  184. package/dist/functional/result/impl/result-unwrap-err.d.mts +1 -0
  185. package/dist/functional/result/impl/result-unwrap-err.d.mts.map +1 -1
  186. package/dist/functional/result/impl/result-unwrap-err.mjs +1 -0
  187. package/dist/functional/result/impl/result-unwrap-err.mjs.map +1 -1
  188. package/dist/functional/result/impl/result-unwrap-ok-or.d.mts +3 -0
  189. package/dist/functional/result/impl/result-unwrap-ok-or.d.mts.map +1 -1
  190. package/dist/functional/result/impl/result-unwrap-ok-or.mjs.map +1 -1
  191. package/dist/functional/result/impl/result-unwrap-ok.d.mts +1 -0
  192. package/dist/functional/result/impl/result-unwrap-ok.d.mts.map +1 -1
  193. package/dist/functional/result/impl/result-unwrap-ok.mjs.map +1 -1
  194. package/dist/functional/result/impl/result-unwrap-throw.d.mts +2 -0
  195. package/dist/functional/result/impl/result-unwrap-throw.d.mts.map +1 -1
  196. package/dist/functional/result/impl/result-unwrap-throw.mjs +2 -0
  197. package/dist/functional/result/impl/result-unwrap-throw.mjs.map +1 -1
  198. package/dist/functional/result/impl/result-zip.d.mts +3 -1
  199. package/dist/functional/result/impl/result-zip.d.mts.map +1 -1
  200. package/dist/functional/result/impl/result-zip.mjs +3 -1
  201. package/dist/functional/result/impl/result-zip.mjs.map +1 -1
  202. package/dist/functional/ternary-result/impl/ternary-result-err.d.mts +2 -1
  203. package/dist/functional/ternary-result/impl/ternary-result-err.d.mts.map +1 -1
  204. package/dist/functional/ternary-result/impl/ternary-result-err.mjs +1 -0
  205. package/dist/functional/ternary-result/impl/ternary-result-err.mjs.map +1 -1
  206. package/dist/functional/ternary-result/impl/ternary-result-expect-to-be.d.mts +1 -0
  207. package/dist/functional/ternary-result/impl/ternary-result-expect-to-be.d.mts.map +1 -1
  208. package/dist/functional/ternary-result/impl/ternary-result-expect-to-be.mjs.map +1 -1
  209. package/dist/functional/ternary-result/impl/ternary-result-flat-map.d.mts +4 -0
  210. package/dist/functional/ternary-result/impl/ternary-result-flat-map.d.mts.map +1 -1
  211. package/dist/functional/ternary-result/impl/ternary-result-flat-map.mjs.map +1 -1
  212. package/dist/functional/ternary-result/impl/ternary-result-fold.d.mts +2 -0
  213. package/dist/functional/ternary-result/impl/ternary-result-fold.d.mts.map +1 -1
  214. package/dist/functional/ternary-result/impl/ternary-result-fold.mjs.map +1 -1
  215. package/dist/functional/ternary-result/impl/ternary-result-from-promise.d.mts +2 -0
  216. package/dist/functional/ternary-result/impl/ternary-result-from-promise.d.mts.map +1 -1
  217. package/dist/functional/ternary-result/impl/ternary-result-from-promise.mjs +2 -0
  218. package/dist/functional/ternary-result/impl/ternary-result-from-promise.mjs.map +1 -1
  219. package/dist/functional/ternary-result/impl/ternary-result-from-throwable.d.mts +2 -0
  220. package/dist/functional/ternary-result/impl/ternary-result-from-throwable.d.mts.map +1 -1
  221. package/dist/functional/ternary-result/impl/ternary-result-from-throwable.mjs +4 -1
  222. package/dist/functional/ternary-result/impl/ternary-result-from-throwable.mjs.map +1 -1
  223. package/dist/functional/ternary-result/impl/ternary-result-is-ok.d.mts +1 -0
  224. package/dist/functional/ternary-result/impl/ternary-result-is-ok.d.mts.map +1 -1
  225. package/dist/functional/ternary-result/impl/ternary-result-is-ok.mjs +1 -0
  226. package/dist/functional/ternary-result/impl/ternary-result-is-ok.mjs.map +1 -1
  227. package/dist/functional/ternary-result/impl/ternary-result-is-ternary-result.d.mts +4 -0
  228. package/dist/functional/ternary-result/impl/ternary-result-is-ternary-result.d.mts.map +1 -1
  229. package/dist/functional/ternary-result/impl/ternary-result-is-ternary-result.mjs +4 -0
  230. package/dist/functional/ternary-result/impl/ternary-result-is-ternary-result.mjs.map +1 -1
  231. package/dist/functional/ternary-result/impl/ternary-result-is-warn.d.mts +1 -0
  232. package/dist/functional/ternary-result/impl/ternary-result-is-warn.d.mts.map +1 -1
  233. package/dist/functional/ternary-result/impl/ternary-result-is-warn.mjs +1 -0
  234. package/dist/functional/ternary-result/impl/ternary-result-is-warn.mjs.map +1 -1
  235. package/dist/functional/ternary-result/impl/ternary-result-map-err.d.mts +3 -0
  236. package/dist/functional/ternary-result/impl/ternary-result-map-err.d.mts.map +1 -1
  237. package/dist/functional/ternary-result/impl/ternary-result-map-err.mjs.map +1 -1
  238. package/dist/functional/ternary-result/impl/ternary-result-map-warn.d.mts +3 -0
  239. package/dist/functional/ternary-result/impl/ternary-result-map-warn.d.mts.map +1 -1
  240. package/dist/functional/ternary-result/impl/ternary-result-map-warn.mjs.map +1 -1
  241. package/dist/functional/ternary-result/impl/ternary-result-map.d.mts +6 -0
  242. package/dist/functional/ternary-result/impl/ternary-result-map.d.mts.map +1 -1
  243. package/dist/functional/ternary-result/impl/ternary-result-map.mjs.map +1 -1
  244. package/dist/functional/ternary-result/impl/ternary-result-ok.d.mts +1 -1
  245. package/dist/functional/ternary-result/impl/ternary-result-ok.d.mts.map +1 -1
  246. package/dist/functional/ternary-result/impl/ternary-result-ok.mjs.map +1 -1
  247. package/dist/functional/ternary-result/impl/ternary-result-or-else.d.mts +2 -0
  248. package/dist/functional/ternary-result/impl/ternary-result-or-else.d.mts.map +1 -1
  249. package/dist/functional/ternary-result/impl/ternary-result-or-else.mjs.map +1 -1
  250. package/dist/functional/ternary-result/impl/ternary-result-to-optional.d.mts +2 -0
  251. package/dist/functional/ternary-result/impl/ternary-result-to-optional.d.mts.map +1 -1
  252. package/dist/functional/ternary-result/impl/ternary-result-to-optional.mjs +2 -0
  253. package/dist/functional/ternary-result/impl/ternary-result-to-optional.mjs.map +1 -1
  254. package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-or.d.mts +2 -0
  255. package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-or.d.mts.map +1 -1
  256. package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-or.mjs.map +1 -1
  257. package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-throw.d.mts +1 -0
  258. package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-throw.d.mts.map +1 -1
  259. package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-throw.mjs +1 -0
  260. package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-throw.mjs.map +1 -1
  261. package/dist/functional/ternary-result/impl/ternary-result-unwrap-err.d.mts +2 -0
  262. package/dist/functional/ternary-result/impl/ternary-result-unwrap-err.d.mts.map +1 -1
  263. package/dist/functional/ternary-result/impl/ternary-result-unwrap-err.mjs +2 -0
  264. package/dist/functional/ternary-result/impl/ternary-result-unwrap-err.mjs.map +1 -1
  265. package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok-or.d.mts +2 -0
  266. package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok-or.d.mts.map +1 -1
  267. package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok-or.mjs.map +1 -1
  268. package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok.d.mts +2 -0
  269. package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok.d.mts.map +1 -1
  270. package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok.mjs.map +1 -1
  271. package/dist/functional/ternary-result/impl/ternary-result-unwrap-throw.d.mts +1 -0
  272. package/dist/functional/ternary-result/impl/ternary-result-unwrap-throw.d.mts.map +1 -1
  273. package/dist/functional/ternary-result/impl/ternary-result-unwrap-throw.mjs +1 -0
  274. package/dist/functional/ternary-result/impl/ternary-result-unwrap-throw.mjs.map +1 -1
  275. package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-or.d.mts +2 -0
  276. package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-or.d.mts.map +1 -1
  277. package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-or.mjs.map +1 -1
  278. package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-throw.d.mts +1 -0
  279. package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-throw.d.mts.map +1 -1
  280. package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-throw.mjs +1 -0
  281. package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-throw.mjs.map +1 -1
  282. package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn.d.mts +2 -0
  283. package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn.d.mts.map +1 -1
  284. package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn.mjs +2 -0
  285. package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn.mjs.map +1 -1
  286. package/dist/functional/ternary-result/impl/ternary-result-warn.d.mts +1 -1
  287. package/dist/functional/ternary-result/impl/ternary-result-warn.d.mts.map +1 -1
  288. package/dist/functional/ternary-result/impl/ternary-result-warn.mjs.map +1 -1
  289. package/dist/functional/ternary-result/impl/ternary-result-zip.d.mts +4 -0
  290. package/dist/functional/ternary-result/impl/ternary-result-zip.d.mts.map +1 -1
  291. package/dist/functional/ternary-result/impl/ternary-result-zip.mjs +4 -0
  292. package/dist/functional/ternary-result/impl/ternary-result-zip.mjs.map +1 -1
  293. package/dist/globals.d.mts +10 -0
  294. package/dist/guard/index.mjs +1 -1
  295. package/dist/guard/is-record.d.mts +31 -0
  296. package/dist/guard/is-record.d.mts.map +1 -1
  297. package/dist/guard/is-record.mjs +32 -1
  298. package/dist/guard/is-record.mjs.map +1 -1
  299. package/dist/guard/is-type.d.mts +3 -0
  300. package/dist/guard/is-type.d.mts.map +1 -1
  301. package/dist/guard/is-type.mjs +3 -0
  302. package/dist/guard/is-type.mjs.map +1 -1
  303. package/dist/guard/key-is-in.d.mts +1 -0
  304. package/dist/guard/key-is-in.d.mts.map +1 -1
  305. package/dist/guard/key-is-in.mjs +1 -0
  306. package/dist/guard/key-is-in.mjs.map +1 -1
  307. package/dist/index.mjs +1 -1
  308. package/dist/iterator/range.d.mts +4 -0
  309. package/dist/iterator/range.d.mts.map +1 -1
  310. package/dist/iterator/range.mjs +1 -0
  311. package/dist/iterator/range.mjs.map +1 -1
  312. package/dist/json/json.d.mts +21 -0
  313. package/dist/json/json.d.mts.map +1 -1
  314. package/dist/json/json.mjs +22 -0
  315. package/dist/json/json.mjs.map +1 -1
  316. package/dist/number/branded-types/int.d.mts +14 -0
  317. package/dist/number/branded-types/int.d.mts.map +1 -1
  318. package/dist/number/branded-types/int.mjs +14 -0
  319. package/dist/number/branded-types/int.mjs.map +1 -1
  320. package/dist/number/branded-types/non-zero-safe-int.mjs +2 -2
  321. package/dist/number/branded-types/positive-int.d.mts +14 -0
  322. package/dist/number/branded-types/positive-int.d.mts.map +1 -1
  323. package/dist/number/branded-types/positive-int.mjs +14 -0
  324. package/dist/number/branded-types/positive-int.mjs.map +1 -1
  325. package/dist/number/branded-types/positive-safe-int.d.mts +21 -0
  326. package/dist/number/branded-types/positive-safe-int.d.mts.map +1 -1
  327. package/dist/number/branded-types/positive-safe-int.mjs +22 -1
  328. package/dist/number/branded-types/positive-safe-int.mjs.map +1 -1
  329. package/dist/number/branded-types/safe-int.d.mts +21 -0
  330. package/dist/number/branded-types/safe-int.d.mts.map +1 -1
  331. package/dist/number/branded-types/safe-int.mjs +23 -2
  332. package/dist/number/branded-types/safe-int.mjs.map +1 -1
  333. package/dist/number/branded-types/safe-uint.mjs +1 -1
  334. package/dist/number/branded-types/uint.d.mts +12 -0
  335. package/dist/number/branded-types/uint.d.mts.map +1 -1
  336. package/dist/number/branded-types/uint.mjs +12 -0
  337. package/dist/number/branded-types/uint.mjs.map +1 -1
  338. package/dist/number/num.d.mts +9 -0
  339. package/dist/number/num.d.mts.map +1 -1
  340. package/dist/number/num.mjs +8 -1
  341. package/dist/number/num.mjs.map +1 -1
  342. package/dist/number/refined-number-utils.d.mts +22 -0
  343. package/dist/number/refined-number-utils.d.mts.map +1 -1
  344. package/dist/number/refined-number-utils.mjs +23 -0
  345. package/dist/number/refined-number-utils.mjs.map +1 -1
  346. package/dist/object/object.d.mts +9 -0
  347. package/dist/object/object.d.mts.map +1 -1
  348. package/dist/object/object.mjs +7 -0
  349. package/dist/object/object.mjs.map +1 -1
  350. package/dist/others/map-nullable.mjs.map +1 -1
  351. package/dist/others/tuple.d.mts +11 -0
  352. package/dist/others/tuple.d.mts.map +1 -1
  353. package/dist/others/tuple.mjs +11 -0
  354. package/dist/others/tuple.mjs.map +1 -1
  355. package/dist/others/unknown-to-string.d.mts.map +1 -1
  356. package/dist/others/unknown-to-string.mjs +2 -1
  357. package/dist/others/unknown-to-string.mjs.map +1 -1
  358. package/dist/promise/promise.d.mts +4 -0
  359. package/dist/promise/promise.d.mts.map +1 -1
  360. package/dist/promise/promise.mjs +5 -0
  361. package/dist/promise/promise.mjs.map +1 -1
  362. package/package.json +20 -24
  363. package/src/array/impl/array-utils-creation.mts +20 -0
  364. package/src/array/impl/array-utils-creation.test.mts +71 -0
  365. package/src/array/impl/array-utils-element-access.mts +13 -0
  366. package/src/array/impl/array-utils-element-access.test.mts +21 -0
  367. package/src/array/impl/array-utils-iterators.test.mts +17 -0
  368. package/src/array/impl/array-utils-modification.mts +40 -0
  369. package/src/array/impl/array-utils-modification.test.mts +75 -0
  370. package/src/array/impl/array-utils-overload-type-error.test.mts +19 -0
  371. package/src/array/impl/array-utils-reducing-value.mts +55 -9
  372. package/src/array/impl/array-utils-reducing-value.test.mts +90 -0
  373. package/src/array/impl/array-utils-search.mts +53 -0
  374. package/src/array/impl/array-utils-search.test.mts +51 -0
  375. package/src/array/impl/array-utils-set-op.mts +19 -0
  376. package/src/array/impl/array-utils-set-op.test.mts +116 -0
  377. package/src/array/impl/array-utils-size.mts +3 -0
  378. package/src/array/impl/array-utils-size.test.mts +1 -0
  379. package/src/array/impl/array-utils-slice-clamped.mts +7 -0
  380. package/src/array/impl/array-utils-slice-clamped.test.mts +20 -0
  381. package/src/array/impl/array-utils-slicing.mts +27 -0
  382. package/src/array/impl/array-utils-slicing.test.mts +57 -0
  383. package/src/array/impl/array-utils-transformation.mts +58 -0
  384. package/src/array/impl/array-utils-transformation.test.mts +113 -1
  385. package/src/array/impl/array-utils-validation.mts +23 -0
  386. package/src/array/impl/array-utils-validation.test.mts +96 -0
  387. package/src/array/impl/array.test.mts +12 -0
  388. package/src/collections/imap-mapped.mts +11 -0
  389. package/src/collections/imap-mapped.test.mts +70 -0
  390. package/src/collections/imap.mts +32 -0
  391. package/src/collections/imap.test.mts +106 -0
  392. package/src/collections/iset-mapped.mts +35 -0
  393. package/src/collections/iset-mapped.test.mts +111 -0
  394. package/src/collections/iset.mts +34 -0
  395. package/src/collections/iset.test.mts +193 -0
  396. package/src/collections/queue.mts +53 -0
  397. package/src/collections/queue.test.mts +32 -0
  398. package/src/collections/stack.mts +42 -0
  399. package/src/collections/stack.test.mts +44 -0
  400. package/src/functional/match.mts +16 -0
  401. package/src/functional/match.test.mts +2 -0
  402. package/src/functional/optional/impl/optional-expect-to-be.mts +3 -0
  403. package/src/functional/optional/impl/optional-filter.mts +6 -0
  404. package/src/functional/optional/impl/optional-flat-map.mts +4 -0
  405. package/src/functional/optional/impl/optional-from-nullable.mts +2 -0
  406. package/src/functional/optional/impl/optional-is-optional.mts +2 -0
  407. package/src/functional/optional/impl/optional-is-some.mts +1 -0
  408. package/src/functional/optional/impl/optional-map.mts +5 -0
  409. package/src/functional/optional/impl/optional-none.mts +2 -0
  410. package/src/functional/optional/impl/optional-or-else.mts +6 -0
  411. package/src/functional/optional/impl/optional-some.mts +3 -1
  412. package/src/functional/optional/impl/optional-to-nullable.mts +2 -0
  413. package/src/functional/optional/impl/optional-unwrap-or.mts +5 -0
  414. package/src/functional/optional/impl/optional-unwrap-throw.mts +1 -0
  415. package/src/functional/optional/impl/optional-unwrap.mts +2 -0
  416. package/src/functional/optional/impl/optional-zip.mts +2 -0
  417. package/src/functional/optional.test.mts +73 -0
  418. package/src/functional/pipe.test.mts +3 -0
  419. package/src/functional/result/impl/result-err.mts +3 -1
  420. package/src/functional/result/impl/result-expect-to-be.mts +3 -0
  421. package/src/functional/result/impl/result-flat-map.mts +7 -0
  422. package/src/functional/result/impl/result-fold.mts +6 -0
  423. package/src/functional/result/impl/result-from-promise.mts +3 -0
  424. package/src/functional/result/impl/result-from-throwable.mts +6 -1
  425. package/src/functional/result/impl/result-is-err.mts +2 -0
  426. package/src/functional/result/impl/result-is-ok.mts +2 -0
  427. package/src/functional/result/impl/result-is-result.mts +4 -0
  428. package/src/functional/result/impl/result-map-err.mts +5 -0
  429. package/src/functional/result/impl/result-map.mts +6 -0
  430. package/src/functional/result/impl/result-ok.mts +3 -1
  431. package/src/functional/result/impl/result-or-else.mts +6 -0
  432. package/src/functional/result/impl/result-swap.mts +2 -0
  433. package/src/functional/result/impl/result-to-optional.mts +2 -0
  434. package/src/functional/result/impl/result-unwrap-err-or.mts +5 -0
  435. package/src/functional/result/impl/result-unwrap-err-throw.mts +2 -0
  436. package/src/functional/result/impl/result-unwrap-err.mts +1 -0
  437. package/src/functional/result/impl/result-unwrap-ok-or.mts +5 -0
  438. package/src/functional/result/impl/result-unwrap-ok.mts +2 -0
  439. package/src/functional/result/impl/result-unwrap-throw.mts +2 -0
  440. package/src/functional/result/impl/result-zip.mts +3 -1
  441. package/src/functional/result.test.mts +88 -0
  442. package/src/functional/ternary-result/impl/ternary-result-err.mts +2 -1
  443. package/src/functional/ternary-result/impl/ternary-result-expect-to-be.mts +4 -0
  444. package/src/functional/ternary-result/impl/ternary-result-flat-map.mts +7 -0
  445. package/src/functional/ternary-result/impl/ternary-result-fold.mts +5 -0
  446. package/src/functional/ternary-result/impl/ternary-result-from-promise.mts +2 -0
  447. package/src/functional/ternary-result/impl/ternary-result-from-throwable.mts +5 -1
  448. package/src/functional/ternary-result/impl/ternary-result-is-ok.mts +1 -0
  449. package/src/functional/ternary-result/impl/ternary-result-is-ternary-result.mts +4 -0
  450. package/src/functional/ternary-result/impl/ternary-result-is-warn.mts +1 -0
  451. package/src/functional/ternary-result/impl/ternary-result-map-err.mts +6 -0
  452. package/src/functional/ternary-result/impl/ternary-result-map-warn.mts +6 -0
  453. package/src/functional/ternary-result/impl/ternary-result-map.mts +9 -0
  454. package/src/functional/ternary-result/impl/ternary-result-ok.mts +1 -1
  455. package/src/functional/ternary-result/impl/ternary-result-or-else.mts +5 -0
  456. package/src/functional/ternary-result/impl/ternary-result-to-optional.mts +2 -0
  457. package/src/functional/ternary-result/impl/ternary-result-unwrap-err-or.mts +5 -0
  458. package/src/functional/ternary-result/impl/ternary-result-unwrap-err-throw.mts +1 -0
  459. package/src/functional/ternary-result/impl/ternary-result-unwrap-err.mts +2 -0
  460. package/src/functional/ternary-result/impl/ternary-result-unwrap-ok-or.mts +5 -0
  461. package/src/functional/ternary-result/impl/ternary-result-unwrap-ok.mts +3 -0
  462. package/src/functional/ternary-result/impl/ternary-result-unwrap-throw.mts +1 -0
  463. package/src/functional/ternary-result/impl/ternary-result-unwrap-warn-or.mts +5 -0
  464. package/src/functional/ternary-result/impl/ternary-result-unwrap-warn-throw.mts +1 -0
  465. package/src/functional/ternary-result/impl/ternary-result-unwrap-warn.mts +2 -0
  466. package/src/functional/ternary-result/impl/ternary-result-warn.mts +4 -1
  467. package/src/functional/ternary-result/impl/ternary-result-zip.mts +4 -0
  468. package/src/functional/ternary-result.test.mts +91 -0
  469. package/src/globals.d.mts +10 -0
  470. package/src/guard/has-key.test.mts +9 -0
  471. package/src/guard/is-non-empty-string.test.mts +20 -0
  472. package/src/guard/is-non-null-object.test.mts +19 -0
  473. package/src/guard/is-primitive.test.mts +23 -0
  474. package/src/guard/is-record.mts +34 -0
  475. package/src/guard/is-record.test.mts +21 -0
  476. package/src/guard/is-type.mts +3 -0
  477. package/src/guard/is-type.test.mts +134 -0
  478. package/src/guard/key-is-in.mts +1 -0
  479. package/src/iterator/range.mts +9 -0
  480. package/src/json/json.mts +29 -0
  481. package/src/json/json.test.mts +87 -0
  482. package/src/number/branded-types/finite-number.test.mts +38 -0
  483. package/src/number/branded-types/int.mts +14 -0
  484. package/src/number/branded-types/int.test.mts +42 -0
  485. package/src/number/branded-types/int16.test.mts +47 -0
  486. package/src/number/branded-types/int32.test.mts +47 -0
  487. package/src/number/branded-types/non-negative-finite-number.test.mts +40 -0
  488. package/src/number/branded-types/non-negative-int16.test.mts +43 -0
  489. package/src/number/branded-types/non-negative-int32.test.mts +43 -0
  490. package/src/number/branded-types/non-zero-finite-number.test.mts +51 -0
  491. package/src/number/branded-types/non-zero-int.test.mts +53 -0
  492. package/src/number/branded-types/non-zero-int16.test.mts +44 -0
  493. package/src/number/branded-types/non-zero-int32.test.mts +44 -0
  494. package/src/number/branded-types/non-zero-safe-int.mts +2 -2
  495. package/src/number/branded-types/non-zero-safe-int.test.mts +62 -0
  496. package/src/number/branded-types/non-zero-uint16.test.mts +37 -0
  497. package/src/number/branded-types/non-zero-uint32.test.mts +37 -0
  498. package/src/number/branded-types/positive-finite-number.test.mts +45 -0
  499. package/src/number/branded-types/positive-int.mts +14 -0
  500. package/src/number/branded-types/positive-int.test.mts +47 -0
  501. package/src/number/branded-types/positive-int16.test.mts +35 -0
  502. package/src/number/branded-types/positive-int32.test.mts +35 -0
  503. package/src/number/branded-types/positive-safe-int.mts +22 -1
  504. package/src/number/branded-types/positive-safe-int.test.mts +49 -0
  505. package/src/number/branded-types/positive-uint16.test.mts +37 -0
  506. package/src/number/branded-types/positive-uint32.test.mts +37 -0
  507. package/src/number/branded-types/safe-int.mts +23 -2
  508. package/src/number/branded-types/safe-int.test.mts +52 -0
  509. package/src/number/branded-types/safe-uint.mts +1 -1
  510. package/src/number/branded-types/safe-uint.test.mts +48 -0
  511. package/src/number/branded-types/uint.mts +12 -0
  512. package/src/number/branded-types/uint.test.mts +43 -0
  513. package/src/number/branded-types/uint16.test.mts +41 -0
  514. package/src/number/branded-types/uint32.test.mts +41 -0
  515. package/src/number/enum/int8.test.mts +6 -0
  516. package/src/number/enum/uint8.test.mts +6 -0
  517. package/src/number/num.mts +12 -1
  518. package/src/number/num.test.mts +62 -0
  519. package/src/number/refined-number-utils.mts +25 -0
  520. package/src/object/object.mts +15 -0
  521. package/src/object/object.test.mts +10 -0
  522. package/src/others/cast-mutable.test.mts +7 -0
  523. package/src/others/cast-readonly.test.mts +17 -0
  524. package/src/others/if-then.test.mts +16 -0
  525. package/src/others/map-nullable.mts +3 -0
  526. package/src/others/map-nullable.test.mts +27 -0
  527. package/src/others/memoize-function.test.mts +41 -0
  528. package/src/others/tuple.mts +11 -0
  529. package/src/others/unknown-to-string.mts +4 -1
  530. package/src/others/unknown-to-string.test.mts +10 -0
  531. package/src/promise/promise.mts +4 -0
  532. package/src/promise/promise.test.mts +1 -0
@@ -14,9 +14,11 @@ import { asUint32 } from '../../number/index.mjs';
14
14
  * ];
15
15
  *
16
16
  * const found = Arr.find(users, (user) => user.id === 2);
17
+ *
17
18
  * const missing = Arr.find<{ id: number }>((user) => user.id === 3)(users);
18
19
  *
19
20
  * assert.deepStrictEqual(found, Optional.some({ id: 2, name: 'Grace' }));
21
+ *
20
22
  * assert.deepStrictEqual(missing, Optional.none);
21
23
  * ```
22
24
  */
@@ -55,6 +57,7 @@ export function find<E>(
55
57
  switch (args.length) {
56
58
  case 2: {
57
59
  const [array, predicate] = args;
60
+
58
61
  const foundIndex = array.findIndex(
59
62
  // eslint-disable-next-line total-functions/no-unsafe-type-assertion
60
63
  predicate as () => boolean,
@@ -75,6 +78,7 @@ export function find<E>(
75
78
  : // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
76
79
  Optional.some(array[foundIndex]!);
77
80
  }
81
+
78
82
  case 1: {
79
83
  const [predicate] = args;
80
84
 
@@ -97,9 +101,11 @@ export function find<E>(
97
101
  * const numbers = [1, 3, 2, 4, 5];
98
102
  *
99
103
  * const lastEven = Arr.findLast(numbers, (n) => n % 2 === 0);
104
+ *
100
105
  * const none = Arr.findLast<number>((n) => n > 10)(numbers);
101
106
  *
102
107
  * assert.deepStrictEqual(lastEven, Optional.some(4));
108
+ *
103
109
  * assert.deepStrictEqual(none, Optional.none);
104
110
  * ```
105
111
  */
@@ -138,6 +144,7 @@ export function findLast<E>(
138
144
  switch (args.length) {
139
145
  case 2: {
140
146
  const [array, predicate] = args;
147
+
141
148
  const foundIndex = array.findLastIndex(
142
149
  // eslint-disable-next-line total-functions/no-unsafe-type-assertion
143
150
  predicate as () => boolean,
@@ -158,6 +165,7 @@ export function findLast<E>(
158
165
  : // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
159
166
  Optional.some(array[foundIndex]!);
160
167
  }
168
+
161
169
  case 1: {
162
170
  const [predicate] = args;
163
171
 
@@ -180,12 +188,14 @@ export function findLast<E>(
180
188
  * const letters = ['a', 'b', 'c'];
181
189
  *
182
190
  * const indexOfB = Arr.findIndex(letters, (letter) => letter === 'b');
191
+ *
183
192
  * // eslint-disable-next-line unicorn/prefer-array-index-of
184
193
  * const indexOfMissing = Arr.findIndex<string>((letter) => letter === 'z')(
185
194
  * letters,
186
195
  * );
187
196
  *
188
197
  * assert(indexOfB === 1);
198
+ *
189
199
  * assert(indexOfMissing === -1);
190
200
  * ```
191
201
  */
@@ -219,6 +229,7 @@ export function findIndex<E>(
219
229
  switch (args.length) {
220
230
  case 2: {
221
231
  const [array, predicate] = args;
232
+
222
233
  return pipe(
223
234
  array.findIndex(
224
235
  // eslint-disable-next-line total-functions/no-unsafe-type-assertion
@@ -226,8 +237,10 @@ export function findIndex<E>(
226
237
  ),
227
238
  ).map((idx) => (idx >= 0 ? asUint32(idx) : -1)).value;
228
239
  }
240
+
229
241
  case 1: {
230
242
  const [predicate] = args;
243
+
231
244
  return (array) => findIndex(array, predicate);
232
245
  }
233
246
  }
@@ -242,10 +255,12 @@ export function findIndex<E>(
242
255
  * const letters = ['a', 'b', 'c', 'b'];
243
256
  *
244
257
  * const lastIndexOfB = Arr.findLastIndex(letters, (letter) => letter === 'b');
258
+ *
245
259
  * // eslint-disable-next-line unicorn/prefer-array-index-of
246
260
  * const notFound = Arr.findLastIndex<string>((letter) => letter === 'z')(letters);
247
261
  *
248
262
  * assert(lastIndexOfB === 3);
263
+ *
249
264
  * assert(notFound === -1);
250
265
  * ```
251
266
  */
@@ -279,6 +294,7 @@ export function findLastIndex<E>(
279
294
  switch (args.length) {
280
295
  case 2: {
281
296
  const [array, predicate] = args;
297
+
282
298
  return pipe(
283
299
  array.findLastIndex(
284
300
  // eslint-disable-next-line total-functions/no-unsafe-type-assertion
@@ -286,8 +302,10 @@ export function findLastIndex<E>(
286
302
  ),
287
303
  ).map((idx) => (idx >= 0 ? asUint32(idx) : -1)).value;
288
304
  }
305
+
289
306
  case 1: {
290
307
  const [predicate] = args;
308
+
291
309
  return (array) => findLastIndex(array, predicate);
292
310
  }
293
311
  }
@@ -302,14 +320,18 @@ export function findLastIndex<E>(
302
320
  * const fruits = ['apple', 'banana', 'orange', 'banana'];
303
321
  *
304
322
  * const indexOfBanana = Arr.indexOf(fruits, 'banana');
323
+ *
305
324
  * const indexOfGrape = Arr.indexOf(fruits, 'grape');
306
325
  *
307
326
  * // Curried version
308
327
  * const findApple = Arr.indexOf('apple');
328
+ *
309
329
  * const indexOfApple = findApple(fruits);
310
330
  *
311
331
  * console.log(indexOfBanana); // => 1
332
+ *
312
333
  * console.log(indexOfGrape); // => -1
334
+ *
313
335
  * console.log(indexOfApple); // => 0
314
336
  * ```
315
337
  */
@@ -332,10 +354,13 @@ export function indexOf<E>(
332
354
  const [array, searchElement] = args;
333
355
 
334
356
  const index = array.indexOf(searchElement);
357
+
335
358
  return index !== -1 ? asUint32(index) : -1;
336
359
  }
360
+
337
361
  case 1: {
338
362
  const [searchElement] = args;
363
+
339
364
  return (array) => indexOf(array, searchElement);
340
365
  }
341
366
  }
@@ -351,18 +376,24 @@ export function indexOf<E>(
351
376
  *
352
377
  * // Search for 'banana' starting from index 1
353
378
  * const firstBanana = Arr.indexOfFrom(fruits, 'banana', 1);
379
+ *
354
380
  * // Search for 'banana' starting from index 2
355
381
  * const secondBanana = Arr.indexOfFrom(fruits, 'banana', 2);
382
+ *
356
383
  * // Element not found
357
384
  * const notFound = Arr.indexOfFrom(fruits, 'grape', 0);
358
385
  *
359
386
  * // Curried version
360
387
  * const findBananaFrom2 = Arr.indexOfFrom('banana', 2);
388
+ *
361
389
  * const index = findBananaFrom2(fruits);
362
390
  *
363
391
  * console.log(firstBanana); // => 1
392
+ *
364
393
  * console.log(secondBanana); // => 3
394
+ *
365
395
  * console.log(notFound); // => -1
396
+ *
366
397
  * console.log(index); // => 3
367
398
  * ```
368
399
  */
@@ -389,11 +420,15 @@ export function indexOfFrom<E>(
389
420
  switch (args.length) {
390
421
  case 3: {
391
422
  const [array, searchElement, fromIndex] = args;
423
+
392
424
  const index = array.indexOf(searchElement, fromIndex);
425
+
393
426
  return index !== -1 ? asUint32(index) : -1;
394
427
  }
428
+
395
429
  case 2: {
396
430
  const [searchElement, fromIndex] = args;
431
+
397
432
  return (array) => indexOfFrom(array, searchElement, fromIndex);
398
433
  }
399
434
  }
@@ -408,16 +443,22 @@ export function indexOfFrom<E>(
408
443
  * const fruits = ['apple', 'banana', 'orange', 'banana'];
409
444
  *
410
445
  * const lastBanana = Arr.lastIndexOf(fruits, 'banana');
446
+ *
411
447
  * const lastApple = Arr.lastIndexOf(fruits, 'apple');
448
+ *
412
449
  * const notFound = Arr.lastIndexOf(fruits, 'grape');
413
450
  *
414
451
  * // Curried version
415
452
  * const findLastBanana = Arr.lastIndexOf('banana');
453
+ *
416
454
  * const index = findLastBanana(fruits);
417
455
  *
418
456
  * console.log(lastBanana); // => 3
457
+ *
419
458
  * console.log(lastApple); // => 0
459
+ *
420
460
  * console.log(notFound); // => -1
461
+ *
421
462
  * console.log(index); // => 3
422
463
  * ```
423
464
  */
@@ -438,11 +479,15 @@ export function lastIndexOf<E>(
438
479
  switch (args.length) {
439
480
  case 2: {
440
481
  const [array, searchElement] = args;
482
+
441
483
  const index = array.lastIndexOf(searchElement);
484
+
442
485
  return index !== -1 ? asUint32(index) : -1;
443
486
  }
487
+
444
488
  case 1: {
445
489
  const [searchElement] = args;
490
+
446
491
  return (array) => lastIndexOf(array, searchElement);
447
492
  }
448
493
  }
@@ -458,18 +503,24 @@ export function lastIndexOf<E>(
458
503
  *
459
504
  * // Search backwards for 'banana' from index 3
460
505
  * const lastBananaFrom3 = Arr.lastIndexOfFrom(fruits, 'banana', 3);
506
+ *
461
507
  * // Search backwards for 'banana' from index 2
462
508
  * const lastBananaFrom2 = Arr.lastIndexOfFrom(fruits, 'banana', 2);
509
+ *
463
510
  * // Element not found
464
511
  * const notFound = Arr.lastIndexOfFrom(fruits, 'grape', 2);
465
512
  *
466
513
  * // Curried version
467
514
  * const findBananaFrom3 = Arr.lastIndexOfFrom('banana', 3);
515
+ *
468
516
  * const index = findBananaFrom3(fruits);
469
517
  *
470
518
  * console.log(lastBananaFrom3); // => 3
519
+ *
471
520
  * console.log(lastBananaFrom2); // => 1
521
+ *
472
522
  * console.log(notFound); // => -1
523
+ *
473
524
  * console.log(index); // => 3
474
525
  * ```
475
526
  */
@@ -501,8 +552,10 @@ export function lastIndexOfFrom<E>(
501
552
 
502
553
  return index !== -1 ? asUint32(index) : -1;
503
554
  }
555
+
504
556
  case 2: {
505
557
  const [searchElement, fromIndex] = args;
558
+
506
559
  return (array) => lastIndexOfFrom(array, searchElement, fromIndex);
507
560
  }
508
561
  }
@@ -15,14 +15,17 @@ describe('Arr search operations', () => {
15
15
  describe(find, () => {
16
16
  test('should find first element matching predicate', () => {
17
17
  const numbers = [1, 2, 3, 4, 5];
18
+
18
19
  const firstEven = find(numbers, (n) => n % 2 === 0);
19
20
 
20
21
  expect(Optional.isSome(firstEven)).toBe(true);
22
+
21
23
  expect(Optional.unwrap(firstEven)).toBe(2);
22
24
  });
23
25
 
24
26
  test('should return None when no element matches', () => {
25
27
  const odds = [1, 3, 5];
28
+
26
29
  const firstEven = find(odds, (n) => n % 2 === 0);
27
30
 
28
31
  expect(Optional.isNone(firstEven)).toBe(true);
@@ -30,18 +33,23 @@ describe('Arr search operations', () => {
30
33
 
31
34
  test('should work with curried version', () => {
32
35
  const isEven = (n: number): boolean => n % 2 === 0;
36
+
33
37
  const findEven = find<number>(isEven);
34
38
 
35
39
  const result1 = findEven([1, 2, 3]);
40
+
36
41
  const result2 = findEven([1, 3, 5]);
37
42
 
38
43
  expect(Optional.isSome(result1)).toBe(true);
44
+
39
45
  expect(Optional.unwrap(result1)).toBe(2);
46
+
40
47
  expect(Optional.isNone(result2)).toBe(true);
41
48
  });
42
49
 
43
50
  test('should work with type guard predicate', () => {
44
51
  const values: readonly (string | number)[] = [1, 'a', 2, 'b'];
52
+
45
53
  const firstString = find(
46
54
  values,
47
55
  (x): x is string => typeof x === 'string',
@@ -50,11 +58,13 @@ describe('Arr search operations', () => {
50
58
  expectType<typeof firstString, Optional<string>>('=');
51
59
 
52
60
  expect(Optional.isSome(firstString)).toBe(true);
61
+
53
62
  expect(Optional.unwrap(firstString)).toBe('a');
54
63
  });
55
64
 
56
65
  test('should provide index and array to predicate', () => {
57
66
  const numbers = [10, 20, 30];
67
+
58
68
  const foundWithIndex = find(numbers, (value, index, arr) => {
59
69
  expect(arr).toBe(numbers);
60
70
 
@@ -66,6 +76,7 @@ describe('Arr search operations', () => {
66
76
 
67
77
  test('should return first match when multiple elements match', () => {
68
78
  const numbers = [2, 4, 6, 8];
79
+
69
80
  const firstEven = find(numbers, (n) => n % 2 === 0);
70
81
 
71
82
  expect(Optional.unwrap(firstEven)).toBe(2);
@@ -73,6 +84,7 @@ describe('Arr search operations', () => {
73
84
 
74
85
  test('should work with empty array', () => {
75
86
  const empty: readonly number[] = [];
87
+
76
88
  const result = find(empty, () => true);
77
89
 
78
90
  expect(Optional.isNone(result)).toBe(true);
@@ -82,14 +94,17 @@ describe('Arr search operations', () => {
82
94
  describe(findLast, () => {
83
95
  test('should find last element matching predicate', () => {
84
96
  const numbers = [1, 2, 3, 4, 5];
97
+
85
98
  const lastEven = findLast(numbers, (n) => n % 2 === 0);
86
99
 
87
100
  expect(Optional.isSome(lastEven)).toBe(true);
101
+
88
102
  expect(Optional.unwrap(lastEven)).toBe(4);
89
103
  });
90
104
 
91
105
  test('should return None when no element matches', () => {
92
106
  const odds = [1, 3, 5];
107
+
93
108
  const lastEven = findLast(odds, (n) => n % 2 === 0);
94
109
 
95
110
  expect(Optional.isNone(lastEven)).toBe(true);
@@ -97,15 +112,19 @@ describe('Arr search operations', () => {
97
112
 
98
113
  test('should work with curried version', () => {
99
114
  const isPositive = (n: number): boolean => n > 0;
115
+
100
116
  const findLastPositive = findLast(isPositive);
117
+
101
118
  const result = findLastPositive([-1, 2, -3, 4]);
102
119
 
103
120
  expect(Optional.isSome(result)).toBe(true);
121
+
104
122
  expect(Optional.unwrap(result)).toBe(4);
105
123
  });
106
124
 
107
125
  test('should work with empty array', () => {
108
126
  const empty: number[] = [];
127
+
109
128
  const result = findLast(empty, (n) => n > 0);
110
129
 
111
130
  expect(Optional.isNone(result)).toBe(true);
@@ -113,6 +132,7 @@ describe('Arr search operations', () => {
113
132
 
114
133
  test('should pass index and array to predicate', () => {
115
134
  const numbers = [10, 20, 30, 40];
135
+
116
136
  const lastWithIndex2 = findLast(numbers, (_, idx, arr) => {
117
137
  expect(arr).toBe(numbers);
118
138
 
@@ -124,6 +144,7 @@ describe('Arr search operations', () => {
124
144
 
125
145
  test('should find last occurrence', () => {
126
146
  const numbers = [1, 2, 2, 3, 2, 4];
147
+
127
148
  const lastTwo = findLast(numbers, (n) => n === 2);
128
149
 
129
150
  expect(Optional.unwrap(lastTwo)).toBe(2);
@@ -138,6 +159,7 @@ describe('Arr search operations', () => {
138
159
  describe(findIndex, () => {
139
160
  test('should find index of matching element', () => {
140
161
  const arr = ['a', 'b', 'c'];
162
+
141
163
  const result = findIndex(arr, (x) => x === 'b');
142
164
 
143
165
  expect(result).toBeGreaterThanOrEqual(0);
@@ -149,6 +171,7 @@ describe('Arr search operations', () => {
149
171
 
150
172
  test('should return None for no match', () => {
151
173
  const arr = ['a', 'b', 'c'];
174
+
152
175
  const result = findIndex(arr, (x) => x === 'd');
153
176
 
154
177
  expect(result).toBe(-1);
@@ -158,6 +181,7 @@ describe('Arr search operations', () => {
158
181
  describe(findLastIndex, () => {
159
182
  test('should find last index matching predicate', () => {
160
183
  const numbers = [1, 2, 3, 4, 2, 5];
184
+
161
185
  const lastTwoIndex = findLastIndex(numbers, (n) => n === 2);
162
186
 
163
187
  expect(lastTwoIndex).toBe(4);
@@ -165,6 +189,7 @@ describe('Arr search operations', () => {
165
189
 
166
190
  test('should return -1 when no element matches', () => {
167
191
  const odds = [1, 3, 5];
192
+
168
193
  const lastEvenIndex = findLastIndex(odds, (n) => n % 2 === 0);
169
194
 
170
195
  expect(lastEvenIndex).toBe(-1);
@@ -172,7 +197,9 @@ describe('Arr search operations', () => {
172
197
 
173
198
  test('should work with curried version', () => {
174
199
  const isPositive = (n: number): boolean => n > 0;
200
+
175
201
  const findLastPositiveIndex = findLastIndex(isPositive);
202
+
176
203
  const result = findLastPositiveIndex([-1, 2, -3, 4, -5]);
177
204
 
178
205
  expect(result).toBe(3); // index of last positive number (4)
@@ -180,6 +207,7 @@ describe('Arr search operations', () => {
180
207
 
181
208
  test('should work with empty array', () => {
182
209
  const empty: number[] = [];
210
+
183
211
  const result = findLastIndex(empty, (n) => n > 0);
184
212
 
185
213
  expect(result).toBe(-1);
@@ -187,6 +215,7 @@ describe('Arr search operations', () => {
187
215
 
188
216
  test('should pass index and array to predicate', () => {
189
217
  const numbers = [10, 20, 30, 40];
218
+
190
219
  const lastWithIndex2OrHigher = findLastIndex(numbers, (_, idx, arr) => {
191
220
  expect(arr).toBe(numbers);
192
221
 
@@ -204,6 +233,7 @@ describe('Arr search operations', () => {
204
233
  { id: 4, active: false },
205
234
  { id: 5, active: true },
206
235
  ];
236
+
207
237
  const lastActiveIndex = findLastIndex(data, (item) => item.active);
208
238
 
209
239
  expect(lastActiveIndex).toBe(4); // last active item
@@ -211,6 +241,7 @@ describe('Arr search operations', () => {
211
241
 
212
242
  test('should work with tuples', () => {
213
243
  const tuple = [10, 20, 30, 20, 40] as const;
244
+
214
245
  const lastTwentyIndex = findLastIndex(tuple, (x) => x === 20);
215
246
 
216
247
  expect(lastTwentyIndex).toBe(3); // last occurrence of 20
@@ -219,10 +250,12 @@ describe('Arr search operations', () => {
219
250
  test('should search from end to beginning', () => {
220
251
  // Verify search order by using side effects
221
252
  const numbers = [1, 2, 3, 4, 5];
253
+
222
254
  const mut_searchOrder: number[] = [];
223
255
 
224
256
  findLastIndex(numbers, (val, idx) => {
225
257
  mut_searchOrder.push(idx);
258
+
226
259
  return val === 3;
227
260
  });
228
261
 
@@ -232,15 +265,19 @@ describe('Arr search operations', () => {
232
265
 
233
266
  test('should handle single element array', () => {
234
267
  const single = [42];
268
+
235
269
  const foundIndex = findLastIndex(single, (n) => n === 42);
270
+
236
271
  const notFoundIndex = findLastIndex(single, (n) => n === 0);
237
272
 
238
273
  expect(foundIndex).toBe(0);
274
+
239
275
  expect(notFoundIndex).toBe(-1);
240
276
  });
241
277
 
242
278
  test('should work with string arrays', () => {
243
279
  const words = ['hello', 'world', 'test', 'hello', 'end'];
280
+
244
281
  const lastHelloIndex = findLastIndex(words, (word) => word === 'hello');
245
282
 
246
283
  expect(lastHelloIndex).toBe(3);
@@ -250,6 +287,7 @@ describe('Arr search operations', () => {
250
287
  describe(indexOf, () => {
251
288
  test('should find index of element', () => {
252
289
  const arr = ['a', 'b', 'c', 'b'];
290
+
253
291
  const result = indexOf(arr, 'b');
254
292
 
255
293
  expect(result).toBeGreaterThanOrEqual(0);
@@ -263,6 +301,7 @@ describe('Arr search operations', () => {
263
301
 
264
302
  test('should return -1 for non-existent element', () => {
265
303
  const arr = ['a', 'b', 'c'];
304
+
266
305
  const result = indexOf(arr, 'd');
267
306
 
268
307
  expect(result).toBe(-1);
@@ -272,6 +311,7 @@ describe('Arr search operations', () => {
272
311
  describe(indexOfFrom, () => {
273
312
  test('should find index of element from specified index', () => {
274
313
  const arr = ['a', 'b', 'c', 'b'];
314
+
275
315
  const result = indexOfFrom(arr, 'b', 2);
276
316
 
277
317
  expect(result).toBeGreaterThanOrEqual(0);
@@ -285,6 +325,7 @@ describe('Arr search operations', () => {
285
325
 
286
326
  test('should return -1 when element not found from index', () => {
287
327
  const arr = ['a', 'b', 'c', 'b'];
328
+
288
329
  const result = indexOfFrom(arr, 'a', 1);
289
330
 
290
331
  expect(result).toBe(-1);
@@ -292,6 +333,7 @@ describe('Arr search operations', () => {
292
333
 
293
334
  test('should find first occurrence when fromIndex is 0', () => {
294
335
  const arr = ['a', 'b', 'c', 'b'];
336
+
295
337
  const result = indexOfFrom(arr, 'b', 0);
296
338
 
297
339
  expect(result).toBe(1);
@@ -299,6 +341,7 @@ describe('Arr search operations', () => {
299
341
 
300
342
  test('should handle negative fromIndex', () => {
301
343
  const arr = ['a', 'b', 'c', 'b'];
344
+
302
345
  const result = indexOfFrom(arr, 'b', -2);
303
346
 
304
347
  expect(result).toBe(3);
@@ -306,6 +349,7 @@ describe('Arr search operations', () => {
306
349
 
307
350
  test('should handle fromIndex beyond array length', () => {
308
351
  const arr = ['a', 'b', 'c'];
352
+
309
353
  const result = indexOfFrom(arr, 'a', 10);
310
354
 
311
355
  expect(result).toBe(-1);
@@ -315,6 +359,7 @@ describe('Arr search operations', () => {
315
359
  describe(lastIndexOf, () => {
316
360
  test('should find last index of element', () => {
317
361
  const arr = ['a', 'b', 'c', 'b'];
362
+
318
363
  const result = lastIndexOf(arr, 'b');
319
364
 
320
365
  expect(result).toBeGreaterThanOrEqual(0);
@@ -328,6 +373,7 @@ describe('Arr search operations', () => {
328
373
 
329
374
  test('should return -1 for non-existent element', () => {
330
375
  const arr = ['a', 'b', 'c'];
376
+
331
377
  const result = lastIndexOf(arr, 'd');
332
378
 
333
379
  expect(result).toBe(-1);
@@ -337,6 +383,7 @@ describe('Arr search operations', () => {
337
383
  describe(lastIndexOfFrom, () => {
338
384
  test('should find last index of element from specified index', () => {
339
385
  const arr = ['a', 'b', 'c', 'b', 'e'];
386
+
340
387
  const result = lastIndexOfFrom(arr, 'b', 2);
341
388
 
342
389
  expect(result).toBeGreaterThanOrEqual(0);
@@ -350,6 +397,7 @@ describe('Arr search operations', () => {
350
397
 
351
398
  test('should return -1 when element not found before index', () => {
352
399
  const arr = ['a', 'b', 'c', 'b'];
400
+
353
401
  const result = lastIndexOfFrom(arr, 'b', 0);
354
402
 
355
403
  expect(result).toBe(-1);
@@ -357,6 +405,7 @@ describe('Arr search operations', () => {
357
405
 
358
406
  test('should find last occurrence when fromIndex covers all elements', () => {
359
407
  const arr = ['a', 'b', 'c', 'b'];
408
+
360
409
  const result = lastIndexOfFrom(arr, 'b', 10);
361
410
 
362
411
  expect(result).toBe(3);
@@ -364,6 +413,7 @@ describe('Arr search operations', () => {
364
413
 
365
414
  test('should handle negative fromIndex', () => {
366
415
  const arr = ['a', 'b', 'c', 'b'];
416
+
367
417
  const result = lastIndexOfFrom(arr, 'b', -1);
368
418
 
369
419
  expect(result).toBe(3);
@@ -371,6 +421,7 @@ describe('Arr search operations', () => {
371
421
 
372
422
  test('should handle fromIndex of 0', () => {
373
423
  const arr = ['a', 'b', 'c', 'b'];
424
+
374
425
  const result = lastIndexOfFrom(arr, 'a', 0);
375
426
 
376
427
  expect(result).toBe(0);
@@ -5,10 +5,13 @@
5
5
  *
6
6
  * ```ts
7
7
  * const numbers = [1, 2, 3] as const;
8
+ *
8
9
  * const sameNumbers = [1, 2, 3] as const;
10
+ *
9
11
  * const differentNumbers = [1, 2, 4] as const;
10
12
  *
11
13
  * assert.ok(Arr.eq(numbers, sameNumbers));
14
+ *
12
15
  * assert.notOk(Arr.eq(numbers, differentNumbers));
13
16
  * ```
14
17
  */
@@ -35,10 +38,13 @@ export const equal = eq;
35
38
  *
36
39
  * ```ts
37
40
  * const subset = [1, 2] as const;
41
+ *
38
42
  * const superset = [1, 2, 3] as const;
43
+ *
39
44
  * const notSubset = [2, 4] as const;
40
45
  *
41
46
  * assert.ok(Arr.isSubset(subset, superset));
47
+ *
42
48
  * assert.notOk(Arr.isSubset(notSubset, superset));
43
49
  * ```
44
50
  */
@@ -58,11 +64,15 @@ export const isSubset = <E1 extends Primitive, E2 extends Primitive = E1>(
58
64
  *
59
65
  * ```ts
60
66
  * const potentialSuperset = ['a', 'b', 'c'] as const;
67
+ *
61
68
  * const subset = ['a', 'c'] as const;
69
+ *
62
70
  * const notSuperset = ['a', 'd'] as const;
63
71
  *
64
72
  * assert.ok(Arr.isSuperset(potentialSuperset, subset));
73
+ *
65
74
  * assert.notOk(Arr.isSuperset(subset, potentialSuperset));
75
+ *
66
76
  * assert.notOk(Arr.isSuperset(potentialSuperset, notSuperset));
67
77
  * ```
68
78
  */
@@ -78,6 +88,7 @@ export const isSuperset = <E1 extends Primitive, E2 extends Primitive = E1>(
78
88
  *
79
89
  * ```ts
80
90
  * const refs = ['Ada', 'Alan', 'Grace'] as const;
91
+ *
81
92
  * const attendees = ['Grace', 'Alan', 'Barbara'] as const;
82
93
  *
83
94
  * const both = Arr.setIntersection(refs, attendees);
@@ -102,6 +113,7 @@ export const setIntersection = <
102
113
  *
103
114
  * ```ts
104
115
  * const baseline = [1, 2, 3, 4] as const;
116
+ *
105
117
  * const removed = [2, 4] as const;
106
118
  *
107
119
  * const remaining = Arr.setDifference(baseline, removed);
@@ -121,6 +133,7 @@ export const setDifference = <E extends Primitive>(
121
133
  *
122
134
  * ```ts
123
135
  * const upcoming = [1, 3, 5, 7, 9] as const;
136
+ *
124
137
  * const completed = [3, 4, 7] as const;
125
138
  *
126
139
  * const remaining = Arr.sortedNumSetDifference(upcoming, completed);
@@ -135,27 +148,33 @@ export const sortedNumSetDifference = <E extends number>(
135
148
  sortedList2: readonly E[],
136
149
  ): readonly E[] => {
137
150
  const mut_result: E[] = [];
151
+
138
152
  let mut_it1 = 0; // iterator for sortedList1
153
+
139
154
  let mut_it2 = 0; // iterator for sortedList2
140
155
 
141
156
  while (mut_it1 < sortedList1.length && mut_it2 < sortedList2.length) {
142
157
  // Non-null assertions are safe due to loop condition
143
158
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
144
159
  const val1 = sortedList1[mut_it1]!;
160
+
145
161
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
146
162
  const val2 = sortedList2[mut_it2]!;
147
163
 
148
164
  if (val1 === val2) {
149
165
  mut_it1 += 1;
166
+
150
167
  mut_it2 += 1;
151
168
  } else if (val1 < val2) {
152
169
  mut_result.push(val1);
170
+
153
171
  mut_it1 += 1;
154
172
  } else {
155
173
  // val1 > val2
156
174
  mut_it2 += 1;
157
175
  }
158
176
  }
177
+
159
178
  // Add remaining elements from sortedList1
160
179
  for (; mut_it1 < sortedList1.length; mut_it1 += 1) {
161
180
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion