@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,4 +1,4 @@
1
- import { CollectionError, ItemNotFoundCollectionError, MultipleItemsFoundCollectionError, UnexpectedCollectionError, TypeCollectionError, EmptyCollectionError, } from "../../contracts/collection/_module";
1
+ import { ItemNotFoundCollectionError, MultipleItemsFoundCollectionError, UnexpectedCollectionError, TypeCollectionError, EmptyCollectionError, } from "../../contracts/collection/_module";
2
2
  import { CrossJoinIterable, SlidingIteralbe, ShuffleIterable, EntriesIterable, FilterIterable, ChunkIterable, ChunkWhileIterable, CollapseIterable, CountByIterable, FlatMapIterable, GroupByIterable, InsertAfterIterable, InsertBeforeIterable, MapIterable, MergeIterable, PadEndIterable, PadStartIterable, PartionIterable, SkipIterable, SkipUntilIterable, SortIterable, SplitIterable, TakeIterable, TakeUntilIterable, TapIterable, UniqueIterable, UpdateIterable, WhenIterable, ZipIterable, ReverseIterable, SliceIterable, RepeatIterable, } from "../../collection/iterable-collection/_shared/_module";
3
3
  import { simplifyLazyable } from "../../_shared/utilities";
4
4
  export class IterableCollection {
@@ -11,15 +11,7 @@ export class IterableCollection {
11
11
  this.iterable = iterable;
12
12
  }
13
13
  *[Symbol.iterator]() {
14
- try {
15
- yield* this.iterable;
16
- }
17
- catch (error) {
18
- if (error instanceof CollectionError) {
19
- throw error;
20
- }
21
- throw new UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
22
- }
14
+ yield* this.iterable;
23
15
  }
24
16
  toIterator() {
25
17
  return this[Symbol.iterator]();
@@ -43,57 +35,41 @@ export class IterableCollection {
43
35
  return new IterableCollection(new MapIterable(this, mapFn));
44
36
  }
45
37
  reduce(reduceFn, initialValue) {
46
- try {
47
- if (initialValue === undefined && this.isEmpty()) {
48
- throw new TypeCollectionError("Reduce of empty array must be inputed a initial value");
49
- }
50
- if (initialValue !== undefined) {
51
- let output = initialValue, index = 0;
52
- for (const item of this) {
53
- output = reduceFn(output, item, index, this);
54
- index++;
55
- }
56
- return output;
57
- }
58
- let output = this.firstOrFail(), index = 0, isFirstIteration = true;
38
+ if (initialValue === undefined && 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, index = 0;
59
43
  for (const item of this) {
60
- if (!isFirstIteration) {
61
- output = reduceFn(output, item, index, this);
62
- }
63
- isFirstIteration = false;
44
+ output = reduceFn(output, item, index, this);
64
45
  index++;
65
46
  }
66
47
  return output;
67
48
  }
68
- catch (error) {
69
- if (error instanceof CollectionError) {
70
- throw error;
49
+ let output = this.firstOrFail(), index = 0, isFirstIteration = true;
50
+ for (const item of this) {
51
+ if (!isFirstIteration) {
52
+ output = reduceFn(output, item, index, this);
71
53
  }
72
- throw new UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
54
+ isFirstIteration = false;
55
+ index++;
73
56
  }
57
+ return output;
74
58
  }
75
59
  join(separator = ",") {
76
- try {
77
- let str = null;
78
- for (const item of this) {
79
- if (typeof item !== "string") {
80
- throw new TypeCollectionError("Item type is invalid must be string");
81
- }
82
- if (str === null) {
83
- str = item;
84
- }
85
- else {
86
- str = str + separator + item;
87
- }
60
+ let str = null;
61
+ for (const item of this) {
62
+ if (typeof item !== "string") {
63
+ throw new TypeCollectionError("Item type is invalid must be string");
88
64
  }
89
- return str;
90
- }
91
- catch (error) {
92
- if (error instanceof CollectionError) {
93
- throw error;
65
+ if (str === null) {
66
+ str = item;
67
+ }
68
+ else {
69
+ str = str + separator + item;
94
70
  }
95
- throw new UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
96
71
  }
72
+ return str;
97
73
  }
98
74
  collapse() {
99
75
  return new IterableCollection(new CollapseIterable(this));
@@ -111,47 +87,31 @@ export class IterableCollection {
111
87
  return this.skip((page - 1) * pageSize).take(pageSize);
112
88
  }
113
89
  sum() {
114
- try {
115
- if (this.isEmpty()) {
116
- throw new EmptyCollectionError("Collection is empty therby operation cannot be performed");
117
- }
118
- let sum = 0;
119
- for (const item of this) {
120
- if (typeof item !== "number") {
121
- throw new TypeCollectionError("Item type is invalid must be number");
122
- }
123
- sum += item;
124
- }
125
- return sum;
90
+ if (this.isEmpty()) {
91
+ throw new EmptyCollectionError("Collection is empty therby operation cannot be performed");
126
92
  }
127
- catch (error) {
128
- if (error instanceof CollectionError) {
129
- throw error;
93
+ let sum = 0;
94
+ for (const item of this) {
95
+ if (typeof item !== "number") {
96
+ throw new TypeCollectionError("Item type is invalid must be number");
130
97
  }
131
- throw new UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
98
+ sum += item;
132
99
  }
100
+ return sum;
133
101
  }
134
102
  average() {
135
- try {
136
- if (this.isEmpty()) {
137
- throw new EmptyCollectionError("Collection is empty therby operation cannot be performed");
138
- }
139
- let size = 0, sum = 0;
140
- for (const item of this) {
141
- if (typeof item !== "number") {
142
- throw new TypeCollectionError("Item type is invalid must be number");
143
- }
144
- size++;
145
- sum += item;
146
- }
147
- return (sum / size);
103
+ if (this.isEmpty()) {
104
+ throw new EmptyCollectionError("Collection is empty therby operation cannot be performed");
148
105
  }
149
- catch (error) {
150
- if (error instanceof CollectionError) {
151
- throw error;
106
+ let size = 0, sum = 0;
107
+ for (const item of this) {
108
+ if (typeof item !== "number") {
109
+ throw new TypeCollectionError("Item type is invalid must be number");
152
110
  }
153
- throw new UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
111
+ size++;
112
+ sum += item;
154
113
  }
114
+ return (sum / size);
155
115
  }
156
116
  median() {
157
117
  if (this.isEmpty()) {
@@ -191,114 +151,74 @@ export class IterableCollection {
191
151
  return median;
192
152
  }
193
153
  min() {
194
- try {
195
- if (this.isEmpty()) {
196
- throw new EmptyCollectionError("Collection is empty therby operation cannot be performed");
154
+ if (this.isEmpty()) {
155
+ throw new EmptyCollectionError("Collection is empty therby operation cannot be performed");
156
+ }
157
+ let min = 0;
158
+ for (const item of this) {
159
+ if (typeof item !== "number") {
160
+ throw new TypeCollectionError("Item type is invalid must be number");
197
161
  }
198
- let min = 0;
199
- for (const item of this) {
200
- if (typeof item !== "number") {
201
- throw new TypeCollectionError("Item type is invalid must be number");
202
- }
203
- if (min === 0) {
204
- min = item;
205
- }
206
- else if (min > item) {
207
- min = item;
208
- }
162
+ if (min === 0) {
163
+ min = item;
209
164
  }
210
- return min;
211
- }
212
- catch (error) {
213
- if (error instanceof CollectionError) {
214
- throw error;
165
+ else if (min > item) {
166
+ min = item;
215
167
  }
216
- throw new UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
217
168
  }
169
+ return min;
218
170
  }
219
171
  max() {
220
- try {
221
- if (this.isEmpty()) {
222
- throw new EmptyCollectionError("Collection is empty therby operation cannot be performed");
172
+ if (this.isEmpty()) {
173
+ throw new EmptyCollectionError("Collection is empty therby operation cannot be performed");
174
+ }
175
+ let max = 0;
176
+ for (const item of this) {
177
+ if (typeof item !== "number") {
178
+ throw new TypeCollectionError("Item type is invalid must be number");
223
179
  }
224
- let max = 0;
225
- for (const item of this) {
226
- if (typeof item !== "number") {
227
- throw new TypeCollectionError("Item type is invalid must be number");
228
- }
229
- if (max === 0) {
230
- max = item;
231
- }
232
- else if (max < item) {
233
- max = item;
234
- }
180
+ if (max === 0) {
181
+ max = item;
235
182
  }
236
- return max;
237
- }
238
- catch (error) {
239
- if (error instanceof CollectionError) {
240
- throw error;
183
+ else if (max < item) {
184
+ max = item;
241
185
  }
242
- throw new UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
243
186
  }
187
+ return max;
244
188
  }
245
189
  percentage(predicateFn) {
246
- try {
247
- if (this.isEmpty()) {
248
- throw new EmptyCollectionError("Collection is empty therby operation cannot be performed");
249
- }
250
- let part = 0, total = 0;
251
- for (const item of this) {
252
- if (predicateFn(item, total, this)) {
253
- part++;
254
- }
255
- total++;
256
- }
257
- return (part / total) * 100;
190
+ if (this.isEmpty()) {
191
+ throw new EmptyCollectionError("Collection is empty therby operation cannot be performed");
258
192
  }
259
- catch (error) {
260
- if (error instanceof CollectionError) {
261
- throw error;
193
+ let part = 0, total = 0;
194
+ for (const item of this) {
195
+ if (predicateFn(item, total, this)) {
196
+ part++;
262
197
  }
263
- throw new UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
198
+ total++;
264
199
  }
200
+ return (part / total) * 100;
265
201
  }
266
202
  some(predicateFn) {
267
- try {
268
- let index = 0;
269
- for (const item of this) {
270
- if (predicateFn(item, index, this)) {
271
- return true;
272
- }
273
- index++;
274
- }
275
- return false;
276
- }
277
- catch (error) {
278
- if (error instanceof CollectionError) {
279
- throw error;
203
+ let index = 0;
204
+ for (const item of this) {
205
+ if (predicateFn(item, index, this)) {
206
+ return true;
280
207
  }
281
- throw new UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
208
+ index++;
282
209
  }
210
+ return false;
283
211
  }
284
212
  every(predicateFn) {
285
- try {
286
- let index = 0, isTrue = true;
287
- for (const item of this) {
288
- isTrue &&= predicateFn(item, index, this);
289
- if (!isTrue) {
290
- break;
291
- }
292
- index++;
213
+ let index = 0, isTrue = true;
214
+ for (const item of this) {
215
+ isTrue &&= predicateFn(item, index, this);
216
+ if (!isTrue) {
217
+ break;
293
218
  }
294
- return isTrue;
295
- }
296
- catch (error) {
297
- if (error instanceof CollectionError) {
298
- throw error;
299
- }
300
- throw new UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
219
+ index++;
301
220
  }
221
+ return isTrue;
302
222
  }
303
223
  take(limit) {
304
224
  return new IterableCollection(new TakeIterable(this, limit));
@@ -331,15 +251,7 @@ export class IterableCollection {
331
251
  return new IterableCollection(new WhenIterable(this, () => this.isNotEmpty(), callback));
332
252
  }
333
253
  pipe(callback) {
334
- try {
335
- return callback(this);
336
- }
337
- catch (error) {
338
- if (error instanceof CollectionError) {
339
- throw error;
340
- }
341
- throw new UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
342
- }
254
+ return callback(this);
343
255
  }
344
256
  tap(callback) {
345
257
  return new IterableCollection(new TapIterable(this, callback));
@@ -417,33 +329,17 @@ export class IterableCollection {
417
329
  return new IterableCollection(new ShuffleIterable(this, mathRandom));
418
330
  }
419
331
  first(predicateFn) {
420
- try {
421
- return this.firstOr(null, predicateFn);
422
- }
423
- catch (error) {
424
- if (error instanceof CollectionError) {
425
- throw error;
426
- }
427
- throw new UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
428
- }
332
+ return this.firstOr(null, predicateFn);
429
333
  }
430
334
  firstOr(defaultValue, predicateFn = () => true) {
431
- try {
432
- let index = 0;
433
- for (const item of this) {
434
- if (predicateFn(item, index, this)) {
435
- return item;
436
- }
437
- index++;
438
- }
439
- return simplifyLazyable(defaultValue);
440
- }
441
- catch (error) {
442
- if (error instanceof CollectionError) {
443
- throw error;
335
+ let index = 0;
336
+ for (const item of this) {
337
+ if (predicateFn(item, index, this)) {
338
+ return item;
444
339
  }
445
- throw new UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
340
+ index++;
446
341
  }
342
+ return simplifyLazyable(defaultValue);
447
343
  }
448
344
  firstOrFail(predicateFn) {
449
345
  const item = this.first(predicateFn);
@@ -453,37 +349,21 @@ export class IterableCollection {
453
349
  return item;
454
350
  }
455
351
  last(predicateFn) {
456
- try {
457
- return this.lastOr(null, predicateFn);
458
- }
459
- catch (error) {
460
- if (error instanceof CollectionError) {
461
- throw error;
462
- }
463
- throw new UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
464
- }
352
+ return this.lastOr(null, predicateFn);
465
353
  }
466
354
  lastOr(defaultValue, predicateFn = () => true) {
467
- try {
468
- let index = 0;
469
- let matchedItem = null;
470
- for (const item of this) {
471
- if (predicateFn(item, index, this)) {
472
- matchedItem = item;
473
- }
474
- index++;
355
+ let index = 0;
356
+ let matchedItem = null;
357
+ for (const item of this) {
358
+ if (predicateFn(item, index, this)) {
359
+ matchedItem = item;
475
360
  }
476
- if (matchedItem) {
477
- return matchedItem;
478
- }
479
- return simplifyLazyable(defaultValue);
361
+ index++;
480
362
  }
481
- catch (error) {
482
- if (error instanceof CollectionError) {
483
- throw error;
484
- }
485
- throw new UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
363
+ if (matchedItem) {
364
+ return matchedItem;
486
365
  }
366
+ return simplifyLazyable(defaultValue);
487
367
  }
488
368
  lastOrFail(predicateFn) {
489
369
  const item = this.last(predicateFn);
@@ -496,23 +376,15 @@ export class IterableCollection {
496
376
  return this.beforeOr(null, predicateFn);
497
377
  }
498
378
  beforeOr(defaultValue, predicateFn) {
499
- try {
500
- let beforeItem = null, index = 0;
501
- for (const item of this) {
502
- if (predicateFn(item, index, this) && beforeItem) {
503
- return beforeItem;
504
- }
505
- index++;
506
- beforeItem = item;
379
+ let beforeItem = null, index = 0;
380
+ for (const item of this) {
381
+ if (predicateFn(item, index, this) && beforeItem) {
382
+ return beforeItem;
507
383
  }
508
- return simplifyLazyable(defaultValue);
509
- }
510
- catch (error) {
511
- if (error instanceof CollectionError) {
512
- throw error;
513
- }
514
- throw new UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
384
+ index++;
385
+ beforeItem = item;
515
386
  }
387
+ return simplifyLazyable(defaultValue);
516
388
  }
517
389
  beforeOrFail(predicateFn) {
518
390
  const item = this.before(predicateFn);
@@ -525,23 +397,15 @@ export class IterableCollection {
525
397
  return this.afterOr(null, predicateFn);
526
398
  }
527
399
  afterOr(defaultValue, predicateFn) {
528
- try {
529
- let hasMatched = false, index = 0;
530
- for (const item of this) {
531
- if (hasMatched) {
532
- return item;
533
- }
534
- hasMatched = predicateFn(item, index, this);
535
- index++;
536
- }
537
- return simplifyLazyable(defaultValue);
538
- }
539
- catch (error) {
540
- if (error instanceof CollectionError) {
541
- throw error;
400
+ let hasMatched = false, index = 0;
401
+ for (const item of this) {
402
+ if (hasMatched) {
403
+ return item;
542
404
  }
543
- throw new UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
405
+ hasMatched = predicateFn(item, index, this);
406
+ index++;
544
407
  }
408
+ return simplifyLazyable(defaultValue);
545
409
  }
546
410
  afterOrFail(predicateFn) {
547
411
  const item = this.after(predicateFn);
@@ -551,131 +415,75 @@ export class IterableCollection {
551
415
  return item;
552
416
  }
553
417
  sole(predicateFn) {
554
- try {
555
- let index = 0, matchedItem = null;
556
- for (const item of this) {
557
- if (predicateFn(item, index, this)) {
558
- if (matchedItem !== null) {
559
- throw new MultipleItemsFoundCollectionError("Multiple items were found");
560
- }
561
- matchedItem = item;
418
+ let index = 0, matchedItem = null;
419
+ for (const item of this) {
420
+ if (predicateFn(item, index, this)) {
421
+ if (matchedItem !== null) {
422
+ throw new MultipleItemsFoundCollectionError("Multiple items were found");
562
423
  }
563
- index++;
564
- }
565
- if (matchedItem === null) {
566
- throw new ItemNotFoundCollectionError("Item was not found");
424
+ matchedItem = item;
567
425
  }
568
- return matchedItem;
426
+ index++;
569
427
  }
570
- catch (error) {
571
- if (error instanceof CollectionError) {
572
- throw error;
573
- }
574
- throw new UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
428
+ if (matchedItem === null) {
429
+ throw new ItemNotFoundCollectionError("Item was not found");
575
430
  }
431
+ return matchedItem;
576
432
  }
577
433
  nth(step) {
578
434
  return this.filter((_item, index) => index % step === 0);
579
435
  }
580
436
  count(predicateFn) {
581
- try {
582
- let size = 0;
583
- for (const item of this) {
584
- if (predicateFn(item, size, this)) {
585
- size++;
586
- }
587
- }
588
- return size;
589
- }
590
- catch (error) {
591
- if (error instanceof CollectionError) {
592
- throw error;
437
+ let size = 0;
438
+ for (const item of this) {
439
+ if (predicateFn(item, size, this)) {
440
+ size++;
593
441
  }
594
- throw new UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
595
442
  }
443
+ return size;
596
444
  }
597
445
  size() {
598
446
  return this.count(() => true);
599
447
  }
600
448
  isEmpty() {
601
- try {
602
- for (const _ of this) {
603
- return false;
604
- }
605
- return true;
606
- }
607
- catch (error) {
608
- if (error instanceof CollectionError) {
609
- throw error;
610
- }
611
- throw new UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
449
+ for (const _ of this) {
450
+ return false;
612
451
  }
452
+ return true;
613
453
  }
614
454
  isNotEmpty() {
615
455
  return !this.isEmpty();
616
456
  }
617
457
  searchFirst(predicateFn) {
618
- try {
619
- let index = 0;
620
- for (const item of this) {
621
- if (predicateFn(item, index, this)) {
622
- return index;
623
- }
624
- index++;
625
- }
626
- return -1;
627
- }
628
- catch (error) {
629
- if (error instanceof CollectionError) {
630
- throw error;
458
+ let index = 0;
459
+ for (const item of this) {
460
+ if (predicateFn(item, index, this)) {
461
+ return index;
631
462
  }
632
- throw new UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
463
+ index++;
633
464
  }
465
+ return -1;
634
466
  }
635
467
  searchLast(predicateFn) {
636
- try {
637
- let index = 0;
638
- let matchedIndex = -1;
639
- for (const item of this) {
640
- if (predicateFn(item, index, this)) {
641
- matchedIndex = index;
642
- }
643
- index++;
644
- }
645
- return matchedIndex;
646
- }
647
- catch (error) {
648
- if (error instanceof CollectionError) {
649
- throw error;
468
+ let index = 0;
469
+ let matchedIndex = -1;
470
+ for (const item of this) {
471
+ if (predicateFn(item, index, this)) {
472
+ matchedIndex = index;
650
473
  }
651
- throw new UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
474
+ index++;
652
475
  }
476
+ return matchedIndex;
653
477
  }
654
478
  forEach(callback) {
655
- try {
656
- let index = 0;
657
- for (const item of this) {
658
- callback(item, index, this);
659
- index++;
660
- }
661
- }
662
- catch (error) {
663
- if (error instanceof CollectionError) {
664
- throw error;
665
- }
666
- throw new UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
479
+ let index = 0;
480
+ for (const item of this) {
481
+ callback(item, index, this);
482
+ index++;
667
483
  }
668
484
  }
669
485
  toArray() {
670
- try {
671
- return [...this];
672
- }
673
- catch (error) {
674
- if (error instanceof CollectionError) {
675
- throw error;
676
- }
677
- throw new UnexpectedCollectionError(`Unexpected error "${String(error)}" occured`, error);
678
- }
486
+ return [...this];
679
487
  }
680
488
  }
681
489
  //# sourceMappingURL=iterable-collection.js.map