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