@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,18 +1,17 @@
1
1
  /**
2
2
  * @module Collections
3
3
  */
4
- import { type SliceSettings, type SlidingSettings, type AsyncPredicate, type AsyncFindOrSettings, type AsyncFindSettings, type AsyncForEach, type AsyncGroupBySettings, type AsyncCountBySettings, type AsyncUniqueSettings, type AsyncLazyable, type AsyncMap, type AsyncModifier, type AsyncReduceSettings, type AsyncTap, type AsyncTransform, type Comparator, type JoinSettings, type PageSettings, type RecordItem, type ReverseSettings, type UpdatedItem } from "../../contracts/collection/_shared";
5
- import { type EnsureType } from "../../_shared/types";
6
- export type AsyncIterableValue<TInput> = Iterable<TInput> | AsyncIterable<TInput>;
4
+ import { type AsyncPredicate, type AsyncForEach, type AsyncMap, type AsyncModifier, type AsyncTap, type AsyncTransform, type Comparator, type ChangendItem, AsyncReduce, CrossJoinResult } from "../../contracts/collection/_shared";
5
+ import { type RecordItem, type AsyncLazyable, type EnsureType, type AsyncIterableValue } from "../../_shared/types";
7
6
  export type AsyncCollapse<TValue> = TValue extends Array<infer TItem> | Iterable<infer TItem> | IAsyncCollection<infer TItem> ? TItem : TValue;
8
7
  /**
9
- * <i>IAsyncCollection</i> is immutable. The <i>throwOnIndexOverflow</i> parameter in the <i>ICollection</i> methods is used for preventing the index to overflow by throwing an error.
10
- * @throws {CollectionError}
8
+ * <i>IAsyncCollection</i> is immutable. The <i>throwOnIndexOverflow</i> parameter in the <i>IAsyncCollection</i> methods is used for preventing the index to overflow by throwing an error.
9
+ * @throws {CollectionError} {@link CollectionError}
11
10
  * @throws {UnexpectedCollectionError}
12
- * @throws {IndexOverflowError}
13
- * @throws {ItemNotFoundError}
14
- * @throws {MultipleItemsFoundError}
15
- * @throws {TypeError}
11
+ * @throws {ItemNotFoundCollectionError}
12
+ * @throws {MultipleItemsFoundCollectionError}
13
+ * @throws {TypeCollectionError}
14
+ * @throws {EmptyCollectionError}
16
15
  * @group Contracts
17
16
  */
18
17
  export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
@@ -23,11 +22,11 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
23
22
  /**
24
23
  * The <i>entries</i> returns an IAsyncCollection of key, value pairs for every entry in the collection.
25
24
  */
26
- entries(throwOnIndexOverflow?: boolean): IAsyncCollection<RecordItem<number, TInput>>;
25
+ entries(): IAsyncCollection<RecordItem<number, TInput>>;
27
26
  /**
28
27
  * The <i>keys</i> method returns an IAsyncCollection of keys in the collection.
29
28
  */
30
- keys(throwOnIndexOverflow?: boolean): IAsyncCollection<number>;
29
+ keys(): IAsyncCollection<number>;
31
30
  /**
32
31
  * The <i>values</i> method returns a copy of the collection.
33
32
  */
@@ -35,70 +34,84 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
35
34
  /**
36
35
  * The <i>filter</i> method filters the collection using <i>predicateFn</i>, keeping only those items that pass <i>predicateFn</i>.
37
36
  * @example
37
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
38
+ *
38
39
  * const collection = new AsyncIterableCollection([1, 2, 3, 4, 5, 6]);
39
40
  * const filtered = collection.filter(item => 2 < item && item < 5);
40
41
  * await filtered.toArray();
41
42
  * // [3, 4]
42
43
  */
43
- filter<TOutput extends TInput>(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>, throwOnIndexOverflow?: boolean): IAsyncCollection<TOutput>;
44
+ filter<TOutput extends TInput>(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>): IAsyncCollection<TOutput>;
44
45
  /**
45
46
  * The <i>reject</i> method filters the collection using <i>predicateFn</i>, keeping only those items that not pass <i>predicateFn</i>.
46
47
  * @example
48
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
49
+ *
47
50
  * const collection = new AsyncIterableCollection([1, 2, 3, 4, 5, 6]);
48
51
  * const filtered = collection.reject(item => 2 < item && item < 5);
49
52
  * await filtered.toArray();
50
53
  * // [1, 2, 5, 6]
51
54
  */
52
- reject<TOutput extends TInput>(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>, throwOnIndexOverflow?: boolean): IAsyncCollection<Exclude<TInput, TOutput>>;
55
+ reject<TOutput extends TInput>(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>): IAsyncCollection<Exclude<TInput, TOutput>>;
53
56
  /**
54
57
  * The <i>map</i> method iterates through the collection and passes each item to <i>mapFn</i>.
55
58
  * The <i>mapFn</i> is free to modify the item and return it, thus forming a new collection of modified items.
56
59
  * @example
60
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
61
+ *
57
62
  * const collection = new AsyncIterableCollection([1, 2, 3, 4, 5]);
58
63
  * const mapped = collection.map(item => item * 2);
59
64
  * await mapped.toArray();
60
65
  * // [2, 4, 6, 8, 10]
61
66
  */
62
- map<TOutput>(mapFn: AsyncMap<TInput, IAsyncCollection<TInput>, TOutput>, throwOnIndexOverflow?: boolean): IAsyncCollection<TOutput>;
67
+ map<TOutput>(mapFn: AsyncMap<TInput, IAsyncCollection<TInput>, TOutput>): IAsyncCollection<TOutput>;
63
68
  /**
64
- * The <i>reduce</i> method executes <i> {@link ReduceSettings | ReduceSettings.reduceFn} </i> function on each item of the array, passing in the return value from the calculation on the preceding item.
69
+ * The <i>reduce</i> method executes <i> reduceFn </i> function on each item of the array, passing in the return value from the calculation on the preceding item.
65
70
  * The final result of running the reducer across all items of the array is a single value.
66
71
  * @example
72
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
73
+ *
67
74
  * const collection = new AsyncIterableCollection([1, 2, 3]);
68
- * await collection.reduce({
69
- * reduceFn: (sum, item) => sum + item
70
- * });
75
+ * await collection.reduce((sum, item) => sum + item);
71
76
  * // 6
72
77
  * @example
78
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
79
+ *
73
80
  * const collection = new AsyncIterableCollection(["a", "b", "c"]);
74
- * await collection.entries().reduce({
75
- * reduceFn: (record, [key, value]) => ({
81
+ * await collection.entries().reduce(
82
+ * (record, [key, value]) => ({
76
83
  * ...record,
77
84
  * [key]: value
78
85
  * }),
79
- * initialValue: {} as Record<number, string>
80
- * });
86
+ * {} as Record<number, string>
87
+ * );
81
88
  * // { 0: "a", 1: "b", 2: "c" }
82
89
  */
83
- reduce<TOutput = TInput>(settings: AsyncReduceSettings<TInput, IAsyncCollection<TInput>, TOutput>): Promise<TOutput>;
90
+ reduce(reduceFn: AsyncReduce<TInput, IAsyncCollection<TInput>, TInput>): Promise<TInput>;
91
+ reduce(reduceFn: AsyncReduce<TInput, IAsyncCollection<TInput>, TInput>, initialValue: TInput): Promise<TInput>;
92
+ reduce<TOutput>(reduceFn: AsyncReduce<TInput, IAsyncCollection<TInput>, TOutput>, initialValue: TOutput): Promise<TOutput>;
84
93
  /**
85
- * The <i>join</i> method joins the collection's items with {@link JoinSettings | JoinSettings.seperator}. An error will be thrown when if a none string item is encounterd.
86
- * @throws {TypeError}
94
+ * The <i>join</i> method joins the collection's items with <i> separator </i>. An error will be thrown when if a none string item is encounterd.
95
+ * @throws {TypeCollectionError}
87
96
  * @example
97
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
98
+ *
88
99
  * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
89
100
  * await collection.map(item => item.toString()).join();
90
101
  * // "1,2,3,4"
91
102
  * @example
103
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
104
+ *
92
105
  * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
93
- * await collection.map(item => item.toString()).join({
94
- * seperator: "_"
95
- * });
106
+ * await collection.map(item => item.toString()).join("_");
96
107
  * // "1_2_3_4"
97
108
  */
98
- join(settings?: JoinSettings): Promise<EnsureType<TInput, string>>;
109
+ join(separator?: string): Promise<EnsureType<TInput, string>>;
99
110
  /**
100
111
  * The <i>collapse</i> method collapses a collection of iterables into a single, flat collection.
101
112
  * @example
113
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
114
+ *
102
115
  * const collection = new AsyncIterableCollection([[1, 2], [3, 4]]);
103
116
  * const collapsed = collection.collapse();
104
117
  * await collapsed.toArray();
@@ -109,180 +122,217 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
109
122
  * The <i>flatMap</i> method returns a new array formed by applying <i>mapFn</i> to each item of the array, and then collapses the result by one level.
110
123
  * It is identical to a <i>map</i> method followed by a <i>collapse</i> method.
111
124
  * @example
125
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
126
+ *
112
127
  * const collection = new AsyncIterableCollection([["a", "b"], ["c", "d"]]).flatMap(item => [item.length, ...item]);
113
128
  * await collection.toArray();
114
129
  * // [2, "a", "b", 2, "c", "d"]
115
130
  */
