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