@daiso-tech/core 0.1.4 → 0.2.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 (351) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/_shared/utilities.js +19 -0
  3. package/dist/cjs/_shared/utilities.js.map +1 -0
  4. package/dist/cjs/collection/_shared.js +4 -2
  5. package/dist/cjs/collection/_shared.js.map +1 -1
  6. package/dist/cjs/collection/async-iterable-collection/_shared/_module.js +1 -1
  7. package/dist/cjs/collection/async-iterable-collection/_shared/_module.js.map +1 -1
  8. package/dist/cjs/collection/async-iterable-collection/_shared/async-chunk-iterable.js +8 -7
  9. package/dist/cjs/collection/async-iterable-collection/_shared/async-chunk-iterable.js.map +1 -1
  10. package/dist/cjs/collection/async-iterable-collection/_shared/{async-chunk-whilte-iterable.js → async-chunk-while-iterable.js} +14 -16
  11. package/dist/cjs/collection/async-iterable-collection/_shared/async-chunk-while-iterable.js.map +1 -0
  12. package/dist/cjs/collection/async-iterable-collection/_shared/async-collapse-iterable.js +1 -2
  13. package/dist/cjs/collection/async-iterable-collection/_shared/async-collapse-iterable.js.map +1 -1
  14. package/dist/cjs/collection/async-iterable-collection/_shared/async-count-by-iterable.js +3 -6
  15. package/dist/cjs/collection/async-iterable-collection/_shared/async-count-by-iterable.js.map +1 -1
  16. package/dist/cjs/collection/async-iterable-collection/_shared/async-cross-join-iterable.js +19 -18
  17. package/dist/cjs/collection/async-iterable-collection/_shared/async-cross-join-iterable.js.map +1 -1
  18. package/dist/cjs/collection/async-iterable-collection/_shared/async-entries-iterable.js +1 -8
  19. package/dist/cjs/collection/async-iterable-collection/_shared/async-entries-iterable.js.map +1 -1
  20. package/dist/cjs/collection/async-iterable-collection/_shared/async-filter-iterable.js +6 -9
  21. package/dist/cjs/collection/async-iterable-collection/_shared/async-filter-iterable.js.map +1 -1
  22. package/dist/cjs/collection/async-iterable-collection/_shared/async-flat-map-iterable.js +3 -6
  23. package/dist/cjs/collection/async-iterable-collection/_shared/async-flat-map-iterable.js.map +1 -1
  24. package/dist/cjs/collection/async-iterable-collection/_shared/async-group-by-iterable.js +12 -13
  25. package/dist/cjs/collection/async-iterable-collection/_shared/async-group-by-iterable.js.map +1 -1
  26. package/dist/cjs/collection/async-iterable-collection/_shared/async-insert-after-iterable.js +5 -12
  27. package/dist/cjs/collection/async-iterable-collection/_shared/async-insert-after-iterable.js.map +1 -1
  28. package/dist/cjs/collection/async-iterable-collection/_shared/async-insert-before-iterable.js +5 -12
  29. package/dist/cjs/collection/async-iterable-collection/_shared/async-insert-before-iterable.js.map +1 -1
  30. package/dist/cjs/collection/async-iterable-collection/_shared/async-map-iterable.js +3 -6
  31. package/dist/cjs/collection/async-iterable-collection/_shared/async-map-iterable.js.map +1 -1
  32. package/dist/cjs/collection/async-iterable-collection/_shared/async-merge-iterable.js +1 -2
  33. package/dist/cjs/collection/async-iterable-collection/_shared/async-merge-iterable.js.map +1 -1
  34. package/dist/cjs/collection/async-iterable-collection/_shared/async-pad-end-iterable.js +1 -4
  35. package/dist/cjs/collection/async-iterable-collection/_shared/async-pad-end-iterable.js.map +1 -1
  36. package/dist/cjs/collection/async-iterable-collection/_shared/async-pad-start-iterable.js +1 -4
  37. package/dist/cjs/collection/async-iterable-collection/_shared/async-pad-start-iterable.js.map +1 -1
  38. package/dist/cjs/collection/async-iterable-collection/_shared/async-partion-iterable.js +12 -19
  39. package/dist/cjs/collection/async-iterable-collection/_shared/async-partion-iterable.js.map +1 -1
  40. package/dist/cjs/collection/async-iterable-collection/_shared/async-repeat-iterable.js +2 -3
  41. package/dist/cjs/collection/async-iterable-collection/_shared/async-repeat-iterable.js.map +1 -1
  42. package/dist/cjs/collection/async-iterable-collection/_shared/async-reverse-iterable.js +3 -10
  43. package/dist/cjs/collection/async-iterable-collection/_shared/async-reverse-iterable.js.map +1 -1
  44. package/dist/cjs/collection/async-iterable-collection/_shared/async-shuffle-iterable.js +4 -2
  45. package/dist/cjs/collection/async-iterable-collection/_shared/async-shuffle-iterable.js.map +1 -1
  46. package/dist/cjs/collection/async-iterable-collection/_shared/async-skip-iterable.js +4 -9
  47. package/dist/cjs/collection/async-iterable-collection/_shared/async-skip-iterable.js.map +1 -1
  48. package/dist/cjs/collection/async-iterable-collection/_shared/async-skip-until-iterable.js +5 -12
  49. package/dist/cjs/collection/async-iterable-collection/_shared/async-skip-until-iterable.js.map +1 -1
  50. package/dist/cjs/collection/async-iterable-collection/_shared/async-slice-iterable.js +2 -4
  51. package/dist/cjs/collection/async-iterable-collection/_shared/async-slice-iterable.js.map +1 -1
  52. package/dist/cjs/collection/async-iterable-collection/_shared/async-sliding-iterable.js +4 -11
  53. package/dist/cjs/collection/async-iterable-collection/_shared/async-sliding-iterable.js.map +1 -1
  54. package/dist/cjs/collection/async-iterable-collection/_shared/async-split-iterable.js +7 -9
  55. package/dist/cjs/collection/async-iterable-collection/_shared/async-split-iterable.js.map +1 -1
  56. package/dist/cjs/collection/async-iterable-collection/_shared/async-take-iterable.js +4 -9
  57. package/dist/cjs/collection/async-iterable-collection/_shared/async-take-iterable.js.map +1 -1
  58. package/dist/cjs/collection/async-iterable-collection/_shared/async-take-until-iterable.js +6 -9
  59. package/dist/cjs/collection/async-iterable-collection/_shared/async-take-until-iterable.js.map +1 -1
  60. package/dist/cjs/collection/async-iterable-collection/_shared/async-tap-iterable.js +1 -2
  61. package/dist/cjs/collection/async-iterable-collection/_shared/async-tap-iterable.js.map +1 -1
  62. package/dist/cjs/collection/async-iterable-collection/_shared/async-unique-iterable.js +2 -5
  63. package/dist/cjs/collection/async-iterable-collection/_shared/async-unique-iterable.js.map +1 -1
  64. package/dist/cjs/collection/async-iterable-collection/_shared/async-update-iterable.js +6 -9
  65. package/dist/cjs/collection/async-iterable-collection/_shared/async-update-iterable.js.map +1 -1
  66. package/dist/cjs/collection/async-iterable-collection/_shared/async-when-iterable.js +1 -2
  67. package/dist/cjs/collection/async-iterable-collection/_shared/async-when-iterable.js.map +1 -1
  68. package/dist/cjs/collection/async-iterable-collection/_shared/async-zip-iterable.js.map +1 -1
  69. package/dist/cjs/collection/async-iterable-collection/async-iterable-collection.js +173 -228
  70. package/dist/cjs/collection/async-iterable-collection/async-iterable-collection.js.map +1 -1
  71. package/dist/cjs/collection/iterable-collection/_shared/_module.js +1 -1
  72. package/dist/cjs/collection/iterable-collection/_shared/_module.js.map +1 -1
  73. package/dist/cjs/collection/iterable-collection/_shared/chunk-iterable.js +8 -7
  74. package/dist/cjs/collection/iterable-collection/_shared/chunk-iterable.js.map +1 -1
  75. package/dist/cjs/collection/iterable-collection/_shared/{chunk-whilte-iterable.js → chunk-while-iterable.js} +12 -14
  76. package/dist/cjs/collection/iterable-collection/_shared/chunk-while-iterable.js.map +1 -0
  77. package/dist/cjs/collection/iterable-collection/_shared/collapse-iterable.js +1 -2
  78. package/dist/cjs/collection/iterable-collection/_shared/collapse-iterable.js.map +1 -1
  79. package/dist/cjs/collection/iterable-collection/_shared/count-by-iterable.js +3 -6
  80. package/dist/cjs/collection/iterable-collection/_shared/count-by-iterable.js.map +1 -1
  81. package/dist/cjs/collection/iterable-collection/_shared/cross-join-iterable.js +26 -20
  82. package/dist/cjs/collection/iterable-collection/_shared/cross-join-iterable.js.map +1 -1
  83. package/dist/cjs/collection/iterable-collection/_shared/entries-iterable.js +2 -9
  84. package/dist/cjs/collection/iterable-collection/_shared/entries-iterable.js.map +1 -1
  85. package/dist/cjs/collection/iterable-collection/_shared/filter-iterable.js +3 -6
  86. package/dist/cjs/collection/iterable-collection/_shared/filter-iterable.js.map +1 -1
  87. package/dist/cjs/collection/iterable-collection/_shared/flat-map-iterable.js +3 -6
  88. package/dist/cjs/collection/iterable-collection/_shared/flat-map-iterable.js.map +1 -1
  89. package/dist/cjs/collection/iterable-collection/_shared/group-by-iterable.js +10 -12
  90. package/dist/cjs/collection/iterable-collection/_shared/group-by-iterable.js.map +1 -1
  91. package/dist/cjs/collection/iterable-collection/_shared/insert-after-iterable.js +3 -6
  92. package/dist/cjs/collection/iterable-collection/_shared/insert-after-iterable.js.map +1 -1
  93. package/dist/cjs/collection/iterable-collection/_shared/insert-before-iterable.js +3 -6
  94. package/dist/cjs/collection/iterable-collection/_shared/insert-before-iterable.js.map +1 -1
  95. package/dist/cjs/collection/iterable-collection/_shared/map-iterable.js +3 -6
  96. package/dist/cjs/collection/iterable-collection/_shared/map-iterable.js.map +1 -1
  97. package/dist/cjs/collection/iterable-collection/_shared/merge-iterable.js +1 -2
  98. package/dist/cjs/collection/iterable-collection/_shared/merge-iterable.js.map +1 -1
  99. package/dist/cjs/collection/iterable-collection/_shared/pad-end-iterable.js +2 -6
  100. package/dist/cjs/collection/iterable-collection/_shared/pad-end-iterable.js.map +1 -1
  101. package/dist/cjs/collection/iterable-collection/_shared/pad-start-iterable.js +2 -6
  102. package/dist/cjs/collection/iterable-collection/_shared/pad-start-iterable.js.map +1 -1
  103. package/dist/cjs/collection/iterable-collection/_shared/partion-iterable.js +9 -11
  104. package/dist/cjs/collection/iterable-collection/_shared/partion-iterable.js.map +1 -1
  105. package/dist/cjs/collection/iterable-collection/_shared/repeat-iterable.js +2 -3
  106. package/dist/cjs/collection/iterable-collection/_shared/repeat-iterable.js.map +1 -1
  107. package/dist/cjs/collection/iterable-collection/_shared/reverse-iterable.js +4 -12
  108. package/dist/cjs/collection/iterable-collection/_shared/reverse-iterable.js.map +1 -1
  109. package/dist/cjs/collection/iterable-collection/_shared/shuffle-iterable.js +5 -4
  110. package/dist/cjs/collection/iterable-collection/_shared/shuffle-iterable.js.map +1 -1
  111. package/dist/cjs/collection/iterable-collection/_shared/skip-iterable.js +4 -9
  112. package/dist/cjs/collection/iterable-collection/_shared/skip-iterable.js.map +1 -1
  113. package/dist/cjs/collection/iterable-collection/_shared/skip-until-iterable.js +3 -6
  114. package/dist/cjs/collection/iterable-collection/_shared/skip-until-iterable.js.map +1 -1
  115. package/dist/cjs/collection/iterable-collection/_shared/slice-iterable.js +3 -6
  116. package/dist/cjs/collection/iterable-collection/_shared/slice-iterable.js.map +1 -1
  117. package/dist/cjs/collection/iterable-collection/_shared/sliding-iterable.js +4 -11
  118. package/dist/cjs/collection/iterable-collection/_shared/sliding-iterable.js.map +1 -1
  119. package/dist/cjs/collection/iterable-collection/_shared/sort-iterable.js +1 -2
  120. package/dist/cjs/collection/iterable-collection/_shared/sort-iterable.js.map +1 -1
  121. package/dist/cjs/collection/iterable-collection/_shared/split-iterable.js +7 -9
  122. package/dist/cjs/collection/iterable-collection/_shared/split-iterable.js.map +1 -1
  123. package/dist/cjs/collection/iterable-collection/_shared/take-iterable.js +4 -9
  124. package/dist/cjs/collection/iterable-collection/_shared/take-iterable.js.map +1 -1
  125. package/dist/cjs/collection/iterable-collection/_shared/take-until-iterable.js +3 -6
  126. package/dist/cjs/collection/iterable-collection/_shared/take-until-iterable.js.map +1 -1
  127. package/dist/cjs/collection/iterable-collection/_shared/tap-iterable.js +1 -2
  128. package/dist/cjs/collection/iterable-collection/_shared/tap-iterable.js.map +1 -1
  129. package/dist/cjs/collection/iterable-collection/_shared/unique-iterable.js +3 -6
  130. package/dist/cjs/collection/iterable-collection/_shared/unique-iterable.js.map +1 -1
  131. package/dist/cjs/collection/iterable-collection/_shared/update-iterable.js +3 -6
  132. package/dist/cjs/collection/iterable-collection/_shared/update-iterable.js.map +1 -1
  133. package/dist/cjs/collection/iterable-collection/_shared/when-iterable.js +1 -2
  134. package/dist/cjs/collection/iterable-collection/_shared/when-iterable.js.map +1 -1
  135. package/dist/cjs/collection/iterable-collection/_shared/zip-iterable.js +1 -2
  136. package/dist/cjs/collection/iterable-collection/_shared/zip-iterable.js.map +1 -1
  137. package/dist/cjs/collection/iterable-collection/iterable-collection.js +161 -251
  138. package/dist/cjs/collection/iterable-collection/iterable-collection.js.map +1 -1
  139. package/dist/cjs/collection/list-collection/list-collection.js +213 -299
  140. package/dist/cjs/collection/list-collection/list-collection.js.map +1 -1
  141. package/dist/cjs/contracts/collection/_shared.js +17 -10
  142. package/dist/cjs/contracts/collection/_shared.js.map +1 -1
  143. package/dist/esm/_shared/utilities.js +15 -0
  144. package/dist/esm/_shared/utilities.js.map +1 -0
  145. package/dist/esm/collection/_shared.js +4 -2
  146. package/dist/esm/collection/_shared.js.map +1 -1
  147. package/dist/esm/collection/async-iterable-collection/_shared/_module.js +1 -1
  148. package/dist/esm/collection/async-iterable-collection/_shared/_module.js.map +1 -1
  149. package/dist/esm/collection/async-iterable-collection/_shared/async-chunk-iterable.js +8 -7
  150. package/dist/esm/collection/async-iterable-collection/_shared/async-chunk-iterable.js.map +1 -1
  151. package/dist/esm/collection/async-iterable-collection/_shared/async-chunk-while-iterable.js +37 -0
  152. package/dist/esm/collection/async-iterable-collection/_shared/async-chunk-while-iterable.js.map +1 -0
  153. package/dist/esm/collection/async-iterable-collection/_shared/async-collapse-iterable.js +1 -2
  154. package/dist/esm/collection/async-iterable-collection/_shared/async-collapse-iterable.js.map +1 -1
  155. package/dist/esm/collection/async-iterable-collection/_shared/async-count-by-iterable.js +3 -6
  156. package/dist/esm/collection/async-iterable-collection/_shared/async-count-by-iterable.js.map +1 -1
  157. package/dist/esm/collection/async-iterable-collection/_shared/async-cross-join-iterable.js +19 -18
  158. package/dist/esm/collection/async-iterable-collection/_shared/async-cross-join-iterable.js.map +1 -1
  159. package/dist/esm/collection/async-iterable-collection/_shared/async-entries-iterable.js +1 -8
  160. package/dist/esm/collection/async-iterable-collection/_shared/async-entries-iterable.js.map +1 -1
  161. package/dist/esm/collection/async-iterable-collection/_shared/async-filter-iterable.js +6 -9
  162. package/dist/esm/collection/async-iterable-collection/_shared/async-filter-iterable.js.map +1 -1
  163. package/dist/esm/collection/async-iterable-collection/_shared/async-flat-map-iterable.js +3 -6
  164. package/dist/esm/collection/async-iterable-collection/_shared/async-flat-map-iterable.js.map +1 -1
  165. package/dist/esm/collection/async-iterable-collection/_shared/async-group-by-iterable.js +12 -13
  166. package/dist/esm/collection/async-iterable-collection/_shared/async-group-by-iterable.js.map +1 -1
  167. package/dist/esm/collection/async-iterable-collection/_shared/async-insert-after-iterable.js +6 -13
  168. package/dist/esm/collection/async-iterable-collection/_shared/async-insert-after-iterable.js.map +1 -1
  169. package/dist/esm/collection/async-iterable-collection/_shared/async-insert-before-iterable.js +6 -13
  170. package/dist/esm/collection/async-iterable-collection/_shared/async-insert-before-iterable.js.map +1 -1
  171. package/dist/esm/collection/async-iterable-collection/_shared/async-map-iterable.js +3 -6
  172. package/dist/esm/collection/async-iterable-collection/_shared/async-map-iterable.js.map +1 -1
  173. package/dist/esm/collection/async-iterable-collection/_shared/async-merge-iterable.js +1 -2
  174. package/dist/esm/collection/async-iterable-collection/_shared/async-merge-iterable.js.map +1 -1
  175. package/dist/esm/collection/async-iterable-collection/_shared/async-pad-end-iterable.js +1 -4
  176. package/dist/esm/collection/async-iterable-collection/_shared/async-pad-end-iterable.js.map +1 -1
  177. package/dist/esm/collection/async-iterable-collection/_shared/async-pad-start-iterable.js +1 -4
  178. package/dist/esm/collection/async-iterable-collection/_shared/async-pad-start-iterable.js.map +1 -1
  179. package/dist/esm/collection/async-iterable-collection/_shared/async-partion-iterable.js +13 -20
  180. package/dist/esm/collection/async-iterable-collection/_shared/async-partion-iterable.js.map +1 -1
  181. package/dist/esm/collection/async-iterable-collection/_shared/async-repeat-iterable.js +2 -3
  182. package/dist/esm/collection/async-iterable-collection/_shared/async-repeat-iterable.js.map +1 -1
  183. package/dist/esm/collection/async-iterable-collection/_shared/async-reverse-iterable.js +3 -10
  184. package/dist/esm/collection/async-iterable-collection/_shared/async-reverse-iterable.js.map +1 -1
  185. package/dist/esm/collection/async-iterable-collection/_shared/async-shuffle-iterable.js +4 -2
  186. package/dist/esm/collection/async-iterable-collection/_shared/async-shuffle-iterable.js.map +1 -1
  187. package/dist/esm/collection/async-iterable-collection/_shared/async-skip-iterable.js +4 -9
  188. package/dist/esm/collection/async-iterable-collection/_shared/async-skip-iterable.js.map +1 -1
  189. package/dist/esm/collection/async-iterable-collection/_shared/async-skip-until-iterable.js +6 -13
  190. package/dist/esm/collection/async-iterable-collection/_shared/async-skip-until-iterable.js.map +1 -1
  191. package/dist/esm/collection/async-iterable-collection/_shared/async-slice-iterable.js +2 -4
  192. package/dist/esm/collection/async-iterable-collection/_shared/async-slice-iterable.js.map +1 -1
  193. package/dist/esm/collection/async-iterable-collection/_shared/async-sliding-iterable.js +4 -11
  194. package/dist/esm/collection/async-iterable-collection/_shared/async-sliding-iterable.js.map +1 -1
  195. package/dist/esm/collection/async-iterable-collection/_shared/async-split-iterable.js +7 -9
  196. package/dist/esm/collection/async-iterable-collection/_shared/async-split-iterable.js.map +1 -1
  197. package/dist/esm/collection/async-iterable-collection/_shared/async-take-iterable.js +4 -9
  198. package/dist/esm/collection/async-iterable-collection/_shared/async-take-iterable.js.map +1 -1
  199. package/dist/esm/collection/async-iterable-collection/_shared/async-take-until-iterable.js +6 -9
  200. package/dist/esm/collection/async-iterable-collection/_shared/async-take-until-iterable.js.map +1 -1
  201. package/dist/esm/collection/async-iterable-collection/_shared/async-tap-iterable.js +1 -2
  202. package/dist/esm/collection/async-iterable-collection/_shared/async-tap-iterable.js.map +1 -1
  203. package/dist/esm/collection/async-iterable-collection/_shared/async-unique-iterable.js +2 -5
  204. package/dist/esm/collection/async-iterable-collection/_shared/async-unique-iterable.js.map +1 -1
  205. package/dist/esm/collection/async-iterable-collection/_shared/async-update-iterable.js +6 -9
  206. package/dist/esm/collection/async-iterable-collection/_shared/async-update-iterable.js.map +1 -1
  207. package/dist/esm/collection/async-iterable-collection/_shared/async-when-iterable.js +1 -2
  208. package/dist/esm/collection/async-iterable-collection/_shared/async-when-iterable.js.map +1 -1
  209. package/dist/esm/collection/async-iterable-collection/_shared/async-zip-iterable.js.map +1 -1
  210. package/dist/esm/collection/async-iterable-collection/async-iterable-collection.js +174 -229
  211. package/dist/esm/collection/async-iterable-collection/async-iterable-collection.js.map +1 -1
  212. package/dist/esm/collection/iterable-collection/_shared/_module.js +1 -1
  213. package/dist/esm/collection/iterable-collection/_shared/_module.js.map +1 -1
  214. package/dist/esm/collection/iterable-collection/_shared/chunk-iterable.js +8 -7
  215. package/dist/esm/collection/iterable-collection/_shared/chunk-iterable.js.map +1 -1
  216. package/dist/esm/collection/iterable-collection/_shared/{chunk-whilte-iterable.js → chunk-while-iterable.js} +12 -14
  217. package/dist/esm/collection/iterable-collection/_shared/chunk-while-iterable.js.map +1 -0
  218. package/dist/esm/collection/iterable-collection/_shared/collapse-iterable.js +1 -2
  219. package/dist/esm/collection/iterable-collection/_shared/collapse-iterable.js.map +1 -1
  220. package/dist/esm/collection/iterable-collection/_shared/count-by-iterable.js +3 -6
  221. package/dist/esm/collection/iterable-collection/_shared/count-by-iterable.js.map +1 -1
  222. package/dist/esm/collection/iterable-collection/_shared/cross-join-iterable.js +24 -18
  223. package/dist/esm/collection/iterable-collection/_shared/cross-join-iterable.js.map +1 -1
  224. package/dist/esm/collection/iterable-collection/_shared/entries-iterable.js +3 -10
  225. package/dist/esm/collection/iterable-collection/_shared/entries-iterable.js.map +1 -1
  226. package/dist/esm/collection/iterable-collection/_shared/filter-iterable.js +3 -6
  227. package/dist/esm/collection/iterable-collection/_shared/filter-iterable.js.map +1 -1
  228. package/dist/esm/collection/iterable-collection/_shared/flat-map-iterable.js +3 -6
  229. package/dist/esm/collection/iterable-collection/_shared/flat-map-iterable.js.map +1 -1
  230. package/dist/esm/collection/iterable-collection/_shared/group-by-iterable.js +10 -12
  231. package/dist/esm/collection/iterable-collection/_shared/group-by-iterable.js.map +1 -1
  232. package/dist/esm/collection/iterable-collection/_shared/insert-after-iterable.js +3 -6
  233. package/dist/esm/collection/iterable-collection/_shared/insert-after-iterable.js.map +1 -1
  234. package/dist/esm/collection/iterable-collection/_shared/insert-before-iterable.js +3 -6
  235. package/dist/esm/collection/iterable-collection/_shared/insert-before-iterable.js.map +1 -1
  236. package/dist/esm/collection/iterable-collection/_shared/map-iterable.js +3 -6
  237. package/dist/esm/collection/iterable-collection/_shared/map-iterable.js.map +1 -1
  238. package/dist/esm/collection/iterable-collection/_shared/merge-iterable.js +1 -2
  239. package/dist/esm/collection/iterable-collection/_shared/merge-iterable.js.map +1 -1
  240. package/dist/esm/collection/iterable-collection/_shared/pad-end-iterable.js +2 -6
  241. package/dist/esm/collection/iterable-collection/_shared/pad-end-iterable.js.map +1 -1
  242. package/dist/esm/collection/iterable-collection/_shared/pad-start-iterable.js +2 -6
  243. package/dist/esm/collection/iterable-collection/_shared/pad-start-iterable.js.map +1 -1
  244. package/dist/esm/collection/iterable-collection/_shared/partion-iterable.js +9 -11
  245. package/dist/esm/collection/iterable-collection/_shared/partion-iterable.js.map +1 -1
  246. package/dist/esm/collection/iterable-collection/_shared/repeat-iterable.js +2 -3
  247. package/dist/esm/collection/iterable-collection/_shared/repeat-iterable.js.map +1 -1
  248. package/dist/esm/collection/iterable-collection/_shared/reverse-iterable.js +4 -12
  249. package/dist/esm/collection/iterable-collection/_shared/reverse-iterable.js.map +1 -1
  250. package/dist/esm/collection/iterable-collection/_shared/shuffle-iterable.js +5 -4
  251. package/dist/esm/collection/iterable-collection/_shared/shuffle-iterable.js.map +1 -1
  252. package/dist/esm/collection/iterable-collection/_shared/skip-iterable.js +4 -9
  253. package/dist/esm/collection/iterable-collection/_shared/skip-iterable.js.map +1 -1
  254. package/dist/esm/collection/iterable-collection/_shared/skip-until-iterable.js +3 -6
  255. package/dist/esm/collection/iterable-collection/_shared/skip-until-iterable.js.map +1 -1
  256. package/dist/esm/collection/iterable-collection/_shared/slice-iterable.js +3 -6
  257. package/dist/esm/collection/iterable-collection/_shared/slice-iterable.js.map +1 -1
  258. package/dist/esm/collection/iterable-collection/_shared/sliding-iterable.js +4 -11
  259. package/dist/esm/collection/iterable-collection/_shared/sliding-iterable.js.map +1 -1
  260. package/dist/esm/collection/iterable-collection/_shared/sort-iterable.js +1 -2
  261. package/dist/esm/collection/iterable-collection/_shared/sort-iterable.js.map +1 -1
  262. package/dist/esm/collection/iterable-collection/_shared/split-iterable.js +7 -9
  263. package/dist/esm/collection/iterable-collection/_shared/split-iterable.js.map +1 -1
  264. package/dist/esm/collection/iterable-collection/_shared/take-iterable.js +4 -9
  265. package/dist/esm/collection/iterable-collection/_shared/take-iterable.js.map +1 -1
  266. package/dist/esm/collection/iterable-collection/_shared/take-until-iterable.js +3 -6
  267. package/dist/esm/collection/iterable-collection/_shared/take-until-iterable.js.map +1 -1
  268. package/dist/esm/collection/iterable-collection/_shared/tap-iterable.js +1 -2
  269. package/dist/esm/collection/iterable-collection/_shared/tap-iterable.js.map +1 -1
  270. package/dist/esm/collection/iterable-collection/_shared/unique-iterable.js +3 -6
  271. package/dist/esm/collection/iterable-collection/_shared/unique-iterable.js.map +1 -1
  272. package/dist/esm/collection/iterable-collection/_shared/update-iterable.js +3 -6
  273. package/dist/esm/collection/iterable-collection/_shared/update-iterable.js.map +1 -1
  274. package/dist/esm/collection/iterable-collection/_shared/when-iterable.js +1 -2
  275. package/dist/esm/collection/iterable-collection/_shared/when-iterable.js.map +1 -1
  276. package/dist/esm/collection/iterable-collection/_shared/zip-iterable.js +1 -2
  277. package/dist/esm/collection/iterable-collection/_shared/zip-iterable.js.map +1 -1
  278. package/dist/esm/collection/iterable-collection/iterable-collection.js +162 -252
  279. package/dist/esm/collection/iterable-collection/iterable-collection.js.map +1 -1
  280. package/dist/esm/collection/list-collection/list-collection.js +214 -300
  281. package/dist/esm/collection/list-collection/list-collection.js.map +1 -1
  282. package/dist/esm/contracts/collection/_shared.js +12 -6
  283. package/dist/esm/contracts/collection/_shared.js.map +1 -1
  284. package/dist/types/_shared/types.d.ts +5 -0
  285. package/dist/types/_shared/utilities.d.ts +3 -0
  286. package/dist/types/collection/async-iterable-collection/_shared/_module.d.ts +1 -1
  287. package/dist/types/collection/async-iterable-collection/_shared/async-chunk-iterable.d.ts +2 -1
  288. package/dist/types/collection/async-iterable-collection/_shared/async-chunk-while-iterable.d.ts +12 -0
  289. package/dist/types/collection/async-iterable-collection/_shared/async-count-by-iterable.d.ts +3 -3
  290. package/dist/types/collection/async-iterable-collection/_shared/async-cross-join-iterable.d.ts +6 -5
  291. package/dist/types/collection/async-iterable-collection/_shared/async-entries-iterable.d.ts +3 -4
  292. package/dist/types/collection/async-iterable-collection/_shared/async-filter-iterable.d.ts +2 -3
  293. package/dist/types/collection/async-iterable-collection/_shared/async-flat-map-iterable.d.ts +1 -2
  294. package/dist/types/collection/async-iterable-collection/_shared/async-group-by-iterable.d.ts +4 -4
  295. package/dist/types/collection/async-iterable-collection/_shared/async-insert-after-iterable.d.ts +4 -4
  296. package/dist/types/collection/async-iterable-collection/_shared/async-insert-before-iterable.d.ts +4 -4
  297. package/dist/types/collection/async-iterable-collection/_shared/async-map-iterable.d.ts +1 -2
  298. package/dist/types/collection/async-iterable-collection/_shared/async-merge-iterable.d.ts +1 -1
  299. package/dist/types/collection/async-iterable-collection/_shared/async-pad-end-iterable.d.ts +2 -1
  300. package/dist/types/collection/async-iterable-collection/_shared/async-pad-start-iterable.d.ts +2 -1
  301. package/dist/types/collection/async-iterable-collection/_shared/async-partion-iterable.d.ts +4 -4
  302. package/dist/types/collection/async-iterable-collection/_shared/async-repeat-iterable.d.ts +2 -1
  303. package/dist/types/collection/async-iterable-collection/_shared/async-reverse-iterable.d.ts +3 -3
  304. package/dist/types/collection/async-iterable-collection/_shared/async-shuffle-iterable.d.ts +2 -1
  305. package/dist/types/collection/async-iterable-collection/_shared/async-skip-iterable.d.ts +1 -2
  306. package/dist/types/collection/async-iterable-collection/_shared/async-skip-until-iterable.d.ts +2 -3
  307. package/dist/types/collection/async-iterable-collection/_shared/async-slice-iterable.d.ts +1 -2
  308. package/dist/types/collection/async-iterable-collection/_shared/async-sliding-iterable.d.ts +1 -2
  309. package/dist/types/collection/async-iterable-collection/_shared/async-split-iterable.d.ts +3 -3
  310. package/dist/types/collection/async-iterable-collection/_shared/async-take-iterable.d.ts +1 -2
  311. package/dist/types/collection/async-iterable-collection/_shared/async-take-until-iterable.d.ts +2 -3
  312. package/dist/types/collection/async-iterable-collection/_shared/async-unique-iterable.d.ts +1 -2
  313. package/dist/types/collection/async-iterable-collection/_shared/async-update-iterable.d.ts +5 -6
  314. package/dist/types/collection/async-iterable-collection/_shared/async-zip-iterable.d.ts +2 -1
  315. package/dist/types/collection/async-iterable-collection/async-iterable-collection.d.ts +56 -54
  316. package/dist/types/collection/iterable-collection/_shared/_module.d.ts +1 -1
  317. package/dist/types/collection/iterable-collection/_shared/{chunk-whilte-iterable.d.ts → chunk-while-iterable.d.ts} +1 -2
  318. package/dist/types/collection/iterable-collection/_shared/count-by-iterable.d.ts +3 -3
  319. package/dist/types/collection/iterable-collection/_shared/cross-join-iterable.d.ts +5 -8
  320. package/dist/types/collection/iterable-collection/_shared/entries-iterable.d.ts +2 -3
  321. package/dist/types/collection/iterable-collection/_shared/filter-iterable.d.ts +1 -2
  322. package/dist/types/collection/iterable-collection/_shared/flat-map-iterable.d.ts +1 -2
  323. package/dist/types/collection/iterable-collection/_shared/group-by-iterable.d.ts +3 -3
  324. package/dist/types/collection/iterable-collection/_shared/insert-after-iterable.d.ts +1 -2
  325. package/dist/types/collection/iterable-collection/_shared/insert-before-iterable.d.ts +1 -2
  326. package/dist/types/collection/iterable-collection/_shared/map-iterable.d.ts +1 -2
  327. package/dist/types/collection/iterable-collection/_shared/partion-iterable.d.ts +1 -2
  328. package/dist/types/collection/iterable-collection/_shared/reverse-iterable.d.ts +1 -2
  329. package/dist/types/collection/iterable-collection/_shared/shuffle-iterable.d.ts +2 -1
  330. package/dist/types/collection/iterable-collection/_shared/skip-iterable.d.ts +1 -2
  331. package/dist/types/collection/iterable-collection/_shared/skip-until-iterable.d.ts +1 -2
  332. package/dist/types/collection/iterable-collection/_shared/slice-iterable.d.ts +1 -2
  333. package/dist/types/collection/iterable-collection/_shared/sliding-iterable.d.ts +1 -2
  334. package/dist/types/collection/iterable-collection/_shared/split-iterable.d.ts +1 -2
  335. package/dist/types/collection/iterable-collection/_shared/take-iterable.d.ts +1 -2
  336. package/dist/types/collection/iterable-collection/_shared/take-until-iterable.d.ts +1 -2
  337. package/dist/types/collection/iterable-collection/_shared/unique-iterable.d.ts +1 -2
  338. package/dist/types/collection/iterable-collection/_shared/update-iterable.d.ts +4 -5
  339. package/dist/types/collection/iterable-collection/_shared/zip-iterable.d.ts +1 -1
  340. package/dist/types/collection/iterable-collection/iterable-collection.d.ts +56 -54
  341. package/dist/types/collection/list-collection/list-collection.d.ts +57 -54
  342. package/dist/types/contracts/collection/_shared.d.ts +14 -158
  343. package/dist/types/contracts/collection/async-collection.contract.d.ts +430 -284
  344. package/dist/types/contracts/collection/collection.contract.d.ts +417 -260
  345. package/package.json +2 -1
  346. package/dist/cjs/collection/async-iterable-collection/_shared/async-chunk-whilte-iterable.js.map +0 -1
  347. package/dist/cjs/collection/iterable-collection/_shared/chunk-whilte-iterable.js.map +0 -1
  348. package/dist/esm/collection/async-iterable-collection/_shared/async-chunk-whilte-iterable.js +0 -39
  349. package/dist/esm/collection/async-iterable-collection/_shared/async-chunk-whilte-iterable.js.map +0 -1
  350. package/dist/esm/collection/iterable-collection/_shared/chunk-whilte-iterable.js.map +0 -1
  351. package/dist/types/collection/async-iterable-collection/_shared/async-chunk-whilte-iterable.d.ts +0 -12
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AsyncIterableCollection = void 0;
4
4
  const _module_1 = require("../../contracts/collection/_module");