116
- flatMap<TOutput>(mapFn: AsyncMap<TInput, IAsyncCollection<TInput>, Iterable<TOutput>>, throwOnIndexOverflow?: boolean): IAsyncCollection<TOutput>;
131
+ flatMap<TOutput>(mapFn: AsyncMap<TInput, IAsyncCollection<TInput>, Iterable<TOutput>>): IAsyncCollection<TOutput>;
117
132
  /**
118
- * The <i>update</i> method updates only the items that passes <i>predicateFn</i> using <i>mapFn</i>.
133
+ * The <i>change</i> method changes only the items that passes <i>predicateFn</i> using <i>mapFn</i>.
119
134
  * @example
135
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
136
+ *
120
137
  * const collection = new AsyncIterableCollection([1, 2, 3, 4, 5]);
121
- * const updateCollection = collection.update(item => item % 2 === 0, item => item * 2);
122
- * await updateCollection.toArray();
138
+ * const newCollection = collection.change(item => item % 2 === 0, item => item * 2);
139
+ * await newCollection.toArray();
123
140
  * // [1, 4, 3, 8, 5]
124
141
  */
125
- update<TFilterOutput extends TInput, TMapOutput>(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>, TFilterOutput>, mapFn: AsyncMap<TFilterOutput, IAsyncCollection<TInput>, TMapOutput>, throwOnIndexOverflow?: boolean): IAsyncCollection<UpdatedItem<TInput, TFilterOutput, TMapOutput>>;
142
+ change<TFilterOutput extends TInput, TMapOutput>(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>, TFilterOutput>, mapFn: AsyncMap<TFilterOutput, IAsyncCollection<TInput>, TMapOutput>): IAsyncCollection<ChangendItem<TInput, TFilterOutput, TMapOutput>>;
126
143
  /**
127
- * The <i>page</i> method returns a new collection containing the items that would be present on <i>{@link PageSettings | PageSettings.page}</i> with custom <i>{@link PageSettings | PageSettings.pageSize}</i>.
144
+ * The <i>page</i> method returns a new collection containing the items that would be present on <i> page </i> with custom <i> pageSize </i>.
128
145
  * @example
146
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
147
+ *
129
148
  * const collection = new AsyncIterableCollection([1, 2, 3, 4, 5, 6, 7, 8, 9]);
130
- * const page = collection.page({
131
- * page: 2,
132
- * pageSize: 3
133
- * });
149
+ * const page = collection.page(2, 3);
134
150
  * await page.toArray();
135
151
  * // [4, 5, 6]
136
152
  */
137
- page(settings: PageSettings): IAsyncCollection<TInput>;
153
+ page(page: number, pageSize: number): IAsyncCollection<TInput>;
138
154
  /**
139
155
  * The <i>sum</i> method returns the sum of all items in the collection. If the collection includes other than number items an error will be thrown.
140
156
  * @example
157
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
158
+ *
141
159
  * const collection = new AsyncIterableCollection([1, 2, 3]);
142
160
  * await collection.sum();
143
161
  * // 6
144
162
  * @throws {CollectionError} {@link CollectionError}
145
163
  * @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
146
- * @throws {TypeError} {@link TypeError}
164
+ * @throws {TypeCollectionError} {@link TypeCollectionError}
165
+ * @throws {EmptyCollectionError} {@link EmptyCollectionError}
147
166
  */
148
167
  sum(): Promise<EnsureType<TInput, number>>;
149
168
  /**
150
169
  * The <i>average</i> method returns the average of all items in the collection. If the collection includes other than number items an error will be thrown.
151
170
  * @example
171
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
172
+ *
152
173
  * const collection = new AsyncIterableCollection([1, 2, 3]);
153
174
  * await collection.average();
154
175
  * // 2
155
176
  * @throws {CollectionError} {@link CollectionError}
156
177
  * @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
157
- * @throws {TypeError} {@link TypeError}
178
+ * @throws {TypeCollectionError} {@link TypeCollectionError}
179
+ * @throws {EmptyCollectionError} {@link EmptyCollectionError}
158
180
  */
159
181
  average(): Promise<EnsureType<TInput, number>>;
160
182
  /**
161
183
  * The <i>median</i> method returns the median of all items in the collection. If the collection includes other than number items an error will be thrown.
162
184
  * @example
185
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
186
+ *
163
187
  * const collection = new AsyncIterableCollection([1, 2, 3]);
164
188
  * await collection.median();
165
189
  * // 2
166
190
  * @throws {CollectionError} {@link CollectionError}
167
191
  * @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
168
- * @throws {IndexOverflowError} {@link IndexOverflowError}
169
- * @throws {TypeError} {@link TypeError}
192
+ * @throws {TypeCollectionError} {@link TypeCollectionError}
193
+ * @throws {EmptyCollectionError} {@link EmptyCollectionError}
170
194
  */
171
- median(throwOnIndexOverflow?: boolean): Promise<EnsureType<TInput, number>>;
195
+ median(): Promise<EnsureType<TInput, number>>;
172
196
  /**
173
197
  * The <i>min</i> method returns the min of all items in the collection. If the collection includes other than number items an error will be thrown.
174
198
  * @example
199
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
200
+ *
175
201
  * const collection = new AsyncIterableCollection([1, 2, 3]);
176
202
  * await collection.min();
177
203
  * // 1
178
204
  * @throws {CollectionError} {@link CollectionError}
179
205
  * @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
180
- * @throws {TypeError} {@link TypeError}
206
+ * @throws {TypeCollectionError} {@link TypeCollectionError}
207
+ * @throws {EmptyCollectionError} {@link EmptyCollectionError}
181
208
  */
182
209
  min(): Promise<EnsureType<TInput, number>>;
183
210
  /**
184
211
  * The <i>max</i> method returns the max of all items in the collection. If the collection includes other than number items an error will be thrown.
185
212
  * @example
213
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
214
+ *
186
215
  * const collection = new AsyncIterableCollection([1, 2, 3]);
187
216
  * await collection.max();
188
217
  * // 3
189
218
  * @throws {CollectionError} {@link CollectionError}
190
219
  * @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
191
- * @throws {TypeError} {@link TypeError}
220
+ * @throws {TypeCollectionError} {@link TypeCollectionError}
221
+ * @throws {EmptyCollectionError} {@link EmptyCollectionError}
192
222
  */
193
223
  max(): Promise<EnsureType<TInput, number>>;
194
224
  /**
195
225
  * The <i>percentage</i> method may be used to quickly determine the percentage of items in the collection that pass <i>predicateFn</i>.
196
226
  * @example
227
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
228
+ *
197
229
  * const collection = new AsyncIterableCollection([1, 1, 2, 2, 2, 3]);
198
230
  * await collection.percentage(value => value === 1);
199
231
  * // 33.333
200
232
  * @throws {CollectionError} {@link CollectionError}
201
233
  * @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
202
- * @throws {IndexOverflowError} {@link IndexOverflowError}
234
+ * @throws {EmptyCollectionError} {@link EmptyCollectionError}
203
235
  */
204
- percentage(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>, throwOnIndexOverflow?: boolean): Promise<number>;
236
+ percentage(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): Promise<number>;
205
237
  /**
206
238
  * The <i>some</i> method determines whether at least one item in the collection matches <i>predicateFn</i>.
207
239
  * @example
240
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
241
+ *
208
242
  * const collection = new AsyncIterableCollection([0, 1, 2, 3, 4, 5]);
209
243
  * await collection.some(item => item === 1);
210
244
  * // true
211
245
  * @throws {CollectionError} {@link CollectionError}
212
246
  * @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
213
- * @throws {IndexOverflowError} {@link IndexOverflowError}
214
247
  */
215
- some<TOutput extends TInput>(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>, throwOnIndexOverflow?: boolean): Promise<boolean>;
248
+ some<TOutput extends TInput>(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>): Promise<boolean>;
216
249
  /**
217
250
  * The <i>every</i> method determines whether all items in the collection matches <i>predicateFn</i>.
218
251
  * @example
252
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
253
+ *
219
254
  * const collection = new AsyncIterableCollection([0, 1, 2, 3, 4, 5]);
220
255
  * await collection.every(item => item < 6);
221
256
  * // true
222
257
  * @throws {CollectionError} {@link CollectionError}
223
258
  * @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
224
- * @throws {IndexOverflowError} {@link IndexOverflowError}
225
259
  */
226
- every<TOutput extends TInput>(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>, throwOnIndexOverflow?: boolean): Promise<boolean>;
260
+ every<TOutput extends TInput>(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>): Promise<boolean>;
227
261
  /**
228
262
  * The <i>take</i> method takes the first <i>limit</i> items.
229
263
  * @example
264
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
265
+ *
230
266
  * const collection = new AsyncIterableCollection([0, 1, 2, 3, 4, 5]);
231
267
  * const chunk = collection.take(3);
232
268
  * await chunk.toArray();
233
269
  * // [0, 1, 2]
234
270
  * @example
271
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
272
+ *
235
273
  * const collection = new AsyncIterableCollection([0, 1, 2, 3, 4, 5]);
236
274
  * const chunk = collection.take(-2);
237
275
  * await chunk.toArray();
238
- * // [4, 5]
276
+ * // [0, 1, 2, 3]
239
277
  */
240
- take(limit: number, throwOnIndexOverflow?: boolean): IAsyncCollection<TInput>;
278
+ take(limit: number): IAsyncCollection<TInput>;
241
279
  /**
242
280
  * The <i>takeUntil</i> method takes items until <i>predicateFn</i> returns true.
243
281
  * @example
282
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
283
+ *
244
284
  * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
245
285
  * const chunk = collection.takeUntil(item => item >= 3);
246
286
  * await chunk.toArray();
247
287
  * // [1, 2]
248
288
  */
