@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.IterableCollection = void 0;
4
4
  const _module_1 = require("../../contracts/collection/_module");
5
5
  const _module_2 = require("../../collection/iterable-collection/_shared/_module");
6
+ const utilities_1 = require("../../_shared/utilities");
6
7
  class IterableCollection {
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 IterableCollection(iterable);
@@ -18,8 +18,7 @@ class IterableCollection {
18
18
  yield* this.iterable;
19
19
  }
20
20
  catch (error) {
21
- if (error instanceof _module_1.CollectionError ||
22
- error instanceof TypeError) {
21
+ if (error instanceof _module_1.CollectionError) {
23
22
  throw error;
24
23
  }
25
24
  throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
@@ -28,38 +27,33 @@ class IterableCollection {
28
27
  toIterator() {
29
28
  return this[Symbol.iterator]();
30
29
  }
31
- entries(throwOnIndexOverflow = IterableCollection.THROW_ON_NUMBER_LIMIT) {
32
- return new IterableCollection(new _module_2.EntriesIterable(this, throwOnIndexOverflow));
30
+ entries() {
31
+ return new IterableCollection(new _module_2.EntriesIterable(this));
33
32
  }
34
- keys(throwOnIndexOverflow = IterableCollection.THROW_ON_NUMBER_LIMIT) {
35
- return this.entries(throwOnIndexOverflow).map(([key]) => key);
33
+ keys() {
34
+ return this.entries().map(([key]) => key);
36
35
  }
37
36
  values() {
38
37
  return this.entries().map(([_key, value]) => value);
39
38
  }
40
- filter(predicateFn, throwOnIndexOverflow = IterableCollection.THROW_ON_NUMBER_LIMIT) {
41
- return new IterableCollection(new _module_2.FilterIterable(this, predicateFn, throwOnIndexOverflow));
39
+ filter(predicateFn) {
40
+ return new IterableCollection(new _module_2.FilterIterable(this, predicateFn));
42
41
  }
43
- reject(predicateFn, throwOnIndexOverflow = IterableCollection.THROW_ON_NUMBER_LIMIT) {
44
- return this.filter((...arguments_) => !predicateFn(...arguments_), throwOnIndexOverflow);
42
+ reject(predicateFn) {
43
+ return this.filter((...arguments_) => !predicateFn(...arguments_));
45
44
  }
46
- map(mapFn, throwOnIndexOverflow = IterableCollection.THROW_ON_NUMBER_LIMIT) {
47
- return new IterableCollection(new _module_2.MapIterable(this, mapFn, throwOnIndexOverflow));
45
+ map(mapFn) {
46
+ return new IterableCollection(new _module_2.MapIterable(this, mapFn));
48
47
  }
49
- reduce(settings) {
48
+ reduce(reduceFn, initialValue) {
50
49
  try {
51
- const { reduceFn: reduce, initialValue, throwOnIndexOverflow, } = settings;
52
50
  if (initialValue === undefined && this.isEmpty()) {
53
- throw new TypeError("Reduce of empty array must be inputed a initial value");
51
+ throw new _module_1.TypeCollectionError("Reduce of empty array must be inputed a initial value");
54
52
  }
55
53
  if (initialValue !== undefined) {
56
54
  let output = initialValue, index = 0;
57
55
  for (const item of this) {
58
- if (throwOnIndexOverflow &&
59
- index === Number.MAX_SAFE_INTEGER) {
60
- throw new _module_1.IndexOverflowError("Index has overflowed");
61
- }
62
- output = reduce(output, item, index, this);
56
+ output = reduceFn(output, item, index, this);
63
57
  index++;
64
58
  }
65
59
  return output;
@@ -67,11 +61,7 @@ class IterableCollection {
67
61
  let output = this.firstOrFail(), index = 0, isFirstIteration = true;
68
62
  for (const item of this) {
69
63
  if (!isFirstIteration) {
70
- if (throwOnIndexOverflow &&
71
- index === Number.MAX_SAFE_INTEGER) {
72
- throw new _module_1.IndexOverflowError("Index has overflowed");
73
- }
74
- output = reduce(output, item, index, this);
64
+ output = reduceFn(output, item, index, this);
75
65
  }
76
66
  isFirstIteration = false;
77
67
  index++;
@@ -79,30 +69,30 @@ class IterableCollection {
79
69
  return output;
80
70
  }
81
71
  catch (error) {
82
- if (error instanceof _module_1.CollectionError ||
83
- error instanceof TypeError) {
72
+ if (error instanceof _module_1.CollectionError) {
84
73
  throw error;
85
74
  }
86
75
  throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
87
76
  }
88
77
  }
89
- join(settings) {
78
+ join(separator = ",") {
90
79
  try {
91
- return this.reduce({
92
- reduceFn(str, item) {
93
- if (typeof item !== "string") {
94
- throw new TypeError("Item type is invalid must be string");
95
- }
96
- const separator = settings?.seperator ?? ",";
97
- return str + separator + item;
98
- },
99
- throwOnIndexOverflow: settings?.throwOnIndexOverflow ??
100
- IterableCollection.THROW_ON_NUMBER_LIMIT,
101
- });
80
+ let str = null;
81
+ for (const item of this) {
82
+ if (typeof item !== "string") {
83
+ throw new _module_1.TypeCollectionError("Item type is invalid must be string");
84
+ }
85
+ if (str === null) {
86
+ str = item;
87
+ }
88
+ else {
89
+ str = str + separator + item;
90
+ }
91
+ }
92
+ return str;
102
93
  }
103
94
  catch (error) {
104
- if (error instanceof _module_1.CollectionError ||
105
- error instanceof TypeError) {
95
+ if (error instanceof _module_1.CollectionError) {
106
96
  throw error;
107
97
  }
108
98
  throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
@@ -111,33 +101,34 @@ class IterableCollection {
111
101
  collapse() {
112
102
  return new IterableCollection(new _module_2.CollapseIterable(this));
113
103
  }
114
- flatMap(mapFn, throwOnIndexOverflow = IterableCollection.THROW_ON_NUMBER_LIMIT) {
115
- return new IterableCollection(new _module_2.FlatMapIterable(this, mapFn, throwOnIndexOverflow));
104
+ flatMap(mapFn) {
105
+ return new IterableCollection(new _module_2.FlatMapIterable(this, mapFn));
116
106
  }
117
- update(predicateFn, mapFn, throwOnIndexOverflow = IterableCollection.THROW_ON_NUMBER_LIMIT) {
118
- return new IterableCollection(new _module_2.UpdateIterable(this, predicateFn, mapFn, throwOnIndexOverflow));
107
+ change(predicateFn, mapFn) {
108
+ return new IterableCollection(new _module_2.UpdateIterable(this, predicateFn, mapFn));
119
109
  }
120
- page(settings) {
121
- const { page, pageSize, throwOnIndexOverflow } = settings;
110
+ page(page, pageSize) {
122
111
  if (page < 0) {
123
- return this.skip(page * pageSize, throwOnIndexOverflow).take(pageSize, throwOnIndexOverflow);
112
+ return this.skip(page * pageSize).take(pageSize);
124
113
  }
125
- return this.skip((page - 1) * pageSize, throwOnIndexOverflow).take(page * pageSize, throwOnIndexOverflow);
114
+ return this.skip((page - 1) * pageSize).take(pageSize);
126
115
  }
127
116
  sum() {
128
117
  try {
118
+ if (this.isEmpty()) {
119
+ throw new _module_1.EmptyCollectionError("Collection is empty therby operation cannot be performed");
120
+ }
129
121
  let sum = 0;
130
122
  for (const item of this) {
131
123
  if (typeof item !== "number") {
132
- throw new TypeError("Item type is invalid must be number");
124
+ throw new _module_1.TypeCollectionError("Item type is invalid must be number");
133
125
  }
134
126
  sum += item;
135
127
  }
136
128
  return sum;
137
129
  }
138
130
  catch (error) {
139
- if (error instanceof _module_1.CollectionError ||
140
- error instanceof TypeError) {
131
+ if (error instanceof _module_1.CollectionError) {
141
132
  throw error;
142
133
  }
143
134
  throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
@@ -145,10 +136,13 @@ class IterableCollection {
145
136
  }
146
137
  average() {
147
138
  try {
139
+ if (this.isEmpty()) {
140
+ throw new _module_1.EmptyCollectionError("Collection is empty therby operation cannot be performed");
141
+ }
148
142
  let size = 0, sum = 0;
149
143
  for (const item of this) {
150
144
  if (typeof item !== "number") {
151
- throw new TypeError("Item type is invalid must be number");
145
+ throw new _module_1.TypeCollectionError("Item type is invalid must be number");
152
146
  }
153
147
  size++;
154
148
  sum += item;
@@ -156,33 +150,32 @@ class IterableCollection {
156
150
  return (sum / size);
157
151
  }
158
152
  catch (error) {
159
- if (error instanceof _module_1.CollectionError ||
160
- error instanceof TypeError) {
153
+ if (error instanceof _module_1.CollectionError) {
161
154
  throw error;
162
155
  }
163
156
  throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
164
157
  }
165
158
  }
166
- median(throwOnIndexOverflow = IterableCollection.THROW_ON_NUMBER_LIMIT) {
159
+ median() {
167
160
  if (this.isEmpty()) {
168
- return 0;
161
+ throw new _module_1.EmptyCollectionError("Collection is empty therby operation cannot be performed");
169
162
  }
170
- const size = this.size(throwOnIndexOverflow);
163
+ const size = this.size();
171
164
  if (size === 0) {
172
165
  return 0;
173
166
  }
174
167
  const isEven = size % 2 === 0, items = this.map((item) => {
175
168
  if (typeof item !== "number") {
176
- throw new TypeError("Item type is invalid must be number");
169
+ throw new _module_1.TypeCollectionError("Item type is invalid must be number");
177
170
  }
178
171
  return item;
179
- }, throwOnIndexOverflow)
172
+ })
180
173
  .filter((_item, index) => {
181
174
  if (isEven) {
182
175
  return index === size / 2 || index === size / 2 - 1;
183
176
  }
184
177
  return index === Math.floor(size / 2);
185
- }, throwOnIndexOverflow)
178
+ })
186
179
  .toArray();
187
180
  if (isEven) {
188
181
  const [a, b] = items;
@@ -202,10 +195,13 @@ class IterableCollection {
202
195
  }
203
196
  min() {
204
197
  try {
198
+ if (this.isEmpty()) {
199
+ throw new _module_1.EmptyCollectionError("Collection is empty therby operation cannot be performed");
200
+ }
205
201
  let min = 0;
206
202
  for (const item of this) {
207
203
  if (typeof item !== "number") {
208
- throw new TypeError("Item type is invalid must be number");
204
+ throw new _module_1.TypeCollectionError("Item type is invalid must be number");
209
205
  }
210
206
  if (min === 0) {
211
207
  min = item;
@@ -217,8 +213,7 @@ class IterableCollection {
217
213
  return min;
218
214
  }
219
215
  catch (error) {
220
- if (error instanceof _module_1.CollectionError ||
221
- error instanceof TypeError) {
216
+ if (error instanceof _module_1.CollectionError) {
222
217
  throw error;
223
218
  }
224
219
  throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
@@ -226,10 +221,13 @@ class IterableCollection {
226
221
  }
227
222
  max() {
228
223
  try {
224
+ if (this.isEmpty()) {
225
+ throw new _module_1.EmptyCollectionError("Collection is empty therby operation cannot be performed");
226
+ }
229
227
  let max = 0;
230
228
  for (const item of this) {
231
229
  if (typeof item !== "number") {
232
- throw new TypeError("Item type is invalid must be number");
230
+ throw new _module_1.TypeCollectionError("Item type is invalid must be number");
233
231
  }
234
232
  if (max === 0) {
235
233
  max = item;
@@ -241,23 +239,19 @@ class IterableCollection {
241
239
  return max;
242
240
  }
243
241
  catch (error) {
244
- if (error instanceof _module_1.CollectionError ||
245
- error instanceof TypeError) {
242
+ if (error instanceof _module_1.CollectionError) {
246
243
  throw error;
247
244
  }
248
245
  throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
249
246
  }
250
247
  }
251
- percentage(predicateFn, throwOnIndexOverflow = IterableCollection.THROW_ON_NUMBER_LIMIT) {
248
+ percentage(predicateFn) {
252
249
  try {
253
250
  if (this.isEmpty()) {
254
- return 0;
251
+ throw new _module_1.EmptyCollectionError("Collection is empty therby operation cannot be performed");
255
252
  }
256
253
  let part = 0, total = 0;
257
254
  for (const item of this) {
258
- if (throwOnIndexOverflow && total === Number.MAX_SAFE_INTEGER) {
259
- throw new _module_1.IndexOverflowError("The total amount has overflowed");
260
- }
261
255
  if (predicateFn(item, total, this)) {
262
256
  part++;
263
257
  }
@@ -266,20 +260,16 @@ class IterableCollection {
266
260
  return (part / total) * 100;
267
261
  }
268
262
  catch (error) {
269
- if (error instanceof _module_1.CollectionError ||
270
- error instanceof TypeError) {
263
+ if (error instanceof _module_1.CollectionError) {
271
264
  throw error;
272
265
  }
273
266
  throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
274
267
  }
275
268
  }
276
- some(predicateFn, throwOnIndexOverflow = IterableCollection.THROW_ON_NUMBER_LIMIT) {
269
+ some(predicateFn) {
277
270
  try {
278
271
  let index = 0;
279
272
  for (const item of this) {
280
- if (throwOnIndexOverflow && index === Number.MAX_SAFE_INTEGER) {
281
- throw new _module_1.IndexOverflowError("Index has overflowed");
282
- }
283
273
  if (predicateFn(item, index, this)) {
284
274
  return true;
285
275
  }
@@ -288,20 +278,16 @@ class IterableCollection {
288
278
  return false;
289
279
  }
290
280
  catch (error) {
291
- if (error instanceof _module_1.CollectionError ||
292
- error instanceof TypeError) {
281
+ if (error instanceof _module_1.CollectionError) {
293
282
  throw error;
294
283
  }
295
284
  throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
296
285
  }
297
286
  }
298
- every(predicateFn, throwOnIndexOverflow = IterableCollection.THROW_ON_NUMBER_LIMIT) {
287
+ every(predicateFn) {
299
288
  try {
300
289
  let index = 0, isTrue = true;
301
290
  for (const item of this) {
302
- if (throwOnIndexOverflow && index === Number.MAX_SAFE_INTEGER) {
303
- throw new _module_1.IndexOverflowError("Index has overflowed");
304
- }
305
291
  isTrue &&= predicateFn(item, index, this);
306
292
  if (!isTrue) {
307
293
  break;
@@ -311,30 +297,29 @@ class IterableCollection {
311
297
  return isTrue;
312
298
  }
313
299
  catch (error) {
314
- if (error instanceof _module_1.CollectionError ||
315
- error instanceof TypeError) {
300
+ if (error instanceof _module_1.CollectionError) {
316
301
  throw error;
317
302
  }
318
303
  throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
319
304
  }
320
305
  }
321
- take(limit, throwOnIndexOverflow = IterableCollection.THROW_ON_NUMBER_LIMIT) {
322
- return new IterableCollection(new _module_2.TakeIterable(this, limit, throwOnIndexOverflow));
306
+ take(limit) {
307
+ return new IterableCollection(new _module_2.TakeIterable(this, limit));
323
308
  }
324
- takeUntil(predicateFn, throwOnIndexOverflow = IterableCollection.THROW_ON_NUMBER_LIMIT) {
325
- return new IterableCollection(new _module_2.TakeUntilIterable(this, predicateFn, throwOnIndexOverflow));
309
+ takeUntil(predicateFn) {
310
+ return new IterableCollection(new _module_2.TakeUntilIterable(this, predicateFn));
326
311
  }
327
- takeWhile(predicateFn, throwOnIndexOverflow = IterableCollection.THROW_ON_NUMBER_LIMIT) {
328
- return this.takeUntil((...arguments_) => !predicateFn(...arguments_), throwOnIndexOverflow);
312
+ takeWhile(predicateFn) {
313
+ return this.takeUntil((...arguments_) => !predicateFn(...arguments_));
329
314
  }
330
- skip(offset, throwOnIndexOverflow = IterableCollection.THROW_ON_NUMBER_LIMIT) {
331
- return new IterableCollection(new _module_2.SkipIterable(this, offset, throwOnIndexOverflow));
315
+ skip(offset) {
316
+ return new IterableCollection(new _module_2.SkipIterable(this, offset));
332
317
  }
333
- skipUntil(predicateFn, throwOnIndexOverflow = IterableCollection.THROW_ON_NUMBER_LIMIT) {
334
- return new IterableCollection(new _module_2.SkipUntilIterable(this, predicateFn, throwOnIndexOverflow));
318
+ skipUntil(predicateFn) {
319
+ return new IterableCollection(new _module_2.SkipUntilIterable(this, predicateFn));
335
320
  }
336
- skipWhile(predicateFn, throwOnIndexOverflow = IterableCollection.THROW_ON_NUMBER_LIMIT) {
337
- return this.skipUntil((...arguments_) => !predicateFn(...arguments_), throwOnIndexOverflow);
321
+ skipWhile(predicateFn) {
322
+ return this.skipUntil((...arguments_) => !predicateFn(...arguments_));
338
323
  }
339
324
  when(condition, callback) {
340
325
  return new IterableCollection(new _module_2.WhenIterable(this, () => condition, callback));
@@ -353,8 +338,7 @@ class IterableCollection {
353
338
  return callback(this);
354
339
  }
355
340
  catch (error) {
356
- if (error instanceof _module_1.CollectionError ||
357
- error instanceof TypeError) {
341
+ if (error instanceof _module_1.CollectionError) {
358
342
  throw error;
359
343
  }
360
344
  throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
@@ -366,30 +350,26 @@ class IterableCollection {
366
350
  chunk(chunkSize) {
367
351
  return new IterableCollection(new _module_2.ChunkIterable(this, chunkSize, IterableCollection.makeCollection));
368
352
  }
369
- chunkWhile(predicateFn, throwOnIndexOverflow = IterableCollection.THROW_ON_NUMBER_LIMIT) {
370
- return new IterableCollection(new _module_2.ChunkWhileIterable(this, predicateFn, throwOnIndexOverflow, (iterable) => new IterableCollection(iterable)));
353
+ chunkWhile(predicateFn) {
354
+ return new IterableCollection(new _module_2.ChunkWhileIterable(this, predicateFn, IterableCollection.makeCollection));
371
355
  }
372
- split(chunkAmount, throwOnIndexOverflow = IterableCollection.THROW_ON_NUMBER_LIMIT) {
373
- return new IterableCollection(new _module_2.SplitIterable(this, chunkAmount, throwOnIndexOverflow, IterableCollection.makeCollection));
356
+ split(chunkAmount) {
357
+ return new IterableCollection(new _module_2.SplitIterable(this, chunkAmount, IterableCollection.makeCollection));
374
358
  }
375
- partition(predicateFn, throwOnIndexOverflow = IterableCollection.THROW_ON_NUMBER_LIMIT) {
376
- return new IterableCollection(new _module_2.PartionIterable(this, predicateFn, throwOnIndexOverflow, IterableCollection.makeCollection));
359
+ partition(predicateFn) {
360
+ return new IterableCollection(new _module_2.PartionIterable(this, predicateFn, IterableCollection.makeCollection));
377
361
  }
378
- sliding(settings) {
379
- const { chunkSize, step = chunkSize - 1, throwOnIndexOverflow = IterableCollection.THROW_ON_NUMBER_LIMIT, } = settings;
380
- return new IterableCollection(new _module_2.SlidingIteralbe(this, chunkSize, step, throwOnIndexOverflow));
362
+ sliding(chunkSize, step = chunkSize - 1) {
363
+ return new IterableCollection(new _module_2.SlidingIteralbe(this, chunkSize, step));
381
364
  }
382
- groupBy(settings) {
383
- return new IterableCollection(new _module_2.GroupByIterable(this, settings?.selectFn, settings?.throwOnIndexOverflow ??
384
- IterableCollection.THROW_ON_NUMBER_LIMIT, (iterable) => new IterableCollection(iterable)));
365
+ groupBy(selectFn) {
366
+ return new IterableCollection(new _module_2.GroupByIterable(this, selectFn, IterableCollection.makeCollection));
385
367
  }
386
- countBy(settings) {
387
- return new IterableCollection(new _module_2.CountByIterable(this, settings?.selectFn, settings?.throwOnIndexOverflow ??
388
- IterableCollection.THROW_ON_NUMBER_LIMIT));
368
+ countBy(selectFn) {
369
+ return new IterableCollection(new _module_2.CountByIterable(this, selectFn));
389
370
  }
390
- unique(settings) {
391
- return new IterableCollection(new _module_2.UniqueIterable(this, settings?.selectFn, settings?.throwOnIndexOverflow ??
392
- IterableCollection.THROW_ON_NUMBER_LIMIT));
371
+ unique(selectFn) {
372
+ return new IterableCollection(new _module_2.UniqueIterable(this, selectFn));
393
373
  }
394
374
  difference(iterable, mapFn = (item) => item) {
395
375
  const differenceCollection = new IterableCollection(iterable);
@@ -409,9 +389,8 @@ class IterableCollection {
409
389
  padEnd(maxLength, fillItems) {
410
390
  return new IterableCollection(new _module_2.PadEndIterable(this, maxLength, fillItems, IterableCollection.makeCollection));
411
391
  }
412
- slice(settings) {
413
- return new IterableCollection(new _module_2.SliceIterable(this, settings?.start, settings?.end, settings?.throwOnIndexOverflow ??
414
- IterableCollection.THROW_ON_NUMBER_LIMIT));
392
+ slice(start, end) {
393
+ return new IterableCollection(new _module_2.SliceIterable(this, start, end));
415
394
  }
416
395
  prepend(iterable) {
417
396
  return new IterableCollection(new _module_2.MergeIterable(iterable, this));
@@ -419,14 +398,14 @@ class IterableCollection {
419
398
  append(iterable) {
420
399
  return new IterableCollection(new _module_2.MergeIterable(this, iterable));
421
400
  }
422
- insertBefore(predicateFn, iterable, throwOnIndexOverflow = IterableCollection.THROW_ON_NUMBER_LIMIT) {
423
- return new IterableCollection(new _module_2.InsertBeforeIterable(this, predicateFn, iterable, throwOnIndexOverflow));
401
+ insertBefore(predicateFn, iterable) {
402
+ return new IterableCollection(new _module_2.InsertBeforeIterable(this, predicateFn, iterable));
424
403
  }
425
- insertAfter(predicateFn, iterable, throwOnIndexOverflow = IterableCollection.THROW_ON_NUMBER_LIMIT) {
426
- return new IterableCollection(new _module_2.InsertAfterIterable(this, predicateFn, iterable, throwOnIndexOverflow));
404
+ insertAfter(predicateFn, iterable) {
405
+ return new IterableCollection(new _module_2.InsertAfterIterable(this, predicateFn, iterable));
427
406
  }
428
- crossJoin(...iterables) {
429
- return new IterableCollection(new _module_2.CrossJoinIterable(this, iterables, IterableCollection.makeCollection));
407
+ crossJoin(iterable) {
408
+ return new IterableCollection(new _module_2.CrossJoinIterable(this, iterable, IterableCollection.makeCollection));
430
409
  }
431
410
  zip(iterable) {
432
411
  return new IterableCollection(new _module_2.ZipIterable(this, iterable));
@@ -434,90 +413,64 @@ class IterableCollection {
434
413
  sort(comparator) {
435
414
  return new IterableCollection(new _module_2.SortIterable(this, comparator));
436
415
  }
437
- reverse(settings) {
438
- return new IterableCollection(new _module_2.ReverseIterable(this, settings?.chunkSize ?? IterableCollection.DEFAULT_CHUNK_SIZE, settings?.throwOnIndexOverflow ??
439
- IterableCollection.THROW_ON_NUMBER_LIMIT, (iterable) => new IterableCollection(iterable)));
416
+ reverse(chunkSize = IterableCollection.DEFAULT_CHUNK_SIZE) {
417
+ return new IterableCollection(new _module_2.ReverseIterable(this, chunkSize, IterableCollection.makeCollection));
440
418
  }
441
- shuffle() {
442
- return new IterableCollection(new _module_2.ShuffleIterable(this));
419
+ shuffle(mathRandom = Math.random) {
420
+ return new IterableCollection(new _module_2.ShuffleIterable(this, mathRandom));
443
421
  }
444
- first(settings) {
422
+ first(predicateFn) {
445
423
  try {
446
- return this.firstOr({
447
- ...settings,
448
- defaultValue: null,
449
- });
424
+ return this.firstOr(null, predicateFn);
450
425
  }
451
426
  catch (error) {
452
- if (error instanceof _module_1.CollectionError ||
453
- error instanceof TypeError) {
427
+ if (error instanceof _module_1.CollectionError) {
454
428
  throw error;
455
429
  }
456
430
  throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
457
431
  }
458
432
  }
459
- firstOr(settings) {
433
+ firstOr(defaultValue, predicateFn = () => true) {
460
434
  try {
461
- const throwOnIndexOverflow = settings.throwOnIndexOverflow ??
462
- IterableCollection.THROW_ON_NUMBER_LIMIT;
463
435
  let index = 0;
464
- const predicateFn = settings.predicateFn ?? (() => true);
465
436
  for (const item of this) {
466
- if (throwOnIndexOverflow && index === Number.MAX_SAFE_INTEGER) {
467
- throw new _module_1.IndexOverflowError("Index has overflowed");
468
- }
469
437
  if (predicateFn(item, index, this)) {
470
438
  return item;
471
439
  }
472
440
  index++;
473
441
  }
474
- if (typeof settings.defaultValue === "function") {
475
- const defaultFn = settings.defaultValue;
476
- return defaultFn();
477
- }
478
- return settings.defaultValue;
442
+ return (0, utilities_1.simplifyLazyable)(defaultValue);
479
443
  }
480
444
  catch (error) {
481
- if (error instanceof _module_1.CollectionError ||
482
- error instanceof TypeError) {
445
+ if (error instanceof _module_1.CollectionError) {
483
446
  throw error;
484
447
  }
485
448
  throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
486
449
  }
487
450
  }
488
- firstOrFail(settings) {
489
- const item = this.first(settings);
451
+ firstOrFail(predicateFn) {
452
+ const item = this.first(predicateFn);
490
453
  if (item === null) {
491
- throw new _module_1.ItemNotFoundError("Item was not found");
454
+ throw new _module_1.ItemNotFoundCollectionError("Item was not found");
492
455
  }
493
456
  return item;
494
457
  }
495
- last(settings) {
458
+ last(predicateFn) {
496
459
  try {
497
- return this.lastOr({
498
- ...settings,
499
- defaultValue: null,
500
- });
460
+ return this.lastOr(null, predicateFn);
501
461
  }
502
462
  catch (error) {
503
- if (error instanceof _module_1.CollectionError ||
504
- error instanceof TypeError) {
463
+ if (error instanceof _module_1.CollectionError) {
505
464
  throw error;
506
465
  }
507
466
  throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
508
467
  }
509
468
  }
510
- lastOr(settings) {
469
+ lastOr(defaultValue, predicateFn = () => true) {
511
470
  try {
512
- const throwOnIndexOverflow = settings.throwOnIndexOverflow ??
513
- IterableCollection.THROW_ON_NUMBER_LIMIT;
514
471
  let index = 0;
515
- const predicateFn = settings.predicateFn ?? (() => true);
516
472
  let matchedItem = null;
517
473
  for (const item of this) {
518
- if (throwOnIndexOverflow && index === Number.MAX_SAFE_INTEGER) {
519
- throw new _module_1.IndexOverflowError("Index has overflowed");
520
- }
521
474
  if (predicateFn(item, index, this)) {
522
475
  matchedItem = item;
523
476
  }
@@ -526,124 +479,99 @@ class IterableCollection {
526
479
  if (matchedItem) {
527
480
  return matchedItem;
528
481
  }
529
- if (typeof settings.defaultValue === "function") {
530
- const defaultFn = settings.defaultValue;
531
- return defaultFn();
532
- }
533
- return settings.defaultValue;
482
+ return (0, utilities_1.simplifyLazyable)(defaultValue);
534
483
  }
535
484
  catch (error) {
536
- if (error instanceof _module_1.CollectionError ||
537
- error instanceof TypeError) {
485
+ if (error instanceof _module_1.CollectionError) {
538
486
  throw error;
539
487
  }
540
488
  throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
541
489
  }
542
490
  }
543
- lastOrFail(settings) {
544
- const item = this.last(settings);
491
+ lastOrFail(predicateFn) {
492
+ const item = this.last(predicateFn);
545
493
  if (item === null) {
546
- throw new _module_1.ItemNotFoundError("Item was not found");
494
+ throw new _module_1.ItemNotFoundCollectionError("Item was not found");
547
495
  }
548
496
  return item;
549
497
  }
550
- before(predicateFn, throwOnIndexOverflow = IterableCollection.THROW_ON_NUMBER_LIMIT) {
551
- return this.beforeOr(null, predicateFn, throwOnIndexOverflow);
498
+ before(predicateFn) {
499
+ return this.beforeOr(null, predicateFn);
552
500
  }
553
- beforeOr(defaultValue, predicateFn, throwOnIndexOverflow = IterableCollection.THROW_ON_NUMBER_LIMIT) {
501
+ beforeOr(defaultValue, predicateFn) {
554
502
  try {
555
503
  let beforeItem = null, index = 0;
556
504
  for (const item of this) {
557
- if (throwOnIndexOverflow && index === Number.MAX_SAFE_INTEGER) {
558
- throw new _module_1.IndexOverflowError("Index has overflowed");
559
- }
560
505
  if (predicateFn(item, index, this) && beforeItem) {
561
506
  return beforeItem;
562
507
  }
563
508
  index++;
564
509
  beforeItem = item;
565
510
  }
566
- if (typeof defaultValue === "function") {
567
- const defaultFn = defaultValue;
568
- return defaultFn();
569
- }
570
- return defaultValue;
511
+ return (0, utilities_1.simplifyLazyable)(defaultValue);
571
512
  }
572
513
  catch (error) {
573
- if (error instanceof _module_1.CollectionError ||
574
- error instanceof TypeError) {
514
+ if (error instanceof _module_1.CollectionError) {
575
515
  throw error;
576
516
  }
577
517
  throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
578
518
  }
579
519
  }
580
- beforeOrFail(predicateFn, throwOnIndexOverflow = IterableCollection.THROW_ON_NUMBER_LIMIT) {
581
- const item = this.before(predicateFn, throwOnIndexOverflow);
520
+ beforeOrFail(predicateFn) {
521
+ const item = this.before(predicateFn);
582
522
  if (item === null) {
583
- throw new _module_1.ItemNotFoundError("Item was not found");
523
+ throw new _module_1.ItemNotFoundCollectionError("Item was not found");
584
524
  }
585
525
  return item;
586
526
  }
587
- after(predicateFn, throwOnIndexOverflow = IterableCollection.THROW_ON_NUMBER_LIMIT) {
588
- return this.afterOr(null, predicateFn, throwOnIndexOverflow);
527
+ after(predicateFn) {
528
+ return this.afterOr(null, predicateFn);
589
529
  }
590
- afterOr(defaultValue, predicateFn, throwOnIndexOverflow = IterableCollection.THROW_ON_NUMBER_LIMIT) {
530
+ afterOr(defaultValue, predicateFn) {
591
531
  try {
592
532
  let hasMatched = false, index = 0;
593
533
  for (const item of this) {
594
534
  if (hasMatched) {
595
535
  return item;
596
536
  }
597
- if (throwOnIndexOverflow && index === Number.MAX_SAFE_INTEGER) {
598
- throw new _module_1.IndexOverflowError("Index has overflowed");
599
- }
600
537
  hasMatched = predicateFn(item, index, this);
601
538
  index++;
602
539
  }
603
- if (typeof defaultValue === "function") {
604
- const defaultFn = defaultValue;
605
- return defaultFn();
606
- }
607
- return defaultValue;
540
+ return (0, utilities_1.simplifyLazyable)(defaultValue);
608
541
  }
609
542
  catch (error) {
610
- if (error instanceof _module_1.CollectionError ||
611
- error instanceof TypeError) {
543
+ if (error instanceof _module_1.CollectionError) {
612
544
  throw error;
613
545
  }
614
546
  throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
615
547
  }
616
548
  }
617
- afterOrFail(predicateFn, throwOnIndexOverflow = IterableCollection.THROW_ON_NUMBER_LIMIT) {
618
- const item = this.after(predicateFn, throwOnIndexOverflow);
549
+ afterOrFail(predicateFn) {
550
+ const item = this.after(predicateFn);
619
551
  if (item === null) {
620
- throw new _module_1.ItemNotFoundError("Item was not found");
552
+ throw new _module_1.ItemNotFoundCollectionError("Item was not found");
621
553
  }
622
554
  return item;
623
555
  }
624
- sole(predicateFn, throwOnIndexOverflow = IterableCollection.THROW_ON_NUMBER_LIMIT) {
556
+ sole(predicateFn) {
625
557
  try {
626
558
  let index = 0, matchedItem = null;
627
559
  for (const item of this) {
628
- if (throwOnIndexOverflow && index === Number.MAX_SAFE_INTEGER) {
629
- throw new _module_1.IndexOverflowError("Index has overflowed");
630
- }
631
560
  if (predicateFn(item, index, this)) {
632
561
  if (matchedItem !== null) {
633
- throw new _module_1.MultipleItemsFoundError("Multiple items were found");
562
+ throw new _module_1.MultipleItemsFoundCollectionError("Multiple items were found");
634
563
  }
635
564
  matchedItem = item;
636
565
  }
637
566
  index++;
638
567
  }
639
568
  if (matchedItem === null) {
640
- throw new _module_1.ItemNotFoundError("Item was not found");
569
+ throw new _module_1.ItemNotFoundCollectionError("Item was not found");
641
570
  }
642
571
  return matchedItem;
643
572
  }
644
573
  catch (error) {
645
- if (error instanceof _module_1.CollectionError ||
646
- error instanceof TypeError) {
574
+ if (error instanceof _module_1.CollectionError) {
647
575
  throw error;
648
576
  }
649
577
  throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
@@ -652,13 +580,10 @@ class IterableCollection {
652
580
  nth(step) {
653
581
  return this.filter((_item, index) => index % step === 0);
654
582
  }
655
- count(predicateFn, throwOnIndexOverflow = IterableCollection.THROW_ON_NUMBER_LIMIT) {
583
+ count(predicateFn) {
656
584
  try {
657
585
  let size = 0;
658
586
  for (const item of this) {
659
- if (throwOnIndexOverflow && size === Number.MAX_SAFE_INTEGER) {
660
- throw new _module_1.IndexOverflowError("Size has overflowed");
661
- }
662
587
  if (predicateFn(item, size, this)) {
663
588
  size++;
664
589
  }
@@ -666,15 +591,14 @@ class IterableCollection {
666
591
  return size;
667
592
  }
668
593
  catch (error) {
669
- if (error instanceof _module_1.CollectionError ||
670
- error instanceof TypeError) {
594
+ if (error instanceof _module_1.CollectionError) {
671
595
  throw error;
672
596
  }
673
597
  throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
674
598
  }
675
599
  }
676
- size(throwOnIndexOverflow = IterableCollection.THROW_ON_NUMBER_LIMIT) {
677
- return this.count(() => true, throwOnIndexOverflow);
600
+ size() {
601
+ return this.count(() => true);
678
602
  }
679
603
  isEmpty() {
680
604
  try {
@@ -684,8 +608,7 @@ class IterableCollection {
684
608
  return true;
685
609
  }
686
610
  catch (error) {
687
- if (error instanceof _module_1.CollectionError ||
688
- error instanceof TypeError) {
611
+ if (error instanceof _module_1.CollectionError) {
689
612
  throw error;
690
613
  }
691
614
  throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
@@ -694,13 +617,10 @@ class IterableCollection {
694
617
  isNotEmpty() {
695
618
  return !this.isEmpty();
696
619
  }
697
- searchFirst(predicateFn, throwOnIndexOverflow = IterableCollection.THROW_ON_NUMBER_LIMIT) {
620
+ searchFirst(predicateFn) {
698
621
  try {
699
622
  let index = 0;
700
623
  for (const item of this) {
701
- if (throwOnIndexOverflow && index === Number.MAX_SAFE_INTEGER) {
702
- throw new _module_1.IndexOverflowError("Index has overflowed");
703
- }
704
624
  if (predicateFn(item, index, this)) {
705
625
  return index;
706
626
  }
@@ -709,21 +629,17 @@ class IterableCollection {
709
629
  return -1;
710
630
  }
711
631
  catch (error) {
712
- if (error instanceof _module_1.CollectionError ||
713
- error instanceof TypeError) {
632
+ if (error instanceof _module_1.CollectionError) {
714
633
  throw error;
715
634
  }
716
635
  throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
717
636
  }
718
637
  }
719
- searchLast(predicateFn, throwOnIndexOverflow = IterableCollection.THROW_ON_NUMBER_LIMIT) {
638
+ searchLast(predicateFn) {
720
639
  try {
721
640
  let index = 0;
722
641
  let matchedIndex = -1;
723
642
  for (const item of this) {
724
- if (throwOnIndexOverflow && index === Number.MAX_SAFE_INTEGER) {
725
- throw new _module_1.IndexOverflowError("Index has overflowed");
726
- }
727
643
  if (predicateFn(item, index, this)) {
728
644
  matchedIndex = index;
729
645
  }
@@ -732,27 +648,22 @@ class IterableCollection {
732
648
  return matchedIndex;
733
649
  }
734
650
  catch (error) {
735
- if (error instanceof _module_1.CollectionError ||
736
- error instanceof TypeError) {
651
+ if (error instanceof _module_1.CollectionError) {
737
652
  throw error;
738
653
  }
739
654
  throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
740
655
  }
741
656
  }
742
- forEach(callback, throwOnIndexOverflow = IterableCollection.THROW_ON_NUMBER_LIMIT) {
657
+ forEach(callback) {
743
658
  try {
744
659
  let index = 0;
745
660
  for (const item of this) {
746
- if (throwOnIndexOverflow && index === Number.MAX_SAFE_INTEGER) {
747
- throw new _module_1.IndexOverflowError("Index has overflowed");
748
- }
749
661
  callback(item, index, this);
750
662
  index++;
751
663
  }
752
664
  }
753
665
  catch (error) {
754
- if (error instanceof _module_1.CollectionError ||
755
- error instanceof TypeError) {
666
+ if (error instanceof _module_1.CollectionError) {
756
667
  throw error;
757
668
  }
758
669
  throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
@@ -763,8 +674,7 @@ class IterableCollection {
763
674
  return [...this];
764
675
  }
765
676
  catch (error) {
766
- if (error instanceof _module_1.CollectionError ||
767
- error instanceof TypeError) {
677
+ if (error instanceof _module_1.CollectionError) {
768
678
  throw error;
769
679
  }
770
680
  throw new _module_1.UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);