5
5
  const _module_2 = require("../../collection/async-iterable-collection/_shared/_module");
6
+ const utilities_1 = require("../../_shared/utilities");
6
7
  class AsyncIterableCollection {
7
8
  iterable;
8
- static THROW_ON_NUMBER_LIMIT = false;
9
9
  static DEFAULT_CHUNK_SIZE = 1024;
10
10
  static makeCollection = (iterable) => {
11
11
  return new AsyncIterableCollection(iterable);
@@ -19,92 +19,91 @@ class AsyncIterableCollection {
19
19
  toIterator() {
20
20
  return this[Symbol.asyncIterator]();
21
21
  }
22
- entries(throwOnIndexOverflow = AsyncIterableCollection.THROW_ON_NUMBER_LIMIT) {
23
- return new AsyncIterableCollection(new _module_2.AsyncEntriesIterable(this, throwOnIndexOverflow));
22
+ entries() {
23
+ return new AsyncIterableCollection(new _module_2.AsyncEntriesIterable(this));
24
24
  }
25
- keys(throwOnIndexOverflow = AsyncIterableCollection.THROW_ON_NUMBER_LIMIT) {
26
- return this.entries(throwOnIndexOverflow).map(([key]) => key);
25
+ keys() {
26
+ return this.entries().map(([key]) => key);
27
27
  }
28
28
  values() {
29
29
  return this.entries().map(([_key, value]) => value);
30
30
  }
31
- filter(filter, throwOnIndexOverflow = AsyncIterableCollection.THROW_ON_NUMBER_LIMIT) {
32
- return new AsyncIterableCollection(new _module_2.AsyncFilterIterable(this, filter, throwOnIndexOverflow));
31
+ filter(predicateFn) {
32
+ return new AsyncIterableCollection(new _module_2.AsyncFilterIterable(this, predicateFn));
33
33
  }
34
- reject(filter, throwOnIndexOverflow = AsyncIterableCollection.THROW_ON_NUMBER_LIMIT) {
35
- return this.filter(async (...arguments_) => !(await filter(...arguments_)), throwOnIndexOverflow);
34
+ reject(predicateFn) {
35
+ return this.filter(async (...arguments_) => !(await predicateFn(...arguments_)));
36
36
  }
37
- map(mapFn, throwOnIndexOverflow = AsyncIterableCollection.THROW_ON_NUMBER_LIMIT) {
38
- return new AsyncIterableCollection(new _module_2.AsyncMapIterable(this, mapFn, throwOnIndexOverflow));
37
+ map(mapFn) {
38
+ return new AsyncIterableCollection(new _module_2.AsyncMapIterable(this, mapFn));
39
39
  }
40
- async reduce(settings) {
41
- const { reduceFn: reduce, initialValue, throwOnIndexOverflow, } = settings;
40
+ async reduce(reduceFn, initialValue) {
42
41
  if (initialValue === undefined && (await this.isEmpty())) {
43
- throw new TypeError("Reduce of empty array must be inputed a initial value");
42
+ throw new _module_1.TypeCollectionError("Reduce of empty array must be inputed a initial value");
44
43
  }
45
44
  if (initialValue !== undefined) {
46
45
  let output = initialValue;
47
46
  for await (const [index, item] of this.entries()) {
48
- output = await reduce(output, item, index, this);
47
+ output = await reduceFn(output, item, index, this);
49
48
  }
50
49
  return output;
51
50
  }
52
51
  let output = (await this.firstOrFail()), index = 0, isFirstIteration = true;
53
52
  for await (const item of this) {
54
53
  if (!isFirstIteration) {
55
- if (throwOnIndexOverflow && index === Number.MAX_SAFE_INTEGER) {
56
- throw new _module_1.IndexOverflowError("Index has overflowed");
57
- }
58
- output = await reduce(output, item, index, this);
54
+ output = await reduceFn(output, item, index, this);
59
55
  }
60
56
  isFirstIteration = false;
61
57
  index++;
62
58
  }
63
59
  return output;
64
60
  }
65
- async join(settings) {
66
- return this.reduce({
67
- reduceFn(str, item) {
68
- if (typeof item !== "string") {
69
- throw new TypeError("Item type is invalid must be string");
70
- }
71
- const separator = settings?.seperator ?? ",";
72
- return str + separator + item;
73
- },
74
- throwOnIndexOverflow: settings?.throwOnIndexOverflow ??
75
- AsyncIterableCollection.THROW_ON_NUMBER_LIMIT,
76
- });
61
+ async join(separator = ",") {
62
+ let str = null;
63
+ for await (const item of this) {
64
+ if (typeof item !== "string") {
65
+ throw new _module_1.TypeCollectionError("Item type is invalid must be string");
66
+ }
67
+ if (str === null) {
68
+ str = item;
69
+ }
70
+ else {
71
+ str = str + separator + item;
72
+ }
73
+ }
74
+ return str;
77
75
  }
78
76
  collapse() {
79
77
  return new AsyncIterableCollection(new _module_2.AsyncCollapseIterable(this));
80
78
  }
81
- flatMap(mapFn, throwOnIndexOverflow = AsyncIterableCollection.THROW_ON_NUMBER_LIMIT) {
82
- return new AsyncIterableCollection(new _module_2.AsyncFlatMapIterable(this, mapFn, throwOnIndexOverflow));
79
+ flatMap(mapFn) {
80
+ return new AsyncIterableCollection(new _module_2.AsyncFlatMapIterable(this, mapFn));
83
81
  }
84
- update(filter, mapFn, throwOnIndexOverflow = AsyncIterableCollection.THROW_ON_NUMBER_LIMIT) {
85
- return new AsyncIterableCollection(new _module_2.AsyncUpdateIterable(this, filter, mapFn, throwOnIndexOverflow));
82
+ change(predicateFn, mapFn) {
83
+ return new AsyncIterableCollection(new _module_2.AsyncUpdateIterable(this, predicateFn, mapFn));
86
84
  }
87
- page(settings) {
88
- const { page, pageSize, throwOnIndexOverflow } = settings;
85
+ page(page, pageSize) {
89
86
  if (page < 0) {
90
- return this.skip(page * pageSize, throwOnIndexOverflow).take(pageSize, throwOnIndexOverflow);
87
+ return this.skip(page * pageSize).take(pageSize);
91
88
  }
92
- return this.skip((page - 1) * pageSize, throwOnIndexOverflow).take(page * pageSize, throwOnIndexOverflow);
89
+ return this.skip((page - 1) * pageSize).take(pageSize);
93
90
  }
94
91
  async sum() {
95
92
  try {
93
+ if (await this.isEmpty()) {
94
+ throw new _module_1.EmptyCollectionError("Collection is empty therby operation cannot be performed");
95
+ }
96
96
  let sum = 0;
97
97
  for await (const item of this) {
98
98
  if (typeof item !== "number") {
99
- throw new TypeError("Item type is invalid must be number");
99
+ throw new _module_1.TypeCollectionError("Item type is invalid must be number");
100
100
  }
101
101
  sum += item;
102
102
  }
103
103
  return sum;
104
104
  }
105
105
  catch (error) {
106
- if (error instanceof _module_1.CollectionError ||
107
- error instanceof TypeError) {
106
+ if (error instanceof _module_1.CollectionError) {
108
107
  throw error;
109
108
  }
110
109
  throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
@@ -112,10 +111,13 @@ class AsyncIterableCollection {
112
111
  }
113
112
  async average() {
114
113
  try {
114
+ if (await this.isEmpty()) {
115
+ throw new _module_1.EmptyCollectionError("Collection is empty therby operation cannot be performed");
116
+ }
115
117
  let size = 0, sum = 0;
116
118
  for await (const item of this) {
117
119
  if (typeof item !== "number") {
118
- throw new TypeError("Item type is invalid must be number");
120
+ throw new _module_1.TypeCollectionError("Item type is invalid must be number");
119
121
  }
120
122
  size++;
121
123
  sum += item;
@@ -123,33 +125,32 @@ class AsyncIterableCollection {
123
125
  return (sum / size);
124
126
  }
125
127
  catch (error) {
126
- if (error instanceof _module_1.CollectionError ||
127
- error instanceof TypeError) {
128
+ if (error instanceof _module_1.CollectionError) {
128
129
  throw error;
129
130
  }
130
131
  throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
131
132
  }
132
133
  }
133
- async median(throwOnIndexOverflow) {
134
+ async median() {
134
135
  if (await this.isEmpty()) {
135
- return 0;
136
+ throw new _module_1.EmptyCollectionError("Collection is empty therby operation cannot be performed");
136
137
  }
137
- const size = await this.size(throwOnIndexOverflow);
138
+ const size = await this.size();
138
139
  if (size === 0) {
139
140
  return 0;
140
141
  }
141
142
  const isEven = size % 2 === 0, items = await this.map((item) => {
142
143
  if (typeof item !== "number") {
143
- throw new TypeError("Item type is invalid must be number");
144
+ throw new _module_1.TypeCollectionError("Item type is invalid must be number");
144
145
  }
145
146
  return item;
146
- }, throwOnIndexOverflow)
147
+ })
147
148
  .filter((_item, index) => {
148
149
  if (isEven) {
149
150
  return index === size / 2 || index === size / 2 - 1;
150
151
  }
151
152
  return index === Math.floor(size / 2);
152
- }, throwOnIndexOverflow)
153
+ })
153
154
  .toArray();
154
155
  if (isEven) {
155
156
  const [a, b] = items;
@@ -169,10 +170,13 @@ class AsyncIterableCollection {
169
170
  }
170
171
  async min() {
171
172
  try {
173
+ if (await this.isEmpty()) {
174
+ throw new _module_1.EmptyCollectionError("Collection is empty therby operation cannot be performed");
175
+ }
172
176
  let min = 0;
173
177
  for await (const item of this) {
174
178
  if (typeof item !== "number") {
175
- throw new TypeError("Item type is invalid must be number");
179
+ throw new _module_1.TypeCollectionError("Item type is invalid must be number");
176
180
  }
177
181
  if (min === 0) {
178
182
  min = item;
@@ -184,8 +188,7 @@ class AsyncIterableCollection {
184
188
  return min;
185
189
  }
186
190
  catch (error) {
187
- if (error instanceof _module_1.CollectionError ||
188
- error instanceof TypeError) {
191
+ if (error instanceof _module_1.CollectionError) {
189
192
  throw error;
190
193
  }
191
194
  throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
@@ -193,10 +196,13 @@ class AsyncIterableCollection {
193
196
  }
194
197
  async max() {
195
198
  try {
199
+ if (await this.isEmpty()) {
200
+ throw new _module_1.EmptyCollectionError("Collection is empty therby operation cannot be performed");
201
+ }
196
202
  let max = 0;
197
203
  for await (const item of this) {
198
204
  if (typeof item !== "number") {
199
- throw new TypeError("Item type is invalid must be number");
205
+ throw new _module_1.TypeCollectionError("Item type is invalid must be number");
200
206
  }
201
207
  if (max === 0) {
202
208
  max = item;
@@ -208,24 +214,20 @@ class AsyncIterableCollection {
208
214
  return max;
209
215
  }
210
216
  catch (error) {
211
- if (error instanceof _module_1.CollectionError ||
212
- error instanceof TypeError) {
217
+ if (error instanceof _module_1.CollectionError) {
213
218
  throw error;
214
219
  }
215
220
  throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
216
221
  }
217
222
  }
218
- async percentage(filter, throwOnIndexOverflow = AsyncIterableCollection.THROW_ON_NUMBER_LIMIT) {
223
+ async percentage(predicateFn) {
219
224
  try {
220
225
  if (await this.isEmpty()) {
221
- return 0;
226
+ throw new _module_1.EmptyCollectionError("Collection is empty therby operation cannot be performed");
222
227
  }
223
228
  let part = 0, total = 0;
224
229
  for await (const item of this) {
225
- if (throwOnIndexOverflow && total === Number.MAX_SAFE_INTEGER) {
226
- throw new _module_1.IndexOverflowError("The total amount has overflowed");
227
- }
228
- if (await filter(item, total, this)) {
230
+ if (await predicateFn(item, total, this)) {
229
231
  part++;
230
232
  }
231
233
  total++;
@@ -233,35 +235,33 @@ class AsyncIterableCollection {
233
235
  return (part / total) * 100;
234
236
  }
235
237
  catch (error) {
236
- if (error instanceof _module_1.CollectionError ||
237
- error instanceof TypeError) {
238
+ if (error instanceof _module_1.CollectionError) {
238
239
  throw error;
239
240
  }
240
241
  throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
241
242
  }
242
243
  }
243
- async some(filter, throwOnIndexOverflow = AsyncIterableCollection.THROW_ON_NUMBER_LIMIT) {
244
+ async some(predicateFn) {
244
245
  try {
245
- for await (const [index, item] of this.entries(throwOnIndexOverflow)) {
246
- if (await filter(item, index, this)) {
246
+ for await (const [index, item] of this.entries()) {
247
+ if (await predicateFn(item, index, this)) {
247
248
  return true;
248
249
  }
249
250
  }
250
251
  return false;
251
252
  }
252
253
  catch (error) {
253
- if (error instanceof _module_1.CollectionError ||
254
- error instanceof TypeError) {
254
+ if (error instanceof _module_1.CollectionError) {
255
255
  throw error;
256
256
  }
257
257
  throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
258
258
  }
259
259
  }
260
- async every(filter, throwOnIndexOverflow = AsyncIterableCollection.THROW_ON_NUMBER_LIMIT) {
260
+ async every(predicateFn) {
261
261
  try {
262
262
  let isTrue = true;
263
- for await (const [index, item] of this.entries(throwOnIndexOverflow)) {
264
- isTrue &&= await filter(item, index, this);
263
+ for await (const [index, item] of this.entries()) {
264
+ isTrue &&= await predicateFn(item, index, this);
265
265
  if (!isTrue) {
266
266
  break;
267
267
  }
@@ -269,30 +269,29 @@ class AsyncIterableCollection {
269
269
  return isTrue;
270
270
  }
271
271
  catch (error) {
272
- if (error instanceof _module_1.CollectionError ||
273
- error instanceof TypeError) {
272
+ if (error instanceof _module_1.CollectionError) {
274
273
  throw error;
275
274
  }
276
275
  throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
277
276
  }
278
277
  }
279
- take(limit, throwOnIndexOverflow = AsyncIterableCollection.THROW_ON_NUMBER_LIMIT) {
280
- return new AsyncIterableCollection(new _module_2.AsyncTakeIterable(this, limit, throwOnIndexOverflow));
278
+ take(limit) {
279
+ return new AsyncIterableCollection(new _module_2.AsyncTakeIterable(this, limit));
281
280
  }
282
- takeUntil(filter, throwOnIndexOverflow = AsyncIterableCollection.THROW_ON_NUMBER_LIMIT) {
283
- return new AsyncIterableCollection(new _module_2.AsyncTakeUntilIterable(this, filter, throwOnIndexOverflow));
281
+ takeUntil(predicateFn) {
282
+ return new AsyncIterableCollection(new _module_2.AsyncTakeUntilIterable(this, predicateFn));
284
283
  }
285
- takeWhile(filter, throwOnIndexOverflow = AsyncIterableCollection.THROW_ON_NUMBER_LIMIT) {
286
- return this.takeUntil(async (...arguments_) => !(await filter(...arguments_)), throwOnIndexOverflow);
284
+ takeWhile(predicateFn) {
285
+ return this.takeUntil(async (...arguments_) => !(await predicateFn(...arguments_)));
287
286
  }
288
- skip(offset, throwOnIndexOverflow = AsyncIterableCollection.THROW_ON_NUMBER_LIMIT) {
289
- return new AsyncIterableCollection(new _module_2.AsyncSkipIterable(this, offset, throwOnIndexOverflow));
287
+ skip(offset) {
288
+ return new AsyncIterableCollection(new _module_2.AsyncSkipIterable(this, offset));
290
289
  }
291
- skipUntil(filter, throwOnIndexOverflow = AsyncIterableCollection.THROW_ON_NUMBER_LIMIT) {
292
- return new AsyncIterableCollection(new _module_2.AsyncSkipUntilIterable(this, filter, throwOnIndexOverflow));
290
+ skipUntil(predicateFn) {
291
+ return new AsyncIterableCollection(new _module_2.AsyncSkipUntilIterable(this, predicateFn));
293
292
  }
294
- skipWhile(filter, throwOnIndexOverflow = AsyncIterableCollection.THROW_ON_NUMBER_LIMIT) {
295
- return this.skipUntil(async (...arguments_) => !(await filter(...arguments_)), throwOnIndexOverflow);
293
+ skipWhile(predicateFn) {
294
+ return this.skipUntil(async (...arguments_) => !(await predicateFn(...arguments_)));
296
295
  }
297
296
  when(condition, callback) {
298
297
  return new AsyncIterableCollection(new _module_2.AsyncWhenIterable(this, () => condition, callback));
@@ -311,8 +310,7 @@ class AsyncIterableCollection {
311
310
  return await callback(this);
312
311
  }
313
312
  catch (error) {
314
- if (error instanceof _module_1.CollectionError ||
315
- error instanceof TypeError) {
313
+ if (error instanceof _module_1.CollectionError) {
316
314
  throw error;
317
315
  }
318
316
  throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
@@ -324,30 +322,26 @@ class AsyncIterableCollection {
324
322
  chunk(chunkSize) {
325
323
  return new AsyncIterableCollection(new _module_2.AsyncChunkIterable(this, chunkSize, AsyncIterableCollection.makeCollection));
326
324
  }
327
- chunkWhile(filter, throwOnIndexOverflow = AsyncIterableCollection.THROW_ON_NUMBER_LIMIT) {
328
- return new AsyncIterableCollection(new _module_2.AsyncChunkWhileIterable(this, filter, throwOnIndexOverflow, AsyncIterableCollection.makeCollection));
325
+ chunkWhile(predicateFn) {
326
+ return new AsyncIterableCollection(new _module_2.AsyncChunkWhileIterable(this, predicateFn, AsyncIterableCollection.makeCollection));
329
327
  }
330
- split(chunkAmount, throwOnIndexOverflow = AsyncIterableCollection.THROW_ON_NUMBER_LIMIT) {
331
- return new AsyncIterableCollection(new _module_2.AsyncSplitIterable(this, chunkAmount, throwOnIndexOverflow, AsyncIterableCollection.makeCollection));
328
+ split(chunkAmount) {
329
+ return new AsyncIterableCollection(new _module_2.AsyncSplitIterable(this, chunkAmount, AsyncIterableCollection.makeCollection));
332
330
  }
333
- partition(filter, throwOnIndexOverflow = AsyncIterableCollection.THROW_ON_NUMBER_LIMIT) {
334
- return new AsyncIterableCollection(new _module_2.AsyncPartionIterable(this, filter, throwOnIndexOverflow, AsyncIterableCollection.makeCollection));
331
+ partition(predicateFn) {
332
+ return new AsyncIterableCollection(new _module_2.AsyncPartionIterable(this, predicateFn, AsyncIterableCollection.makeCollection));
335
333
  }
336
- sliding(settings) {
337
- const { chunkSize, step = chunkSize - 1, throwOnIndexOverflow = AsyncIterableCollection.THROW_ON_NUMBER_LIMIT, } = settings;
338
- return new AsyncIterableCollection(new _module_2.AsyncSlidingIteralbe(this, chunkSize, step, throwOnIndexOverflow));
334
+ sliding(chunkSize, step = chunkSize - 1) {
335
+ return new AsyncIterableCollection(new _module_2.AsyncSlidingIteralbe(this, chunkSize, step));
339
336
  }
340
- groupBy(settings) {
341
- return new AsyncIterableCollection(new _module_2.AsyncGroupByIterable(this, settings?.selectFn, settings?.throwOnIndexOverflow ??
342
- AsyncIterableCollection.THROW_ON_NUMBER_LIMIT, AsyncIterableCollection.makeCollection));
337
+ groupBy(selectFn) {
338
+ return new AsyncIterableCollection(new _module_2.AsyncGroupByIterable(this, selectFn, AsyncIterableCollection.makeCollection));
343
339
  }
344
- countBy(settings) {
345
- return new AsyncIterableCollection(new _module_2.AsyncCountByIterable(this, settings?.selectFn, settings?.throwOnIndexOverflow ??
346
- AsyncIterableCollection.THROW_ON_NUMBER_LIMIT));
340
+ countBy(selectFn) {
341
+ return new AsyncIterableCollection(new _module_2.AsyncCountByIterable(this, selectFn));
347
342
  }
348
- unique(settings) {
349
- return new AsyncIterableCollection(new _module_2.AsyncUniqueIterable(this, settings?.selectFn, settings?.throwOnIndexOverflow ??
350
- AsyncIterableCollection.THROW_ON_NUMBER_LIMIT));
343
+ unique(selectFn) {
344
+ return new AsyncIterableCollection(new _module_2.AsyncUniqueIterable(this, selectFn));
351
345
  }
352
346
  difference(iterable, selectFn = (item) => item) {
353
347
  const differenceCollection = new AsyncIterableCollection(iterable);
@@ -367,9 +361,8 @@ class AsyncIterableCollection {
367
361
  padEnd(maxLength, fillItems) {
368
362
  return new AsyncIterableCollection(new _module_2.AsyncPadEndIterable(this, maxLength, fillItems, AsyncIterableCollection.makeCollection));
369
363
  }
370
- slice(settings) {
371
- return new AsyncIterableCollection(new _module_2.AsyncSliceIterable(this, settings?.start, settings?.end, settings?.throwOnIndexOverflow ??
372
- AsyncIterableCollection.THROW_ON_NUMBER_LIMIT));
364
+ slice(start, end) {
365
+ return new AsyncIterableCollection(new _module_2.AsyncSliceIterable(this, start, end));
373
366
  }
374
367
  prepend(iterable) {
375
368
  return new AsyncIterableCollection(new _module_2.AsyncMergeIterable(iterable, this));
@@ -377,14 +370,14 @@ class AsyncIterableCollection {
377
370
  append(iterable) {
378
371
  return new AsyncIterableCollection(new _module_2.AsyncMergeIterable(this, iterable));
379
372
  }
380
- insertBefore(filter, iterable, throwOnIndexOverflow = AsyncIterableCollection.THROW_ON_NUMBER_LIMIT) {
381
- return new AsyncIterableCollection(new _module_2.AsyncInsertBeforeIterable(this, filter, iterable, throwOnIndexOverflow));
373
+ insertBefore(predicateFn, iterable) {
374
+ return new AsyncIterableCollection(new _module_2.AsyncInsertBeforeIterable(this, predicateFn, iterable));
382
375
  }
383
- insertAfter(filter, iterable, throwOnIndexOverflow = AsyncIterableCollection.THROW_ON_NUMBER_LIMIT) {
384
- return new AsyncIterableCollection(new _module_2.AsyncInsertAfterIterable(this, filter, iterable, throwOnIndexOverflow));
376
+ insertAfter(predicateFn, iterable) {
377
+ return new AsyncIterableCollection(new _module_2.AsyncInsertAfterIterable(this, predicateFn, iterable));
385
378
  }
386
- crossJoin(...iterables) {
387
- return new AsyncIterableCollection(new _module_2.AsyncCrossJoinIterable(this, iterables, AsyncIterableCollection.makeCollection));
379
+ crossJoin(iterable) {
380
+ return new AsyncIterableCollection(new _module_2.AsyncCrossJoinIterable(this, iterable, AsyncIterableCollection.makeCollection));
388
381
  }
389
382
  zip(iterable) {
390
383
  return new AsyncIterableCollection(new _module_2.AsyncZipIterable(this, iterable));
@@ -392,150 +385,111 @@ class AsyncIterableCollection {
392
385
  sort(comparator) {
393
386
  return new AsyncIterableCollection(new _module_2.AsyncSortIterable(this, comparator));
394
387
  }
395
- reverse(settings) {
396
- return new AsyncIterableCollection(new _module_2.AsyncReverseIterable(this, settings?.chunkSize ??
397
- AsyncIterableCollection.DEFAULT_CHUNK_SIZE, settings?.throwOnIndexOverflow ??
398
- AsyncIterableCollection.THROW_ON_NUMBER_LIMIT, AsyncIterableCollection.makeCollection));
388
+ reverse(chunkSize) {
389
+ return new AsyncIterableCollection(new _module_2.AsyncReverseIterable(this, chunkSize ?? AsyncIterableCollection.DEFAULT_CHUNK_SIZE, AsyncIterableCollection.makeCollection));
399
390
  }
400
- shuffle() {
401
- return new AsyncIterableCollection(new _module_2.AsyncShuffleIterable(this));
391
+ shuffle(mathRandom = Math.random) {
392
+ return new AsyncIterableCollection(new _module_2.AsyncShuffleIterable(this, mathRandom));
402
393
  }
403
- async first(settings) {
404
- return this.firstOr({
405
- ...settings,
406
- defaultValue: null,
407
- });
394
+ async first(predicateFn) {
395
+ return this.firstOr(null, predicateFn);
408
396
  }
409
- async firstOr(settings) {
397
+ async firstOr(defaultValue, predicateFn = () => true) {
410
398
  try {
411
- const throwOnIndexOverflow = settings.throwOnIndexOverflow ??
412
- AsyncIterableCollection.THROW_ON_NUMBER_LIMIT;
413
- const filter = settings.predicateFn ?? (() => true);
414
- for await (const [index, item] of this.entries(throwOnIndexOverflow)) {
415
- if (await filter(item, index, this)) {
399
+ for await (const [index, item] of this.entries()) {
400
+ if (await predicateFn(item, index, this)) {
416
401
  return item;
417
402
  }
418
403
  }
419
- if (typeof settings.defaultValue === "function") {
420
- const defaultFn = settings.defaultValue;
421
- return defaultFn();
422
- }
423
- return settings.defaultValue;
404
+ return await (0, utilities_1.simplifyAsyncLazyable)(defaultValue);
424
405
  }
425
406
  catch (error) {
426
- if (error instanceof _module_1.CollectionError ||
427
- error instanceof TypeError) {
407
+ if (error instanceof _module_1.CollectionError) {
428
408
  throw error;
429
409
  }
430
410
  throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
431
411
  }
432
412
  }
433
- async firstOrFail(settings) {
434
- const item = await this.first(settings);
413
+ async firstOrFail(predicateFn) {
414
+ const item = await this.first(predicateFn);
435
415
  if (item === null) {
436
- throw new _module_1.ItemNotFoundError("Item was not found");
416
+ throw new _module_1.ItemNotFoundCollectionError("Item was not found");
437
417
  }
438
418
  return item;
439
419
  }
440
- async last(settings) {
441
- return this.lastOr({
442
- ...settings,
443
- defaultValue: null,
444
- });
420
+ async last(predicateFn) {
421
+ return this.lastOr(null, predicateFn);
445
422
  }
446
- async lastOr(settings) {
423
+ async lastOr(defaultValue, predicateFn = () => true) {
447
424
  try {
448
- const throwOnIndexOverflow = settings.throwOnIndexOverflow ??
449
- AsyncIterableCollection.THROW_ON_NUMBER_LIMIT;
450
- const filter = settings.predicateFn ?? (() => true);
451
425
  let matchedItem = null;
452
- for await (const [index, item] of this.entries(throwOnIndexOverflow)) {
453
- if (await filter(item, index, this)) {
426
+ for await (const [index, item] of this.entries()) {
427
+ if (await predicateFn(item, index, this)) {
454
428
  matchedItem = item;
455
429
  }
456
430
  }
457
431
  if (matchedItem) {
458
432
  return matchedItem;
459
433
  }
460
- if (typeof settings.defaultValue === "function") {
461
- const defaultFn = settings.defaultValue;
462
- return defaultFn();
463
- }
464
- return settings.defaultValue;
434
+ return await (0, utilities_1.simplifyAsyncLazyable)(defaultValue);
465
435
  }
466
436
  catch (error) {
467
- if (error instanceof _module_1.CollectionError ||
468
- error instanceof TypeError) {
437
+ if (error instanceof _module_1.CollectionError) {
469
438
  throw error;
470
439
  }
471
440
  throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
472
441
  }
473
442
  }
474
- async lastOrFail(settings) {
475
- const item = await this.last(settings);
443
+ async lastOrFail(predicateFn) {
444
+ const item = await this.last(predicateFn);
476
445
  if (item === null) {
477
- throw new _module_1.ItemNotFoundError("Item was not found");
446
+ throw new _module_1.ItemNotFoundCollectionError("Item was not found");
478
447
  }
479
448
  return item;
480
449
  }
481
- async before(filter, throwOnIndexOverflow = AsyncIterableCollection.THROW_ON_NUMBER_LIMIT) {
482
- return this.beforeOr(null, filter, throwOnIndexOverflow);
450
+ async before(predicateFn) {
451
+ return this.beforeOr(null, predicateFn);
483
452
  }
484
- async beforeOr(defaultValue, filter, throwOnIndexOverflow = AsyncIterableCollection.THROW_ON_NUMBER_LIMIT) {
453
+ async beforeOr(defaultValue, predicateFn) {
485
454
  try {
486
455
  let beforeItem = null, index = 0;
487
456
  for await (const item of this) {
488
- if (throwOnIndexOverflow && index === Number.MAX_SAFE_INTEGER) {
489
- throw new _module_1.IndexOverflowError("Index has overflowed");
490
- }
491
- if ((await filter(item, index, this)) && beforeItem) {
457
+ if ((await predicateFn(item, index, this)) && beforeItem) {
492
458
  return beforeItem;
493
459
  }
494
460
  index++;
495
461
  beforeItem = item;
496
462
  }
497
- if (typeof defaultValue === "function") {
498
- const defaultFn = defaultValue;
499
- return defaultFn();
500
- }
501
- return defaultValue;
463
+ return await (0, utilities_1.simplifyAsyncLazyable)(defaultValue);
502
464
  }
503
465
  catch (error) {
504
- if (error instanceof _module_1.CollectionError ||
505
- error instanceof TypeError) {
466
+ if (error instanceof _module_1.CollectionError) {
506
467
  throw error;
507
468
  }
508
469
  throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
509
470
  }
510
471
  }
511
- async beforeOrFail(filter, throwOnIndexOverflow = AsyncIterableCollection.THROW_ON_NUMBER_LIMIT) {
512
- const item = await this.before(filter, throwOnIndexOverflow);
472
+ async beforeOrFail(predicateFn) {
473
+ const item = await this.before(predicateFn);
513
474
  if (item === null) {
514
- throw new _module_1.ItemNotFoundError("Item was not found");
475
+ throw new _module_1.ItemNotFoundCollectionError("Item was not found");
515
476
  }
516
477
  return item;
517
478
  }
518
- async after(filter, throwOnIndexOverflow = AsyncIterableCollection.THROW_ON_NUMBER_LIMIT) {
519
- return this.afterOr(null, filter, throwOnIndexOverflow);
479
+ async after(predicateFn) {
480
+ return this.afterOr(null, predicateFn);
520
481
  }
521
- async afterOr(defaultValue, filter, throwOnIndexOverflow = AsyncIterableCollection.THROW_ON_NUMBER_LIMIT) {
482
+ async afterOr(defaultValue, predicateFn) {
522
483
  try {
523
484
  let hasMatched = false, index = 0;
524
485
  for await (const item of this) {
525
486
  if (hasMatched) {
526
487
  return item;
527
488
  }
528
- if (throwOnIndexOverflow && index === Number.MAX_SAFE_INTEGER) {
529
- throw new _module_1.IndexOverflowError("Index has overflowed");
530
- }
531
- hasMatched = await filter(item, index, this);
489
+ hasMatched = await predicateFn(item, index, this);
532
490
  index++;
533
491
  }
534
- if (typeof defaultValue === "function") {
535
- const defaultFn = defaultValue;
536
- return defaultFn();
537
- }
538
- return defaultValue;
492
+ return await (0, utilities_1.simplifyAsyncLazyable)(defaultValue);
539
493
  }
540
494
  catch (error) {
541
495
  if (error instanceof _module_1.CollectionError) {
@@ -544,32 +498,31 @@ class AsyncIterableCollection {
544
498
  throw new _module_1.UnexpectedCollectionError("!!__messge__!!", error);
545
499
  }
546
500
  }
547
- async afterOrFail(filter, throwOnIndexOverflow = AsyncIterableCollection.THROW_ON_NUMBER_LIMIT) {
548
- const item = await this.after(filter, throwOnIndexOverflow);
501
+ async afterOrFail(predicateFn) {
502
+ const item = await this.after(predicateFn);
549
503
  if (item === null) {
550
- throw new _module_1.ItemNotFoundError("Item was not found");
504
+ throw new _module_1.ItemNotFoundCollectionError("Item was not found");
551
505
  }
552
506
  return item;
553
507
  }
554
- async sole(filter, throwOnIndexOverflow = AsyncIterableCollection.THROW_ON_NUMBER_LIMIT) {
508
+ async sole(predicateFn) {
555
509
  try {
556
510
  let matchedItem = null;
557
- for await (const [index, item] of this.entries(throwOnIndexOverflow)) {
558
- if (await filter(item, index, this)) {
511
+ for await (const [index, item] of this.entries()) {
512
+ if (await predicateFn(item, index, this)) {
559
513
  if (matchedItem !== null) {
560
- throw new _module_1.MultipleItemsFoundError("Multiple items were found");
514
+ throw new _module_1.MultipleItemsFoundCollectionError("Multiple items were found");
561
515
  }
562
516
  matchedItem = item;
563
517
  }
564
518
  }
565
519
  if (matchedItem === null) {
566
- throw new _module_1.ItemNotFoundError("Item was not found");
520
+ throw new _module_1.ItemNotFoundCollectionError("Item was not found");
567
521
  }
568
522
  return matchedItem;
569
523
  }
570
524
  catch (error) {
571
- if (error instanceof _module_1.CollectionError ||
572
- error instanceof TypeError) {
525
+ if (error instanceof _module_1.CollectionError) {
573
526
  throw error;
574
527
  }
575
528
  throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
@@ -587,29 +540,25 @@ class AsyncIterableCollection {
587
540
  timeout(timeInMs) {
588
541
  return new AsyncIterableCollection(new _module_2.AsyncTimeoutIterable(this, timeInMs));
589
542
  }
590
- async count(filter, throwOnIndexOverflow = AsyncIterableCollection.THROW_ON_NUMBER_LIMIT) {
543
+ async count(predicateFn) {
591
544
  try {
592
545
  let size = 0;
593
546
  for await (const item of this) {
594
- if (throwOnIndexOverflow && size === Number.MAX_SAFE_INTEGER) {
595
- throw new _module_1.IndexOverflowError("Size has overflowed");
596
- }
597
- if (await filter(item, size, this)) {
547
+ if (await predicateFn(item, size, this)) {
598
548
  size++;
599
549
  }
600
550
  }
601
551
  return size;
602
552
  }
603
553
  catch (error) {
604
- if (error instanceof _module_1.CollectionError ||
605
- error instanceof TypeError) {
554
+ if (error instanceof _module_1.CollectionError) {
606
555
  throw error;
607
556
  }
608
557
  throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
609
558
  }
610
559
  }
611
- async size(throwOnIndexOverflow) {
612
- return this.count(() => true, throwOnIndexOverflow);
560
+ async size() {
561
+ return this.count(() => true);
613
562
  }
614
563
  async isEmpty() {
615
564
  try {
@@ -619,8 +568,7 @@ class AsyncIterableCollection {
619
568
  return true;
620
569
  }
621
570
  catch (error) {
622
- if (error instanceof _module_1.CollectionError ||
623
- error instanceof TypeError) {
571
+ if (error instanceof _module_1.CollectionError) {
624
572
  throw error;
625
573
  }
626
574
  throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
@@ -629,43 +577,41 @@ class AsyncIterableCollection {
629
577
  async isNotEmpty() {
630
578
  return !(await this.isEmpty());
631
579
  }
632
- async searchFirst(filter, throwOnIndexOverflow = AsyncIterableCollection.THROW_ON_NUMBER_LIMIT) {
580
+ async searchFirst(predicateFn) {
633
581
  try {
634
- for await (const [index, item] of this.entries(throwOnIndexOverflow)) {
635
- if (await filter(item, index, this)) {
582
+ for await (const [index, item] of this.entries()) {
583
+ if (await predicateFn(item, index, this)) {
636
584
  return index;
637
585
  }
638
586
  }
639
587
  return -1;
640
588
  }
641
589
  catch (error) {
642
- if (error instanceof _module_1.CollectionError ||
643
- error instanceof TypeError) {
590
+ if (error instanceof _module_1.CollectionError) {
644
591
  throw error;
645
592
  }
646
593
  throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
647
594
  }
648
595
  }
649
- async searchLast(filter, throwOnIndexOverflow = AsyncIterableCollection.THROW_ON_NUMBER_LIMIT) {
596
+ async searchLast(predicateFn) {
650
597
  try {
651
598
  let matchedIndex = -1;
652
- for await (const [index, item] of this.entries(throwOnIndexOverflow)) {
653
- if (await filter(item, index, this)) {
599
+ for await (const [index, item] of this.entries()) {
600
+ if (await predicateFn(item, index, this)) {
654
601
  matchedIndex = index;
655
602
  }
656
603
  }
657
604
  return matchedIndex;
658
605
  }
659
606
  catch (error) {
660
- if (error instanceof _module_1.CollectionError ||
661
- error instanceof TypeError) {
607
+ if (error instanceof _module_1.CollectionError) {
662
608
  throw error;
663
609
  }
664
610
  throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
665
611
  }
666
612
  }
667
- async forEach(callback, throwOnIndexOverflow = AsyncIterableCollection.THROW_ON_NUMBER_LIMIT) {
668
- for await (const [index, item] of this.entries(throwOnIndexOverflow)) {
613
+ async forEach(callback) {
614
+ for await (const [index, item] of this.entries()) {
669
615
  await callback(item, index, this);
670
616
  }
671
617
  }
@@ -678,8 +624,7 @@ class AsyncIterableCollection {
678
624
  return items;
679
625
  }
680
626
  catch (error) {
681
- if (error instanceof _module_1.CollectionError ||
682
- error instanceof TypeError) {
627
+ if (error instanceof _module_1.CollectionError) {
683
628
  throw error;
684
629
  }
685
630
  throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);