249
- takeUntil(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>, throwOnIndexOverflow?: boolean): IAsyncCollection<TInput>;
289
+ takeUntil(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): IAsyncCollection<TInput>;
250
290
  /**
251
291
  * The <i>takeWhile</i> method takes items until <i>predicateFn</i> returns false.
252
292
  * @example
293
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
294
+ *
253
295
  * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
254
296
  * const chunk = collection.takeWhile(item => item < 4);
255
297
  * await chunk.toArray();
256
298
  * // [1, 2, 3]
257
299
  */
258
- takeWhile(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>, throwOnIndexOverflow?: boolean): IAsyncCollection<TInput>;
300
+ takeWhile(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): IAsyncCollection<TInput>;
259
301
  /**
260
302
  * The <i>skip</i> method skips the first <i>offset</i> items.
261
303
  * @example
304
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
305
+ *
262
306
  * const collection = new AsyncIterableCollection([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]).skip(4);
263
307
  * await collection.toArray();
264
308
  * // [5, 6, 7, 8, 9, 10]
265
309
  */
266
- skip(offset: number, throwOnIndexOverflow?: boolean): IAsyncCollection<TInput>;
310
+ skip(offset: number): IAsyncCollection<TInput>;
267
311
  /**
268
312
  * The <i>skipUntil</i> method skips items until <i>predicateFn</i> returns true.
269
313
  * @example
314
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
315
+ *
270
316
  * const collection = new AsyncIterableCollection([1, 2, 3, 4]).skipUntil(item => item >= 3);
271
317
  * await collection.toArray();
272
318
  * // [3, 4]
273
319
  */
274
- skipUntil(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>, throwOnIndexOverflow?: boolean): IAsyncCollection<TInput>;
320
+ skipUntil(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): IAsyncCollection<TInput>;
275
321
  /**
276
322
  * The <i>skipWhile</i> method skips items until <i>predicateFn</i> returns false.
277
323
  * @example
324
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
325
+ *
278
326
  * const collection = new AsyncIterableCollection([1, 2, 3, 4]).skipWhile(item => item <= 3);
279
327
  * await collection.toArray();
280
328
  * // [4]
281
329
  */
282
- skipWhile(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>, throwOnIndexOverflow?: boolean): IAsyncCollection<TInput>;
330
+ skipWhile(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): IAsyncCollection<TInput>;
283
331
  /**
284
332
  * The <i>when</i> method will execute <i>callback</i> when <i>condition</i> evaluates to true.
285
333
  * @example
334
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
335
+ *
286
336
  * const collection = new AsyncIterableCollection([1, 2, 3, 4])
287
337
  * .when(true, collection => collection.append([-3]))
288
338
  * .when(false, collection => collection.append([20]));
@@ -293,11 +343,15 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
293
343
  /**
294
344
  * The <i>whenEmpty</i> method will execute <i>callback</i> when the collection is empty.
295
345
  * @example
346
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
347
+ *
296
348
  * const collection = new AsyncIterableCollection([])
297
349
  * .whenEmpty(collection => collection.append([-3]))
298
350
  * await collection.toArray();
299
351
  * // [-3]
300
352
  * @example
353
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
354
+ *
301
355
  * const collection = new AsyncIterableCollection([1])
302
356
  * .whenEmpty(collection => collection.append([-3]))
303
357
  * await collection.toArray();
@@ -307,6 +361,8 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
307
361
  /**
308
362
  * The <i>whenNot</i> method will execute <i>callback</i> when <i>condition</i> evaluates to false.
309
363
  * @example
364
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
365
+ *
310
366
  * const collection = new AsyncIterableCollection([1, 2, 3, 4])
311
367
  * .whenNot(true, collection => collection.append([-3]))
312
368
  * .whenNot(false, collection => collection.append([20]));
@@ -317,11 +373,15 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
317
373
  /**
318
374
  * The <i>whenNotEmpty</i> method will execute <i>callback</i> when the collection is not empty.
319
375
  * @example
376
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
377
+ *
320
378
  * const collection = new AsyncIterableCollection([])
321
379
  * .whenNotEmpty(collection => collection.append([-3]))
322
380
  * await collection.toArray();
323
381
  * // []
324
382
  * @example
383
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
384
+ *
325
385
  * const collection = new AsyncIterableCollection([1])
326
386
  * .whenNotEmpty(collection => collection.append([-3]))
327
387
  * await collection.toArray();
@@ -332,31 +392,36 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
332
392
  * The <i>pipe</i> method passes the orignal collection to <i>callback</i> and returns the result from <i>callback</i>.
333
393
  * This method is useful when you want compose multiple smaller functions.
334
394
  * @example
335
- * const collection = new AsyncIterableCollection([1, "2", "a", 1, 3, {}]);
395
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
336
396
  *
337
- * function toNbrs<TInput>(collection: IAsyncCollection<TInput>): IAsyncCollection<number> {
338
- * return collection.map(item => Number(item)).reject(nbr => Number.isNaN(nbr)))
397
+ * const collection = new AsyncIterableCollection([1, "2", "a", 1, 3, {}]);
398
+ * function toNbrs<TInput>(
399
+ * collection: IAsyncCollection<TInput>,
400
+ * ): IAsyncCollection<number> {
401
+ * return collection
402
+ * .map((item) => Number(item))
403
+ * .reject((nbr) => Number.isNaN(nbr));
339
404
  * }
340
- * function nbrToStr(collection: IAsyncCollection<number>): IAsyncCollection<string> {
341
- * return collection.map(nbr => String.fromCharCode(nbr)).repeat(2).join("_")
405
+ * function nbrToStr(collection: IAsyncCollection<number>): number[] {
406
+ * return collection.repeat(2).toArray();
342
407
  * }
343
- *
344
- * const piped = await collection
345
- * .pipe(toNbrs)
346
- * .then(nbrToStr);
347
- * // "\x01_\x02_\x01_\x03_\x01_\x02_\x01_\x03"
408
+ * const piped = await collection.pipe(toNbrs).then(nbrToStr);
409
+ * console.log(piped);
410
+ * // [ 1, 2, 1, 3 ]
348
411
  */
349
412
  pipe<TOutput = TInput>(callback: AsyncTransform<IAsyncCollection<TInput>, TOutput>): Promise<TOutput>;
350
413
  /**
351
414
  * The <i>tap</i> method passes a copy of the original collection to <i>callback</i>, allowing you to do something with the items while not affecting the original collection.
352
415
  * @example
353
- * const collection = new AsyncIterableCollection([1, 2, 3, 4, 5, 6])
416
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
417
+ *
418
+ * const collection = await new AsyncIterableCollection([1, 2, 3, 4, 5, 6])
354
419
  * .tap(collection => {
355
420
  * collection
356
421
  * .filter(value => value % 2 === 0)
357
422
  * .forEach(value => console.log(value))
358
- * });
359
- * await collection.toArray();
423
+ * })
424
+ * .toArray();
360
425
  * // [1, 2, 3, 4, 5, 6]
361
426
  */
362
427
  tap(callback: AsyncTap<IAsyncCollection<TInput>>): IAsyncCollection<TInput>;
@@ -364,9 +429,11 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
364
429
  * The <i>chunk</i> method breaks the collection into multiple, smaller collections of size <i>chunkSize</i>.
365
430
  * If <i>chunkSize</i> is not divisible with total number of items then the last chunk will contain the remaining items.
366
431
  * @example
432
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
433
+ *
367
434
  * const collection = new AsyncIterableCollection([1, 2, 3, 4, 5, 6, 7]);
368
435
  * const chunks = collection.chunk(4);
369
- * await chunks.toArray();
436
+ * await chunks.map(chunk => chunk.toArray()).toArray();
370
437
  * // [[1, 2, 3, 4], [5, 6, 7]]
371
438
  */
372
439
  chunk(chunkSize: number): IAsyncCollection<IAsyncCollection<TInput>>;
@@ -374,54 +441,69 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
374
441
  * The <i>chunkWhile</i> method breaks the collection into multiple, smaller collections based on the evaluation of <i>predicateFn</i>.
375
442
  * The chunk variable passed to the <i>predicateFn</i> may be used to inspect the previous item.
376
443
  * @example
444
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
445
+ *
377
446
  * const collection = new AsyncIterableCollection("AABBCCCD");
378
447
  * const chunks = collection.chunkWhile((value, index, chunk) => {
379
448
  * return value === chunk.last();
380
449
  * });
381
- * await chunks.toArray();
450
+ * await chunks.map(chunk => chunk.toArray()).toArray();
382
451
  * // [["A", "A"], ["B", "B"], ["C", "C", "C"], ["D"]]
383
452
  */
384
- chunkWhile(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>, throwOnIndexOverflow?: boolean): IAsyncCollection<IAsyncCollection<TInput>>;
453
+ chunkWhile(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): IAsyncCollection<IAsyncCollection<TInput>>;
385
454
  /**
386
455
  * The <i>split</i> method breaks a collection evenly into <i>chunkAmount</i> of chunks.
387
456
  * @example
457
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
458
+ *
388
459
  * const collection = new AsyncIterableCollection([1, 2, 3, 4, 5]);
389
460
  * const chunks = collection.split(3);
390
- * await chunks.toArray();
461
+ * await chunks.map(chunk => chunk.toArray()).toArray();
391
462
  * // [[1, 2], [3, 4], [5]]
392
463
  * @example
464
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
465
+ *
393
466
  * const collection = new AsyncIterableCollection([1, 2, 3, 4, 5, 6]);
394
467
  * const chunks = collection.split(3);
395
- * await chunks.toArray();
468
+ * await chunks.map(chunk => chunk.toArray()).toArray();
396
469
  * // [[1, 2], [3, 4], [5, 6]]
397
470
  * @example
471
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
472
+ *
398
473
  * const collection = new AsyncIterableCollection([1, 2, 3, 4, 5, 6, 7]);
399
474
  * const chunks = collection.split(3);
400
- * await chunks.toArray();
475
+ * await chunks.map(chunk => chunk.toArray()).toArray();
401
476
  * // [[1, 2, 7], [3, 4], [5, 6]]
402
477
  */
403
- split(chunkAmount: number, throwOnIndexOverflow?: boolean): IAsyncCollection<IAsyncCollection<TInput>>;
478
+ split(chunkAmount: number): IAsyncCollection<IAsyncCollection<TInput>>;
404
479
  /**
405
480
  * The <i>partition</i> method is used to separate items that pass <i>predicateFn</i> from those that do not.
406
481
  * @example
482
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
483
+ *
407
484
  * const collection = new AsyncIterableCollection([1, 2, 3, 4, 5, 6]);
408
- * collection.partition(item => item < 3);
409
- * await collection.toArray();
485
+ * const chunks = collection.partition(item => item < 3);
486
+ * await chunks.map(chunk => chunk.toArray()).toArray();
410
487
  * // [[1, 2], [3, 4, 5, 6]]
411
488
  */
412
- partition(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>, throwOnIndexOverflow?: boolean): IAsyncCollection<IAsyncCollection<TInput>>;
489
+ partition(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): IAsyncCollection<IAsyncCollection<TInput>>;
413
490
  /**
414
491
  * The <i>sliding</i> method returns a new collection of chunks representing a "sliding window" view of the items in the collection.
415
492
  * @example
416
- * const collection = new AsyncIterableCollection([1, 2, 3, 4, 5]).sliding(2);
417
- * await collection.toArray();
493
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
494
+ *
495
+ * const collection = new AsyncIterableCollection([1, 2, 3, 4, 5])
496
+ * const chunks = collection.sliding(2);
497
+ * await chunks.map(chunk => chunk.toArray()).toArray();
418
498
  * // [[1, 2], [2, 3], [3, 4], [4, 5]]
419
499
  */
420
- sliding(settings: SlidingSettings): IAsyncCollection<IAsyncCollection<TInput>>;
500
+ sliding(chunkSize: number, step?: number): IAsyncCollection<IAsyncCollection<TInput>>;
421
501
  /**
422
- * The <i>groupBy</i> method groups the collection's items by {@link GroupBySettings | GroupBySettings.selectFn}.
502
+ * The <i>groupBy</i> method groups the collection's items by <i> selectFn </i>.
423
503
  * By default the equality check occurs on the item.
424
504
  * @example
505
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
506
+ *
425
507
  * const collection = new AsyncIterableCollection(["a", "a", "a", "b", "b", "c"]);
426
508
  * const group = await collection
427
509
  * .groupBy()
@@ -442,11 +524,11 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
442
524
  * // ]
443
525
  * // ]
444
526
  * @example
527
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
528
+ *
445
529
  * const collection = new AsyncIterableCollection(["alice@gmail.com", "bob@yahoo.com", "carlos@gmail.com"]);
446
530
  * const group = await collection
447
- * .groupBy({
448
- * selectFn: item => item.split("@")[1]
449
- * })
531
+ * .groupBy(item => item.split("@")[1])
450
532
  * .map(([key, collection]) => [key, collection.toArray()])
451
533
  * .toArray();
452
534
  * // [
@@ -460,11 +542,13 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
460
542
  * // ]
461
543
  * // ]
462
544
  */
463
- groupBy<TOutput = TInput>(settings?: AsyncGroupBySettings<TInput, IAsyncCollection<TInput>, TOutput>): IAsyncCollection<RecordItem<TOutput, IAsyncCollection<TInput>>>;
545
+ groupBy<TOutput = TInput>(selectFn?: AsyncMap<TInput, IAsyncCollection<TInput>, TOutput>): IAsyncCollection<RecordItem<TOutput, IAsyncCollection<TInput>>>;
464
546
  /**
465
- * The <i>countBy</i> method counts the occurrences of values in the collection by {@link CountBySettings | CountBySettings.selectFn}.
547
+ * The <i>countBy</i> method counts the occurrences of values in the collection by <i> selectFn </i>.
466
548
  * By default the equality check occurs on the item.
467
549
  * @example
550
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
551
+ *
468
552
  * const collection = new AsyncIterableCollection(["a", "a", "a", "b", "b", "c"]);
469
553
  * const count = await collection
470
554
  * .countBy()
@@ -476,27 +560,30 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
476
560
  * // ["c", 1]
477
561
  * // ]
478
562
  * @example
563
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
564
+ *
479
565
  * const collection = new AsyncIterableCollection(["alice@gmail.com", "bob@yahoo.com", "carlos@gmail.com"]);
480
566
  * const count = await collection
481
- * .countBy({
482
- * selectFn: item => item.split("@")[1]
483
- * })
484
- * .map(([key, collection]) => [key, collection.toArray()])
567
+ * .countBy(item => item.split("@")[1])
485
568
  * .toArray();
486
569
  * // [
487
570
  * // ["gmail.com", 2],
488
571
  * // ["yahoo.com", 1]
489
572
  * // ]
490
573
  */
491
- countBy<TOutput = TInput>(settings?: AsyncCountBySettings<TInput, IAsyncCollection<TInput>, TOutput>): IAsyncCollection<RecordItem<TOutput, number>>;
574
+ countBy<TOutput = TInput>(selectFn?: AsyncMap<TInput, IAsyncCollection<TInput>, TOutput>): IAsyncCollection<RecordItem<TOutput, number>>;
492
575
  /**
493
- * The <i>unique</i> method removes all duplicate values from the collection by {@link UniqueSettings | UniqueSettings.selectFn}.
576
+ * The <i>unique</i> method removes all duplicate values from the collection by <i> selectFn </i>.
494
577
  * By default the equality check occurs on the item.
495
578
  * @example
579
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
580
+ *
496
581
  * const collection = new AsyncIterableCollection([1, 1, 2, 2, 3, 4, 2]);
497
582
  * await collection.unique().toArray();
498
583
  * // [1, 2, 3, 4]
499
584
  * @example
585
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
586
+ *
500
587
  * const collection = new AsyncIterableCollection([
501
588
  * { name: "iPhone 6", brand: "Apple", type: "phone" },
502
589
  * { name: "iPhone 5", brand: "Apple", type: "phone" },
@@ -512,16 +599,20 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
512
599
  * // { name: "Galaxy S6", brand: "Samsung", type: "phone" },
513
600
  * // ]
514
601
  */
515
- unique<TOutput = TInput>(settings?: AsyncUniqueSettings<TInput, IAsyncCollection<TInput>, TOutput>): IAsyncCollection<TInput>;
602
+ unique<TOutput = TInput>(selectFn?: AsyncMap<TInput, IAsyncCollection<TInput>, TOutput>): IAsyncCollection<TInput>;
516
603
  /**
517
604
  * The <i>difference</i> method will return the values in the original collection that are not present in <i>iterable</i>.
518
605
  * By default the equality check occurs on the item.
519
606
  * @example
607
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
608
+ *
520
609
  * const collection = new AsyncIterableCollection([1, 2, 2, 3, 4, 5]);
521
610
  * const difference = collection.difference([2, 4, 6, 8]);
522
611
  * await difference.toArray();
523
612
  * // [1, 3, 5]
524
613
  * @example
614
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
615
+ *
525
616
  * const collection = new AsyncIterableCollection([
526
617
  * { name: "iPhone 6", brand: "Apple", type: "phone" },
527
618
  * { name: "iPhone 5", brand: "Apple", type: "phone" },
@@ -546,6 +637,8 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
546
637
  /**
547
638
  * The <i>repeat</i> method will repeat the original collection <i>amount</i> times.
548
639
  * @example
640
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
641
+ *
549
642
  * const collection = new AsyncIterableCollection([1, 2, 3]);
550
643
  * const newCollection = collection.repeat(3);
551
644
  * await newCollection.toArray();
@@ -556,90 +649,86 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
556
649
  * The <i>padStart</i> method pads this collection with <i>fillItems</i> until the resulting collection size reaches <i>maxLength</i>.
557
650
  * The padding is applied from the start of this collection.
558
651
  * @example
559
- * const collection = new AsyncIterableCollection("abc").padStart(10, "foo");
560
- * await collection.join({ seperator: ""});
652
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
653
+ *
654
+ * await new AsyncIterableCollection("abc").padStart(10, "foo").join("");
561
655
  * // "foofoofabc"
562
- * @example
563
- * const collection = new AsyncIterableCollection("abc").padStart(6, "123465");
564
- * await collection.join({ seperator: ""});
656
+ *
657
+ * await new AsyncIterableCollection("abc").padStart(6, "123465").join("");
565
658
  * // "123abc"
566
- * @example
567
- * const collection = new AsyncIterableCollection("abc").padStart(8, "0");
568
- * await collection.join({ seperator: ""});
659
+ *
660
+ * await new AsyncIterableCollection("abc").padStart(8, "0").join("");
569
661
  * // "00000abc"
570
- * @example
571
- * const collection = new AsyncIterableCollection("abc").padStart(1, "_");
572
- * await collection.join({ seperator: ""});
662
+ *
663
+ * await new AsyncIterableCollection("abc").padStart(1, "_").join("");
573
664
  * // "abc"
574
665
  */
575
- padStart<TExtended = TInput>(maxLength: number, fillItems: Iterable<TExtended>): IAsyncCollection<TInput | TExtended>;
666
+ padStart<TExtended = TInput>(maxLength: number, fillItems: AsyncIterableValue<TExtended>): IAsyncCollection<TInput | TExtended>;
576
667
  /**
577
668
  * The <i>padEnd</i> method pads this collection with <i>fillItems</i> until the resulting collection size reaches <i>maxLength</i>.
578
669
  * The padding is applied from the end of this collection.
579
670
  * @example
580
- * const collection = new AsyncIterableCollection("abc").padEnd(10, "foo");
581
- * await collection.join({ seperator: ""});
671
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
672
+ *
673
+ * await new AsyncIterableCollection("abc").padEnd(10, "foo").join("");
582
674
  * // "abcfoofoof"
583
- * @example
584
- * const collection = new AsyncIterableCollection("abc").padEnd(6, "123465");
585
- * await collection.join({ seperator: ""});
675
+ *
676
+ * await new AsyncIterableCollection("abc").padEnd(6, "123465").join("");
586
677
  * // "abc123"
587
- * @example
588
- * const collection = new AsyncIterableCollection("abc").padEnd(8, "0");
589
- * await collection.join({ seperator: ""});
678
+ *
679
+ * await new AsyncIterableCollection("abc").padEnd(8, "0").join("");
590
680
  * // "abc00000"
591
- * @example
592
- * const collection = new AsyncIterableCollection("abc").padEnd(1, "_");
593
- * await collection.join({ seperator: ""});
681
+ *
682
+ * await new AsyncIterableCollection("abc").padEnd(1, "_").join("");
594
683
  * // "abc"
595
684
  */
596
- padEnd<TExtended = TInput>(maxLength: number, fillItems: Iterable<TExtended>): IAsyncCollection<TInput | TExtended>;
685
+ padEnd<TExtended = TInput>(maxLength: number, fillItems: AsyncIterableValue<TExtended>): IAsyncCollection<TInput | TExtended>;
597
686
  /**
598
- * The <i>slice</i> method creates porition of the original collection selected from {@link SliceSettings | SliceSettings.start} and {@link SliceSettings | SliceSettings.end}
599
- * where {@link SliceSettings | SliceSettings.start} and {@link SliceSettings | SliceSettings.end} (end not included) represent the index of items in the collection.
687
+ * The <i>slice</i> method creates porition of the original collection selected from <i>start</i> and <i>end</i>
688
+ * where <i>start</i> and <i>end</i> (end not included) represent the index of items in the collection.
600
689
  * @example
690
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
691
+ *
601
692
  * const collection = new AsyncIterableCollection(["a", "b", "c", "d", "e", "f"]);
602
- * await collection.slice({
603
- * start: 3
604
- * }).toArray();
693
+ * await collection.slice(3).toArray();
605
694
  * // ["d", "e", "f"]
606
695
  * @example
696
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
697
+ *
607
698
  * const collection = new AsyncIterableCollection(["a", "b", "c", "d", "e", "f"]);
608
- * await collection.slice({
609
- * end: 2,
610
- * }).toArray();
699
+ * await collection.slice(undefined, 2).toArray();
611
700
  * // ["a", "b"]
612
701
  * @example
702
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
703
+ *
613
704
  * const collection = new AsyncIterableCollection(["a", "b", "c", "d", "e", "f"]);
614
- * await collection.slice({
615
- * start: 2
616
- * end: 5,
617
- * }).toArray();
705
+ * await collection.slice(2, 5).toArray();
618
706
  * // ["c", "d", "e"]
619
707
  * @example
708
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
709
+ *
620
710
  * const collection = new AsyncIterableCollection(["a", "b", "c", "d", "e", "f"]);
621
- * await collection.slice({
622
- * start: -2
623
- * }).toArray();
711
+ * await collection.slice(-2).toArray();
624
712
  * // ["e", "f"]
625
713
  * @example
714
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
715
+ *
626
716
  * const collection = new AsyncIterableCollection(["a", "b", "c", "d", "e", "f"]);
627
- * await collection.slice({
628
- * end: -2
629
- * }).toArray();
717
+ * await collection.slice(undefined, -2).toArray();
630
718
  * // ["a", "b", "c", "d"]
631
719
  * @example
720
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
721
+ *
632
722
  * const collection = new AsyncIterableCollection(["a", "b", "c", "d", "e", "f"]);
633
- * await collection.slice({
634
- * start: -4,
635
- * end: -2
636
- * }).toArray();
723
+ * await collection.slice(-4, -2).toArray();
637
724
  * // ["c", "d"]
638
725
  */
639
- slice(settings?: SliceSettings): IAsyncCollection<TInput>;
726
+ slice(start?: number, end?: number): IAsyncCollection<TInput>;
640
727
  /**
641
728
  * The <i>prepend</i> method adds <i>iterable</i> to the beginning of the collection.
642
729
  * @example
730
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
731
+ *
643
732
  * const collection = new AsyncIterableCollection([1, 2, 3, 4, 5]).prepend([-1, 20]);
644
733
  * await collection.toArray();
645
734
  * // [-1, 20, 1, 2, 3, 4, 5]
@@ -648,6 +737,8 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
648
737
  /**
649
738
  * The <i>append</i> method adds <i>iterable</i> to the end of the collection.
650
739
  * @example
740
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
741
+ *
651
742
  * const collection = new AsyncIterableCollection([1, 2, 3, 4, 5]).append([-1, -2]);
652
743
  * await collection.toArray();
653
744
  * // [1, 2, 3, 4, 5, -1, -2,]
@@ -656,25 +747,31 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
656
747
  /**
657
748
  * The <i>insertBefore</i> method adds <i>iterable</i> before the first item that matches <i>predicateFn</i>.
658
749
  * @example
750
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
751
+ *
659
752
  * const collection = new AsyncIterableCollection([1, 2, 2, 3, 4, 5]).insertBefore(item => item === 2, [-1, 20]);
660
753
  * await collection.toArray();
661
754
  * // [1, -1, 20, 2, 2, 3, 4, 5]
662
755
  */
663
- insertBefore<TExtended = TInput>(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>, iterable: AsyncIterableValue<TInput | TExtended>, throwOnIndexOverflow?: boolean): IAsyncCollection<TInput | TExtended>;
756
+ insertBefore<TExtended = TInput>(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>, iterable: AsyncIterableValue<TInput | TExtended>): IAsyncCollection<TInput | TExtended>;
664
757
  /**
665
758
  * The <i>insertAfter</i> method adds <i>iterable</i> after the first item that matches <i>predicateFn</i>.
666
759
  * @example
760
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
761
+ *
667
762
  * const collection = new AsyncIterableCollection([1, 2, 2, 3, 4, 5]).insertAfter(item => item === 2, [-1, 20]);
668
763
  * await collection.toArray();
669
764
  * // [1, 2, -1, 20, 2, 3, 4, 5]
670
765
  */
671
- insertAfter<TExtended = TInput>(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>, iterable: AsyncIterableValue<TInput | TExtended>, throwOnIndexOverflow?: boolean): IAsyncCollection<TInput | TExtended>;
766
+ insertAfter<TExtended = TInput>(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>, iterable: AsyncIterableValue<TInput | TExtended>): IAsyncCollection<TInput | TExtended>;
672
767
  /**
673
768
  * The <i>crossJoin</i> method cross joins the collection's values among <i>iterables</i>, returning a Cartesian product with all possible permutations.
674
769
  * @example
675
- * const collection = new AsyncIterableCollection([1, 2]);
676
- * const matrix = collection.crossJoin(["a", "b"]);
677
- * await matrix.map(collection => collection.toArray()).toArray();
770
+ * import { ListCollection } from "@daiso-tech/core";;
771
+ *
772
+ * const collection = new ListCollection([1, 2]);
773
+ * const matrix = collection.cross(["a", "b"]);
774
+ * await matrix.toArray();
678
775
  * // [
679
776
  * // [1, "a"],
680
777
  * // [1, "b"],
@@ -682,9 +779,11 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
682
779
  * // [2, "b"],
683
780
  * // ]
684
781
  * @example
685
- * const collection = new AsyncIterableCollection([1, 2]);
686
- * const matrix = collection.crossJoin(["a", "b"], ["I", "II"]);
687
- * await matrix.map(collection => collection.toArray()).toArray();
782
+ * import { ListCollection } from "@daiso-tech/core";;
783
+ *
784
+ * const collection = new ListCollection([1, 2]);
785
+ * const matrix = collection.cross(["a", "b"]).cross(["I", "II"]);
786
+ * await matrix.toArray();
688
787
  * // [
689
788
  * // [1, "a", "I"],
690
789
  * // [1, "a", "II"],
@@ -696,34 +795,44 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
696
795
  * // [2, "b", "II"],
697
796
  * // ]
698
797
  */
699
- crossJoin<TExtended = TInput>(...iterables: Array<Iterable<TExtended>>): IAsyncCollection<IAsyncCollection<TInput | TExtended>>;
798
+ crossJoin<TExtended>(iterable: AsyncIterableValue<TExtended>): IAsyncCollection<CrossJoinResult<TInput, TExtended>>;
700
799
  /**
701
800
  * The <i>zip</i> method merges together the values of <i>iterable</i> with the values of the collection at their corresponding index.
702
801
  * The returned collection has size of the shortest collection.
703
802
  * @example
803
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
804
+ *
704
805
  * const collection = new AsyncIterableCollection(["Chair", "Desk"]);
705
806
  * const zipped = collection.zip([100, 200]);
706
807
  * await zipped.toArray();
707
- * // [["Chari", 100], ["Desk", 200]]
808
+ * // [["Chair", 100], ["Desk", 200]]
708
809
  * @example
810
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
811
+ *
709
812
  * const collection = new AsyncIterableCollection(["Chair", "Desk", "Couch"]);
710
813
  * const zipped = collection.zip([100, 200]);
711
814
  * await zipped.toArray();
712
- * // [["Chari", 100], ["Desk", 200]]
815
+ * // [["Chair", 100], ["Desk", 200]]
713
816
  * @example
817
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
818
+ *
714
819
  * const collection = new AsyncIterableCollection(["Chair", "Desk"]);
715
820
  * const zipped = collection.zip([100, 200, 300]);
716
821
  * await zipped.toArray();
717
- * // [["Chari", 100], ["Desk", 200]]
822
+ * // [["Chair", 100], ["Desk", 200]]
718
823
  */
719
824
  zip<TExtended>(iterable: AsyncIterableValue<TExtended>): IAsyncCollection<RecordItem<TInput, TExtended>>;
720
825
  /**
721
826
  * The <i>sort</i> method sorts the collection. You can provide a <i>comparator</i> function.
722
827
  * @example
828
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
829
+ *
723
830
  * const collection = new AsyncIterableCollection([-1, 2, 4, 3]);
724
831
  * await collection.sort().toArray();
725
832
  * // [-1, 2, 3, 4]
726
833
  * @example
834
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
835
+ *
727
836
  * const collection = new AsyncIterableCollection([
728
837
  * { name: "Anders", age: 30 },
729
838
  * { name: "Joe", age: 20 },
@@ -741,310 +850,345 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
741
850
  sort(comparator?: Comparator<TInput>): IAsyncCollection<TInput>;
742
851
  /**
743
852
  * The <i>reverse</i> method will reverse the order of the collection.
744
- * The reversing of the collection will be applied in chunks that are the size of <i>{@link ReverseSettings | ReverseSettings.chunkSize}</i>.
853
+ * The reversing of the collection will be applied in chunks that are the size of <i> chunkSize </i>.
745
854
  * @example
855
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
856
+ *
746
857
  * const collection = new AsyncIterableCollection([-1, 2, 4, 3]);
747
858
  * await collection.reverse().toArray();
748
859
  * // [3, 4, 2, -1]
749
860
  */
750
- reverse(settings?: ReverseSettings): IAsyncCollection<TInput>;
861
+ reverse(chunkSize?: number): IAsyncCollection<TInput>;
751
862
  /**
752
- * The <i>shuffle</i> method randomly shuffles the items in the collection.
863
+ * The <i>shuffle</i> method randomly shuffles the items in the collection. You can provide a custom Math.random function by passing in <i>mathRandom</i>.
753
864
  */
754
- shuffle(): IAsyncCollection<TInput>;
865
+ shuffle(mathRandom?: () => number): IAsyncCollection<TInput>;
755
866
  /**
756
- * The <i>first</i> method returns the first item in the collection that passes <i>{@link FindSettings | FindSettings.predicateFn}</i>.
757
- * By default it will get the first item. If the collection is empty or no items passes <i>{@link FindSettings | FindSettings.predicateFn}</i> than null i returned.
867
+ * The <i>first</i> method returns the first item in the collection that passes <i> predicateFn </i>.
868
+ * By default it will get the first item. If the collection is empty or no items passes <i> predicateFn </i> than null i returned.
758
869
  * @example
870
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
871
+ *
759
872
  * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
760
873
  * await collection.first();
761
874
  * // 1
762
875
  * @example
876
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
877
+ *
763
878
  * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
764
- * await collection.first({
765
- * predicateFn: item => item > 2
766
- * });
879
+ * await collection.first(item => item > 2);
767
880
  * // 3
768
881
  * @example
882
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
883
+ *
769
884
  * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
770
- * await collection.first({
771
- * predicateFn: item => item > 10
772
- * });
885
+ * await collection.first(item => item > 10);
773
886
  * // null
774
887
  * @throws {CollectionError} {@link CollectionError}
775
888
  * @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
776
- * @throws {IndexOverflowError} {@link IndexOverflowError}
777
889
  * // 3
778
890
  */
779
- first<TOutput extends TInput>(settings?: AsyncFindSettings<TInput, IAsyncCollection<TInput>, TOutput>): Promise<TOutput | null>;
891
+ first<TOutput extends TInput>(predicateFn?: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>): Promise<TOutput | null>;
780
892
  /**
781
- * The <i>firstOr</i> method returns the first item in the collection that passes <i>{@link FindOrSettings | FindOrSettings.predicateFn}</i>
782
- * By default it will get the first item. If the collection is empty or no items passes <i>{@link FindOrSettings | FindOrSettings.predicateFn}</i> than {@link FindOrSettings | FindOrSettings.defaultValue}.
893
+ * The <i>firstOr</i> method returns the first item in the collection that passes <i> predicateFn </i>
894
+ * By default it will get the first item. If the collection is empty or no items passes <i> predicateFn </i> than <i> defaultValue </i>.
783
895
  * @example
896
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
897
+ *
784
898
  * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
785
- * await collection.firstOr({
786
- * defaultValue: -1
787
- * });
899
+ * await collection.firstOr(-1);
788
900
  * // 1
789
901
  * @example
902
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
903
+ *
790
904
  * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
791
- * await collection.firstOr({
792
- * predicateFn: item => item > 2,
793
- * defaultValue: -1
794
- * });
905
+ * await collection.firstOr(-1, item => item > 2);
795
906
  * // 3
796
907
  * @example
908
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
909
+ *
797
910
  * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
798
- * await collection.firstOr({
799
- * predicateFn: item => item > 10,
800
- * defaultValue: -1
801
- * });
911
+ * await collection.firstOr(-1, item => item > 10);
802
912
  * // -1
803
913
  * @example
914
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
915
+ *
804
916
  * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
805
- * await collection.firstOr({
806
- * predicateFn: item => item > 10,
807
- * defaultValue: () => -1
808
- * });
917
+ * await collection.firstOr(() => -1, item => item > 10);
809
918
  * // -1
810
919
  * @throws {CollectionError} {@link CollectionError}
811
920
  * @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
812
- * @throws {IndexOverflowError} {@link IndexOverflowError}
813
921
  */
814
- firstOr<TOutput extends TInput, TExtended = TInput>(settings: AsyncFindOrSettings<TInput, IAsyncCollection<TInput>, TOutput, TExtended>): Promise<TOutput | TExtended>;
922
+ firstOr<TOutput extends TInput, TExtended = TInput>(defaultValue: AsyncLazyable<TExtended>, predicateFn?: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>): Promise<TOutput | TExtended>;
815
923
  /**
816
- * The <i>firstOrFail</i> method returns the first item in the collection that passes <i>{@link FindSettings | FindSettings.predicateFn}</i>.
817
- * By default it will get the first item. If the collection is empty or no items passes <i>{@link FindSettings | FindSettings.predicateFn}</i> than error is thrown.
924
+ * The <i>firstOrFail</i> method returns the first item in the collection that passes <i> predicateFn </i>.
925
+ * By default it will get the first item. If the collection is empty or no items passes <i> predicateFn </i> than error is thrown.
818
926
  * @example
927
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
928
+ *
819
929
  * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
820
930
  * await collection.firstOrFail();
821
931
  * // 1
822
932
  * @example
933
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
934
+ *
823
935
  * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
824
- * await collection.firstOrFail({
825
- * predicateFn: item => item > 2
826
- * });
936
+ * await collection.firstOrFail(item => item > 2);
827
937
  * // 3
828
938
  * @example
939
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
940
+ *
829
941
  * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
830
- * await collection.firstOrFail({
831
- * predicateFn: item => item > 10
832
- * });
942
+ * await collection.firstOrFail(item => item > 10);
833
943
  * // throws an error
834
944
  * @throws {CollectionError} {@link CollectionError}
835
945
  * @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
836
- * @throws {ItemNotFoundError} {@link ItemNotFoundError}
837
- * @throws {IndexOverflowError} {@link IndexOverflowError}
946
+ * @throws {ItemNotFoundCollectionError} {@link ItemNotFoundCollectionError}
838
947
  */
839
- firstOrFail<TOutput extends TInput>(settings?: AsyncFindSettings<TInput, IAsyncCollection<TInput>, TOutput>): Promise<TOutput>;
948
+ firstOrFail<TOutput extends TInput>(predicateFn?: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>): Promise<TOutput>;
840
949
  /**
841
- * The <i>last</i> method returns the last item in the collection that passes <i>{@link FindSettings | FindSettings.predicateFn}</i>.
842
- * By default it will get the last item. If the collection is empty or no items passes <i>{@link FindSettings | FindSettings.predicateFn}</i> than null i returned.
950
+ * The <i>last</i> method returns the last item in the collection that passes <i> predicateFn </i>.
951
+ * By default it will get the last item. If the collection is empty or no items passes <i> predicateFn </i> than null i returned.
843
952
  * @example
953
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
954
+ *
844
955
  * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
845
956
  * await collection.last();
846
- * // 1
957
+ * // 4
847
958
  * @example
959
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
960
+ *
848
961
  * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
849
- * await collection.last({
850
- * predicateFn: item => item > 2
851
- * });
962
+ * await collection.last(item => item < 4);
852
963
  * // 3
853
964
  * @example
965
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
966
+ *
854
967
  * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
855
- * await collection.last({
856
- * predicateFn: item => item > 10
857
- * });
968
+ * await collection.last(item => item > 10);
858
969
  * // null
859
970
  * @throws {CollectionError} {@link CollectionError}
860
971
  * @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
861
- * @throws {IndexOverflowError} {@link IndexOverflowError}
862
972
  * // 3
863
973
  */
864
- last<TOutput extends TInput>(settings?: AsyncFindSettings<TInput, IAsyncCollection<TInput>, TOutput>): Promise<TOutput | null>;
974
+ last<TOutput extends TInput>(predicateFn?: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>): Promise<TOutput | null>;
865
975
  /**
866
- * The <i>lastOr</i> method returns the last item in the collection that passes <i>{@link FindOrSettings | FindOrSettings.predicateFn}</i>.
867
- * By default it will get the last item. If the collection is empty or no items passes <i>{@link FindOrSettings | FindOrSettings.predicateFn}</i> than {@link FindOrSettings | FindOrSettings.defaultValue}.
976
+ * The <i>lastOr</i> method returns the last item in the collection that passes <i> predicateFn </i>.
977
+ * By default it will get the last item. If the collection is empty or no items passes <i> predicateFn </i> than <i> defaultValue </i>.
868
978
  * @example
979
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
980
+ *
869
981
  * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
870
- * await collection.lastOr({
871
- * defaultValue: -1
872
- * });
873
- * // 1
982
+ * await collection.lastOr(-1);
983
+ * // 4
874
984
  * @example
985
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
986
+ *
875
987
  * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
876
- * await collection.lastOr({
877
- * predicateFn: item => item > 2,
878
- * defaultValue: -1
879
- * });
988
+ * await collection.lastOr(-1, item => item < 4);
880
989
  * // 3
881
990
  * @example
991
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
992
+ *
882
993
  * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
883
- * await collection.lastOr({
884
- * predicateFn: item => item > 10,
885
- * defaultValue: -1
886
- * });
994
+ * await collection.lastOr(-1, item => item > 10);
887
995
  * // -1
888
996
  * @example
997
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
998
+ *
889
999
  * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
890
- * await collection.lastOr({
891
- * predicateFn: item => item > 10,
892
- * defaultValue: () => -1
893
- * });
1000
+ * await collection.lastOr(() => -1, item => item > 10);
894
1001
  * // -1
895
1002
  * @throws {CollectionError} {@link CollectionError}
896
1003
  * @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
897
- * @throws {IndexOverflowError} {@link IndexOverflowError}
898
1004
  */
899
- lastOr<TOutput extends TInput, TExtended = TInput>(settings: AsyncFindOrSettings<TInput, IAsyncCollection<TInput>, TOutput, TExtended>): Promise<TOutput | TExtended>;
1005
+ lastOr<TOutput extends TInput, TExtended = TInput>(defaultValue: AsyncLazyable<TExtended>, predicateFn?: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>): Promise<TOutput | TExtended>;
900
1006
  /**
901
- * The <i>lastOrFail</i> method returns the last item in the collection that passes <i>{@link FindSettings | FindSettings.predicateFn}</i>.
902
- * By default it will get the last item. If the collection is empty or no items passes <i>{@link FindSettings | FindSettings.predicateFn}</i> than error is thrown.
1007
+ * The <i>lastOrFail</i> method returns the last item in the collection that passes <i> predicateFn </i>.
1008
+ * By default it will get the last item. If the collection is empty or no items passes <i> predicateFn </i> than error is thrown.
903
1009
  * @example
1010
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
1011
+ *
904
1012
  * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
905
1013
  * await collection.lastOrFail();
906
- * // 1
1014
+ * // 4
907
1015
  * @example
1016
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
1017
+ *
908
1018
  * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
909
- * await collection.lastOrFail({
910
- * predicateFn: item => item > 2
911
- * });
1019
+ * await collection.lastOrFail(item => item < 4);
912
1020
  * // 3
913
1021
  * @example
1022
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
1023
+ *
914
1024
  * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
915
- * await collection.lastOrFail({
916
- * predicateFn: item => item > 10
917
- * });
1025
+ * await collection.lastOrFail(item => item > 10);
918
1026
  * // throws an error
919
1027
  * @throws {CollectionError} {@link CollectionError}
920
1028
  * @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
921
- * @throws {ItemNotFoundError} {@link ItemNotFoundError}
922
- * @throws {IndexOverflowError} {@link IndexOverflowError}
1029
+ * @throws {ItemNotFoundCollectionError} {@link ItemNotFoundCollectionError}
923
1030
  */
924
- lastOrFail<TOutput extends TInput>(settings?: AsyncFindSettings<TInput, IAsyncCollection<TInput>, TOutput>): Promise<TOutput>;
1031
+ lastOrFail<TOutput extends TInput>(predicateFn?: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>): Promise<TOutput>;
925
1032
  /**
926
1033
  * The <i>before</i> method returns the item that comes before the first item that matches <i>predicateFn</i>.
927
1034
  * If the <i>predicateFn</i> does not match or matches the first item then null is returned.
928
1035
  * @example
1036
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
1037
+ *
929
1038
  * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
930
1039
  * await collection.before(item => item === 2);
931
1040
  * // 1
932
1041
  * @example
1042
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
1043
+ *
933
1044
  * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
934
1045
  * await collection.before(item => item === 1);
935
1046
  * // null
936
1047
  * @throws {CollectionError} {@link CollectionError}
937
1048
  * @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
938
- * @throws {IndexOverflowError} {@link IndexOverflowError}
939
1049
  */
940
- before(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>, throwOnIndexOverflow?: boolean): Promise<TInput | null>;
1050
+ before(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): Promise<TInput | null>;
941
1051
  /**
942
1052
  * The <i>beforeOr</i> method returns the item that comes before the first item that matches <i>predicateFn</i>.
943
1053
  * If the collection is empty or the <i>predicateFn</i> does not match or matches the first item then <i>defaultValue</i> is returned.
944
1054
  * @example
1055
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
1056
+ *
945
1057
  * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
946
1058
  * await collection.beforeOr(-1, item => item === 2);
947
1059
  * // 1
948
1060
  * @example
1061
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
1062
+ *
949
1063
  * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
950
1064
  * await collection.beforeOr(-1, item => item === 1);
951
1065
  * // -1
952
1066
  * @example
1067
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
1068
+ *
953
1069
  * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
954
1070
  * await collection.beforeOr(() => -1, item => item === 1);
955
1071
  * // -1
956
1072
  * @throws {CollectionError} {@link CollectionError}
957
1073
  * @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
958
- * @throws {IndexOverflowError} {@link IndexOverflowError}
959
1074
  */
960
- beforeOr<TExtended = TInput>(defaultValue: AsyncLazyable<TExtended>, predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>, throwOnIndexOverflow?: boolean): Promise<TInput | TExtended>;
1075
+ beforeOr<TExtended = TInput>(defaultValue: AsyncLazyable<TExtended>, predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): Promise<TInput | TExtended>;
961
1076
  /**
962
1077
  * The <i>beforeOrFail</i> method returns the item that comes before the first item that matches <i>predicateFn</i>.
963
1078
  * If the collection is empty or the <i>predicateFn</i> does not match or matches the first item then an error is thrown.
964
1079
  * @example
1080
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
1081
+ *
965
1082
  * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
966
1083
  * await collection.beforeOrFail(item => item === 2);
967
1084
  * // 1
968
1085
  * @example
1086
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
1087
+ *
969
1088
  * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
970
1089
  * await collection.beforeOrFail(item => item === 1);
971
1090
  * // error is thrown
972
1091
  * @throws {CollectionError} {@link CollectionError}
973
1092
  * @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
974
- * @throws {ItemNotFoundError} {@link ItemNotFoundError}
975
- * @throws {IndexOverflowError} {@link IndexOverflowError}
1093
+ * @throws {ItemNotFoundCollectionError} {@link ItemNotFoundCollectionError}
976
1094
  */
977
- beforeOrFail(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>, throwOnIndexOverflow?: boolean): Promise<TInput>;
1095
+ beforeOrFail(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): Promise<TInput>;
978
1096
  /**
979
1097
  * The <i>after</i> method returns the item that comes after the first item that matches <i>predicateFn</i>.
980
1098
  * If the collection is empty or the <i>predicateFn</i> does not match or matches the last item then null is returned.
981
1099
  * @example
1100
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
1101
+ *
982
1102
  * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
983
1103
  * await collection.after(item => item === 2);
984
- * // 1
1104
+ * // 3
985
1105
  * @example
1106
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
1107
+ *
986
1108
  * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
987
- * await collection.after(item => item === 1);
1109
+ * await collection.after(item => item === 4);
988
1110
  * // null
989
1111
  * @throws {CollectionError} {@link CollectionError}
990
1112
  * @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
991
- * @throws {IndexOverflowError} {@link IndexOverflowError}
992
1113
  */
993
- after(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>, throwOnIndexOverflow?: boolean): Promise<TInput | null>;
1114
+ after(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): Promise<TInput | null>;
994
1115
  /**
995
1116
  * The <i>afterOr</i> method returns the item that comes after the first item that matches <i>predicateFn</i>.
996
1117
  * If the collection is empty or the <i>predicateFn</i> does not match or matches the last item then <i>defaultValue</i> is returned.
997
1118
  * @example
1119
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
1120
+ *
998
1121
  * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
999
1122
  * await collection.afterOr(-1, item => item === 2);
1000
- * // 1
1123
+ * // 3
1001
1124
  * @example
1125
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
1126
+ *
1002
1127
  * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
1003
- * await collection.afterOr(-1, item => item === 1);
1128
+ * await collection.afterOr(-1, item => item === 4);
1004
1129
  * // -1
1005
1130
  * @example
1131
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
1132
+ *
1006
1133
  * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
1007
- * await collection.afterOr(() => -1, item => item === 1);
1134
+ * await collection.afterOr(() => -1, item => item === 4);
1008
1135
  * // -1
1009
1136
  * @throws {CollectionError} {@link CollectionError}
1010
1137
  * @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
1011
- * @throws {IndexOverflowError} {@link IndexOverflowError}
1012
1138
  */
1013
- afterOr<TExtended = TInput>(defaultValue: AsyncLazyable<TExtended>, predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>, throwOnIndexOverflow?: boolean): Promise<TInput | TExtended>;
1139
+ afterOr<TExtended = TInput>(defaultValue: AsyncLazyable<TExtended>, predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): Promise<TInput | TExtended>;
1014
1140
  /**
1015
1141
  * The <i>afterOrFail</i> method returns the item that comes after the first item that matches <i>predicateFn</i>.
1016
1142
  * If the collection is empty or the <i>predicateFn</i> does not match or matches the last item then an error is thrown.
1017
1143
  * @example
1144
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
1145
+ *
1018
1146
  * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
1019
1147
  * await collection.afterOrFail(item => item === 2);
1020
- * // 1
1148
+ * // 3
1021
1149
  * @example
1150
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
1151
+ *
1022
1152
  * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
1023
- * await collection.afterOrFail(item => item === 1);
1153
+ * await collection.afterOrFail(item => item === 4);
1024
1154
  * // error is thrown
1025
1155
  * @throws {CollectionError} {@link CollectionError}
1026
1156
  * @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
1027
- * @throws {ItemNotFoundError} {@link ItemNotFoundError}
1028
- * @throws {IndexOverflowError} {@link IndexOverflowError}
1157
+ * @throws {ItemNotFoundCollectionError} {@link ItemNotFoundCollectionError}
1029
1158
  */
1030
- afterOrFail(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>, throwOnIndexOverflow?: boolean): Promise<TInput>;
1159
+ afterOrFail(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): Promise<TInput>;
1031
1160
  /**
1032
1161
  * The <i>sole</i> method returns the first item in the collection that passes <i>predicateFn</i>, but only if <i>predicateFn</i> matches exactly one item.
1033
1162
  * If no items matches or multiple items are found an error will be thrown.
1034
1163
  * @example
1164
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
1165
+ *
1035
1166
  * const collection = new AsyncIterableCollection([1, 2, 3, 4, 5]);
1036
1167
  * await collection.sole(item => item === 4);
1037
1168
  * // 4
1169
+ * @example
1170
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
1171
+ *
1172
+ * const collection = new AsyncIterableCollection([1, 2, 3, 4, 4, 5]);
1173
+ * await collection.sole(item => item === 4);
1174
+ * // error is thrown
1175
+ * @example
1176
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
1177
+ *
1178
+ * const collection = new AsyncIterableCollection([1, 2, 3, 5]);
1179
+ * await collection.sole(item => item === 4);
1180
+ * // error is thrown
1038
1181
  * @throws {CollectionError} {@link CollectionError}
1039
1182
  * @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
1040
- * @throws {ItemNotFoundError} {@link ItemNotFoundError}
1041
- * @throws {MultipleItemsFoundError} {@link MultipleItemsFoundError}
1042
- * @throws {IndexOverflowError} {@link IndexOverflowError}
1183
+ * @throws {ItemNotFoundCollectionError} {@link ItemNotFoundCollectionError}
1184
+ * @throws {MultipleItemsFoundCollectionError} {@link MultipleItemsFoundCollectionError}
1043
1185
  */
1044
- sole<TOutput extends TInput>(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>, throwOnIndexOverflow?: boolean): Promise<TOutput>;
1186
+ sole<TOutput extends TInput>(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>): Promise<TOutput>;
1045
1187
  /**
1046
1188
  * The <i>nth</i> method creates a new collection consisting of every n-th item.
1047
1189
  * @example
1190
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
1191
+ *
1048
1192
  * const collection = new AsyncIterableCollection(["a", "b", "c", "d", "e", "f"]).nth(4);
1049
1193
  * await collection.toArray();
1050
1194
  * // ["a", "e"]
@@ -1053,75 +1197,75 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
1053
1197
  /**
1054
1198
  * The <i>count</i> method returns the total number of items in the collection that passes <i>predicateFn</i>.
1055
1199
  * @example
1200
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
1201
+ *
1056
1202
  * const collection = new AsyncIterableCollection([1, 2, 3, 4, 5, 6]);
1057
1203
  * await collection.count(value => value % 2 === 0);
1058
1204
  * // 3
1059
1205
  * @throws {CollectionError} {@link CollectionError}
1060
1206
  * @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
1061
- * @throws {IndexOverflowError} {@link IndexOverflowError}
1062
1207
  */
1063
- count(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>, throwOnIndexOverflow?: boolean): Promise<number>;
1208
+ count(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): Promise<number>;
1064
1209
  /**
1065
1210
  * The <i>size</i> returns the size of the collection.
1066
1211
  * @throws {CollectionError} {@link CollectionError}
1067
1212
  * @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
1068
- * @throws {IndexOverflowError} {@link IndexOverflowError}
1069
1213
  */
1070
- size(throwOnIndexOverflow?: boolean): Promise<number>;
1214
+ size(): Promise<number>;
1071
1215
  /**
1072
1216
  * The <i>isEmpty</i> returns true if the collection is empty.
1073
1217
  * @throws {CollectionError} {@link CollectionError}
1074
1218
  * @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
1075
- * @throws {IndexOverflowError} {@link IndexOverflowError}
1076
1219
  */
1077
1220
  isEmpty(): Promise<boolean>;
1078
1221
  /**
1079
1222
  * The <i>isNotEmpty</i> returns true if the collection is not empty.
1080
1223
  * @throws {CollectionError} {@link CollectionError}
1081
1224
  * @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
1082
- * @throws {IndexOverflowError} {@link IndexOverflowError}
1083
1225
  */
1084
1226
  isNotEmpty(): Promise<boolean>;
1085
1227
  /**
1086
1228
  * The <i>searchFirst</i> return the index of the first item that matches <i>predicateFn</i>.
1087
1229
  * @example
1230
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
1231
+ *
1088
1232
  * const collection = new AsyncIterableCollection(["a", "b", "b", "c"]);
1089
1233
  * await collection.searchFirst(item => item === "b");
1090
1234
  * // 1
1091
1235
  * @throws {CollectionError} {@link CollectionError}
1092
1236
  * @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
1093
- * @throws {IndexOverflowError} {@link IndexOverflowError}
1094
1237
  */
1095
- searchFirst(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>, throwOnIndexOverflow?: boolean): Promise<number>;
1238
+ searchFirst(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): Promise<number>;
1096
1239
  /**
1097
1240
  * The <i>searchLast</i> return the index of the last item that matches <i>predicateFn</i>.
1098
1241
  * @example
1242
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
1243
+ *
1099
1244
  * const collection = new AsyncIterableCollection(["a", "b", "b", "c"]);
1100
1245
  * await collection.searchLast(item => item === "b");
1101
1246
  * // 2
1102
1247
  * @throws {CollectionError} {@link CollectionError}
1103
1248
  * @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
1104
- * @throws {IndexOverflowError} {@link IndexOverflowError}
1105
1249
  */
1106
- searchLast(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>, throwOnIndexOverflow?: boolean): Promise<number>;
1250
+ searchLast(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): Promise<number>;
1107
1251
  /**
1108
1252
  * The <i>forEach</i> method iterates through all items in the collection.
1109
1253
  * @throws {CollectionError} {@link CollectionError}
1110
1254
  * @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
1111
- * @throws {IndexOverflowError} {@link IndexOverflowError}
1112
1255
  */
1113
- forEach(callback: AsyncForEach<TInput, IAsyncCollection<TInput>>, throwOnIndexOverflow?: boolean): Promise<void>;
1256
+ forEach(callback: AsyncForEach<TInput, IAsyncCollection<TInput>>): Promise<void>;
1114
1257
  /**
1115
1258
  * The <i>toArray</i> method converts the collection to a new array.
1116
1259
  * @throws {CollectionError} {@link CollectionError}
1117
1260
  * @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
1118
- * @throws {IndexOverflowError} {@link IndexOverflowError}
1119
1261
  */
1120
1262
  toArray(): Promise<TInput[]>;
1121
1263
  /**
1122
1264
  * The delay method will delay collection such that each value is returned after the specified number of seconds.
1123
1265
  * This method is especially useful for situations where you may be interacting with external APIs that rate limit incoming requests:
1124
1266
  * @example
1267
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
1268
+ *
1125
1269
  * // An iterator that will fetch all users from a specific api
1126
1270
  * class ApiIterator implements AsyncIterable<IUser> { ... }
1127
1271
  * const apiIterator = new ApiIterator();
@@ -1134,6 +1278,8 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
1134
1278
  * The timeout method returns a new collection that will iterate values until the specified time.
1135
1279
  * After that time, the collection will then stop iterating:
1136
1280
  * @example
1281
+ * import { AsyncIterableCollection } from "@daiso-tech/core";;
1282
+ *
1137
1283
  * class AsyncInfiniteIterable implements AsyncIterable<number> {
1138
1284
  * async *[Symbol.asyncIterator]() {
1139
1285
  * while(true) {
@@ -1143,7 +1289,7 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
1143
1289
  * }
1144
1290
  * const asyncInfiniteIterable = new AsyncInfiniteIterable();
1145
1291
  * const collection = new AsyncIterableCollection(asyncInfiniteIterable);
1146
- * collection
1292
+ * await collection
1147
1293
  * .timeout(1000)
1148
1294
  * .forEach(nbr => console.log(nbr))
1149
1295
  */