@daiso-tech/core 0.15.0 → 0.17.4

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 (494) hide show
  1. package/dist/cjs/_module.js +2 -2
  2. package/dist/cjs/_module.js.map +1 -1
  3. package/dist/cjs/async/_module.js +1 -1
  4. package/dist/cjs/async/_module.js.map +1 -1
  5. package/dist/cjs/async/backof-policies/_module.js +1 -0
  6. package/dist/cjs/async/backof-policies/_module.js.map +1 -1
  7. package/dist/cjs/async/utilities/_module.js +3 -0
  8. package/dist/cjs/async/utilities/_module.js.map +1 -1
  9. package/dist/cjs/async/utilities/lazy-promise/lazy-promise.js +21 -12
  10. package/dist/cjs/async/utilities/lazy-promise/lazy-promise.js.map +1 -1
  11. package/dist/cjs/cache/contracts/cache.events.js +168 -0
  12. package/dist/cjs/cache/contracts/cache.events.js.map +1 -1
  13. package/dist/cjs/cache/implementations/_shared/_module.js +1 -0
  14. package/dist/cjs/cache/implementations/_shared/_module.js.map +1 -1
  15. package/dist/cjs/cache/implementations/_shared/cache-adapter.test-suite.js +256 -177
  16. package/dist/cjs/cache/implementations/_shared/cache-adapter.test-suite.js.map +1 -1
  17. package/dist/cjs/cache/implementations/_shared/cache.test-suite.js +23 -2
  18. package/dist/cjs/cache/implementations/_shared/cache.test-suite.js.map +1 -1
  19. package/dist/cjs/cache/implementations/adapters/kysely-sqlite-cache-adapter/kysely-sqlite-cache-adapter.js +63 -20
  20. package/dist/cjs/cache/implementations/adapters/kysely-sqlite-cache-adapter/kysely-sqlite-cache-adapter.js.map +1 -1
  21. package/dist/cjs/cache/implementations/adapters/libsql-cache-adapter/_module.js +2 -1
  22. package/dist/cjs/cache/implementations/adapters/libsql-cache-adapter/_module.js.map +1 -1
  23. package/dist/cjs/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter-settings.js +56 -0
  24. package/dist/cjs/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter-settings.js.map +1 -0
  25. package/dist/cjs/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter.js +30 -16
  26. package/dist/cjs/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter.js.map +1 -1
  27. package/dist/cjs/cache/implementations/adapters/memory-cache-adapter/_module.js +1 -0
  28. package/dist/cjs/cache/implementations/adapters/memory-cache-adapter/_module.js.map +1 -1
  29. package/dist/cjs/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter-settings.js +26 -0
  30. package/dist/cjs/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter-settings.js.map +1 -0
  31. package/dist/cjs/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter.js +66 -39
  32. package/dist/cjs/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter.js.map +1 -1
  33. package/dist/cjs/cache/implementations/adapters/mongodb-cache-adapter/_module.js +2 -1
  34. package/dist/cjs/cache/implementations/adapters/mongodb-cache-adapter/_module.js.map +1 -1
  35. package/dist/cjs/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter-settings.js +44 -0
  36. package/dist/cjs/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter-settings.js.map +1 -0
  37. package/dist/cjs/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter.js +78 -28
  38. package/dist/cjs/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter.js.map +1 -1
  39. package/dist/cjs/cache/implementations/adapters/no-op-cache-adapter/no-op-cache-adapter.js +10 -1
  40. package/dist/cjs/cache/implementations/adapters/no-op-cache-adapter/no-op-cache-adapter.js.map +1 -1
  41. package/dist/cjs/cache/implementations/adapters/redis-cache-adapter/_module.js +1 -0
  42. package/dist/cjs/cache/implementations/adapters/redis-cache-adapter/_module.js.map +1 -1
  43. package/dist/cjs/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter-settings.js +32 -0
  44. package/dist/cjs/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter-settings.js.map +1 -0
  45. package/dist/cjs/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.js +55 -23
  46. package/dist/cjs/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.js.map +1 -1
  47. package/dist/cjs/cache/implementations/adapters/sqlite-cache-adapter/_module.js +1 -0
  48. package/dist/cjs/cache/implementations/adapters/sqlite-cache-adapter/_module.js.map +1 -1
  49. package/dist/cjs/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter-settings.js +56 -0
  50. package/dist/cjs/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter-settings.js.map +1 -0
  51. package/dist/cjs/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.js +31 -17
  52. package/dist/cjs/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.js.map +1 -1
  53. package/dist/cjs/cache/implementations/derivables/_module.js +3 -2
  54. package/dist/cjs/cache/implementations/derivables/_module.js.map +1 -1
  55. package/dist/cjs/cache/implementations/derivables/cache-factory-settings.js +65 -0
  56. package/dist/cjs/cache/implementations/derivables/cache-factory-settings.js.map +1 -0
  57. package/dist/cjs/cache/implementations/derivables/cache-factory.js +29 -18
  58. package/dist/cjs/cache/implementations/derivables/cache-factory.js.map +1 -1
  59. package/dist/cjs/cache/implementations/derivables/cache-settings.js +56 -0
  60. package/dist/cjs/cache/implementations/derivables/cache-settings.js.map +1 -0
  61. package/dist/cjs/cache/implementations/derivables/cache.js +334 -79
  62. package/dist/cjs/cache/implementations/derivables/cache.js.map +1 -1
  63. package/dist/cjs/collection/implementations/async-iterable-collection/_shared/async-merge-iterable.js +14 -7
  64. package/dist/cjs/collection/implementations/async-iterable-collection/_shared/async-merge-iterable.js.map +1 -1
  65. package/dist/cjs/collection/implementations/async-iterable-collection/_shared/async-retry-iterable.js +1 -1
  66. package/dist/cjs/collection/implementations/async-iterable-collection/_shared/async-retry-iterable.js.map +1 -1
  67. package/dist/cjs/collection/implementations/async-iterable-collection/_shared/async-take-until-abort-iterable.js +1 -1
  68. package/dist/cjs/collection/implementations/async-iterable-collection/_shared/async-take-until-abort-iterable.js.map +1 -1
  69. package/dist/cjs/collection/implementations/async-iterable-collection/_shared/async-take-until-timeout-iterable.js +1 -1
  70. package/dist/cjs/collection/implementations/async-iterable-collection/_shared/async-take-until-timeout-iterable.js.map +1 -1
  71. package/dist/cjs/collection/implementations/async-iterable-collection/async-iterable-collection.js +62 -41
  72. package/dist/cjs/collection/implementations/async-iterable-collection/async-iterable-collection.js.map +1 -1
  73. package/dist/cjs/collection/implementations/iterable-collection/_shared/merge-iterable.js +6 -7
  74. package/dist/cjs/collection/implementations/iterable-collection/_shared/merge-iterable.js.map +1 -1
  75. package/dist/cjs/collection/implementations/iterable-collection/iterable-collection.js +11 -2
  76. package/dist/cjs/collection/implementations/iterable-collection/iterable-collection.js.map +1 -1
  77. package/dist/cjs/collection/implementations/list-collection/list-collection.js +13 -0
  78. package/dist/cjs/collection/implementations/list-collection/list-collection.js.map +1 -1
  79. package/dist/cjs/event-bus/contracts/_module.js +2 -2
  80. package/dist/cjs/event-bus/contracts/_module.js.map +1 -1
  81. package/dist/cjs/event-bus/contracts/_shared.js +7 -0
  82. package/dist/cjs/event-bus/contracts/_shared.js.map +1 -1
  83. package/dist/cjs/event-bus/implementations/_shared/event-bus-adapter.test-suite.js +98 -38
  84. package/dist/cjs/event-bus/implementations/_shared/event-bus-adapter.test-suite.js.map +1 -1
  85. package/dist/cjs/event-bus/implementations/_shared/event-bus.test-suite.js +197 -125
  86. package/dist/cjs/event-bus/implementations/_shared/event-bus.test-suite.js.map +1 -1
  87. package/dist/cjs/event-bus/implementations/adapters/_module.js +1 -1
  88. package/dist/cjs/event-bus/implementations/adapters/_module.js.map +1 -1
  89. package/dist/cjs/event-bus/implementations/adapters/memory-event-bus-adapter/_module.js +2 -1
  90. package/dist/cjs/event-bus/implementations/adapters/memory-event-bus-adapter/_module.js.map +1 -1
  91. package/dist/cjs/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter-settings.js +26 -0
  92. package/dist/cjs/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter-settings.js.map +1 -0
  93. package/dist/cjs/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter.js +29 -11
  94. package/dist/cjs/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter.js.map +1 -1
  95. package/dist/cjs/event-bus/implementations/adapters/no-op-event-bus-adapter/no-op-event-bus-adapter.js +9 -3
  96. package/dist/cjs/event-bus/implementations/adapters/no-op-event-bus-adapter/no-op-event-bus-adapter.js.map +1 -1
  97. package/dist/cjs/{serializer/implementations/_shared/test-utilities → event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter}/_module.js +2 -1
  98. package/dist/cjs/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/_module.js.map +1 -0
  99. package/dist/cjs/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter-settings.js +38 -0
  100. package/dist/cjs/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter-settings.js.map +1 -0
  101. package/dist/cjs/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter.js +56 -0
  102. package/dist/cjs/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter.js.map +1 -0
  103. package/dist/cjs/event-bus/implementations/derivables/_module.js +3 -1
  104. package/dist/cjs/event-bus/implementations/derivables/_module.js.map +1 -1
  105. package/dist/cjs/event-bus/implementations/derivables/event-bus-factory-settings.js +59 -0
  106. package/dist/cjs/event-bus/implementations/derivables/event-bus-factory-settings.js.map +1 -0
  107. package/dist/cjs/event-bus/implementations/derivables/event-bus-factory.js +28 -17
  108. package/dist/cjs/event-bus/implementations/derivables/event-bus-factory.js.map +1 -1
  109. package/dist/cjs/event-bus/implementations/derivables/event-bus-settings.js +56 -0
  110. package/dist/cjs/event-bus/implementations/derivables/event-bus-settings.js.map +1 -0
  111. package/dist/cjs/event-bus/implementations/derivables/event-bus.js +106 -37
  112. package/dist/cjs/event-bus/implementations/derivables/event-bus.js.map +1 -1
  113. package/dist/cjs/serde/contracts/_module.js +23 -0
  114. package/dist/cjs/serde/contracts/_module.js.map +1 -0
  115. package/dist/cjs/serde/contracts/deserializer.contract.js +3 -0
  116. package/dist/cjs/serde/contracts/deserializer.contract.js.map +1 -0
  117. package/dist/cjs/serde/contracts/flexible-serde.contract.js +3 -0
  118. package/dist/cjs/serde/contracts/flexible-serde.contract.js.map +1 -0
  119. package/dist/cjs/serde/contracts/serde.contract.js +3 -0
  120. package/dist/cjs/serde/contracts/serde.contract.js.map +1 -0
  121. package/dist/cjs/{serializer/contracts/serializer.errors.js → serde/contracts/serde.errors.js} +7 -7
  122. package/dist/cjs/serde/contracts/serde.errors.js.map +1 -0
  123. package/dist/cjs/serde/contracts/serializable.contract.js +3 -0
  124. package/dist/cjs/serde/contracts/serializable.contract.js.map +1 -0
  125. package/dist/cjs/serde/contracts/serializer.contract.js.map +1 -0
  126. package/dist/cjs/{serializer → serde}/implementations/_module.js +6 -5
  127. package/dist/cjs/serde/implementations/_module.js.map +1 -0
  128. package/dist/cjs/{serializer/contracts → serde/implementations/_shared/test-utilities}/_module.js +2 -2
  129. package/dist/cjs/serde/implementations/_shared/test-utilities/_module.js.map +1 -0
  130. package/dist/cjs/serde/implementations/_shared/test-utilities/flexible-serde.test-suite.js +53 -0
  131. package/dist/cjs/serde/implementations/_shared/test-utilities/flexible-serde.test-suite.js.map +1 -0
  132. package/dist/cjs/{serializer/implementations/_shared/test-utilities/serializer.test-suite.js → serde/implementations/_shared/test-utilities/serde.test-suite.js} +68 -93
  133. package/dist/cjs/serde/implementations/_shared/test-utilities/serde.test-suite.js.map +1 -0
  134. package/dist/cjs/{serializer/implementations/sql-serializer → serde/implementations/mongodb-serde}/_module.js +1 -1
  135. package/dist/cjs/serde/implementations/mongodb-serde/_module.js.map +1 -0
  136. package/dist/cjs/serde/implementations/mongodb-serde/mongodb-serde.js +36 -0
  137. package/dist/cjs/serde/implementations/mongodb-serde/mongodb-serde.js.map +1 -0
  138. package/dist/cjs/{serializer/implementations/redis-serializer → serde/implementations/no-op-serde}/_module.js +1 -1
  139. package/dist/cjs/serde/implementations/no-op-serde/_module.js.map +1 -0
  140. package/dist/cjs/serde/implementations/no-op-serde/no-op-serde.js +16 -0
  141. package/dist/cjs/serde/implementations/no-op-serde/no-op-serde.js.map +1 -0
  142. package/dist/cjs/{serializer/implementations/mongodb-serializer → serde/implementations/redis-serde}/_module.js +1 -1
  143. package/dist/cjs/serde/implementations/redis-serde/_module.js.map +1 -0
  144. package/dist/cjs/serde/implementations/redis-serde/redis-serde.js +37 -0
  145. package/dist/cjs/serde/implementations/redis-serde/redis-serde.js.map +1 -0
  146. package/dist/cjs/{event-bus/implementations/adapters/redis-event-bus-adapter → serde/implementations/sql-serde}/_module.js +1 -1
  147. package/dist/cjs/serde/implementations/sql-serde/_module.js.map +1 -0
  148. package/dist/cjs/serde/implementations/sql-serde/sql-serde.js +37 -0
  149. package/dist/cjs/serde/implementations/sql-serde/sql-serde.js.map +1 -0
  150. package/dist/cjs/serde/implementations/super-json-serde/_module.js +18 -0
  151. package/dist/cjs/serde/implementations/super-json-serde/_module.js.map +1 -0
  152. package/dist/cjs/{serializer/implementations/super-json-serializer/super-json-serializer.js → serde/implementations/super-json-serde/super-json-serde.js} +77 -100
  153. package/dist/cjs/serde/implementations/super-json-serde/super-json-serde.js.map +1 -0
  154. package/dist/cjs/utilities/contracts/_module.js +1 -0
  155. package/dist/cjs/utilities/contracts/_module.js.map +1 -1
  156. package/dist/cjs/utilities/contracts/buildable.contract.js +3 -0
  157. package/dist/cjs/utilities/contracts/buildable.contract.js.map +1 -0
  158. package/dist/cjs/utilities/errors.js +10 -10
  159. package/dist/cjs/utilities/errors.js.map +1 -1
  160. package/dist/cjs/utilities/functions.js +9 -5
  161. package/dist/cjs/utilities/functions.js.map +1 -1
  162. package/dist/cjs/utilities/time-span/time-span.js +8 -0
  163. package/dist/cjs/utilities/time-span/time-span.js.map +1 -1
  164. package/dist/esm/_module.js +2 -2
  165. package/dist/esm/_module.js.map +1 -1
  166. package/dist/esm/async/_module.js +1 -1
  167. package/dist/esm/async/_module.js.map +1 -1
  168. package/dist/esm/async/backof-policies/_module.js +1 -0
  169. package/dist/esm/async/backof-policies/_module.js.map +1 -1
  170. package/dist/esm/async/utilities/_module.js +3 -0
  171. package/dist/esm/async/utilities/_module.js.map +1 -1
  172. package/dist/esm/async/utilities/lazy-promise/lazy-promise.js +21 -12
  173. package/dist/esm/async/utilities/lazy-promise/lazy-promise.js.map +1 -1
  174. package/dist/esm/cache/contracts/cache.events.js +158 -0
  175. package/dist/esm/cache/contracts/cache.events.js.map +1 -1
  176. package/dist/esm/cache/implementations/_shared/_module.js +1 -0
  177. package/dist/esm/cache/implementations/_shared/_module.js.map +1 -1
  178. package/dist/esm/cache/implementations/_shared/cache-adapter.test-suite.js +256 -177
  179. package/dist/esm/cache/implementations/_shared/cache-adapter.test-suite.js.map +1 -1
  180. package/dist/esm/cache/implementations/_shared/cache.test-suite.js +23 -2
  181. package/dist/esm/cache/implementations/_shared/cache.test-suite.js.map +1 -1
  182. package/dist/esm/cache/implementations/adapters/kysely-sqlite-cache-adapter/kysely-sqlite-cache-adapter.js +64 -21
  183. package/dist/esm/cache/implementations/adapters/kysely-sqlite-cache-adapter/kysely-sqlite-cache-adapter.js.map +1 -1
  184. package/dist/esm/cache/implementations/adapters/libsql-cache-adapter/_module.js +2 -1
  185. package/dist/esm/cache/implementations/adapters/libsql-cache-adapter/_module.js.map +1 -1
  186. package/dist/esm/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter-settings.js +52 -0
  187. package/dist/esm/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter-settings.js.map +1 -0
  188. package/dist/esm/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter.js +29 -15
  189. package/dist/esm/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter.js.map +1 -1
  190. package/dist/esm/cache/implementations/adapters/memory-cache-adapter/_module.js +1 -0
  191. package/dist/esm/cache/implementations/adapters/memory-cache-adapter/_module.js.map +1 -1
  192. package/dist/esm/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter-settings.js +22 -0
  193. package/dist/esm/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter-settings.js.map +1 -0
  194. package/dist/esm/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter.js +66 -39
  195. package/dist/esm/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter.js.map +1 -1
  196. package/dist/esm/cache/implementations/adapters/mongodb-cache-adapter/_module.js +2 -1
  197. package/dist/esm/cache/implementations/adapters/mongodb-cache-adapter/_module.js.map +1 -1
  198. package/dist/esm/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter-settings.js +40 -0
  199. package/dist/esm/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter-settings.js.map +1 -0
  200. package/dist/esm/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter.js +78 -25
  201. package/dist/esm/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter.js.map +1 -1
  202. package/dist/esm/cache/implementations/adapters/no-op-cache-adapter/no-op-cache-adapter.js +10 -1
  203. package/dist/esm/cache/implementations/adapters/no-op-cache-adapter/no-op-cache-adapter.js.map +1 -1
  204. package/dist/esm/cache/implementations/adapters/redis-cache-adapter/_module.js +1 -0
  205. package/dist/esm/cache/implementations/adapters/redis-cache-adapter/_module.js.map +1 -1
  206. package/dist/esm/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter-settings.js +28 -0
  207. package/dist/esm/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter-settings.js.map +1 -0
  208. package/dist/esm/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.js +55 -23
  209. package/dist/esm/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.js.map +1 -1
  210. package/dist/esm/cache/implementations/adapters/sqlite-cache-adapter/_module.js +1 -0
  211. package/dist/esm/cache/implementations/adapters/sqlite-cache-adapter/_module.js.map +1 -1
  212. package/dist/esm/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter-settings.js +52 -0
  213. package/dist/esm/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter-settings.js.map +1 -0
  214. package/dist/esm/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.js +29 -15
  215. package/dist/esm/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.js.map +1 -1
  216. package/dist/esm/cache/implementations/derivables/_module.js +3 -2
  217. package/dist/esm/cache/implementations/derivables/_module.js.map +1 -1
  218. package/dist/esm/cache/implementations/derivables/cache-factory-settings.js +61 -0
  219. package/dist/esm/cache/implementations/derivables/cache-factory-settings.js.map +1 -0
  220. package/dist/esm/cache/implementations/derivables/cache-factory.js +30 -19
  221. package/dist/esm/cache/implementations/derivables/cache-factory.js.map +1 -1
  222. package/dist/esm/cache/implementations/derivables/cache-settings.js +52 -0
  223. package/dist/esm/cache/implementations/derivables/cache-settings.js.map +1 -0
  224. package/dist/esm/cache/implementations/derivables/cache.js +333 -78
  225. package/dist/esm/cache/implementations/derivables/cache.js.map +1 -1
  226. package/dist/esm/collection/implementations/async-iterable-collection/_shared/async-merge-iterable.js +14 -7
  227. package/dist/esm/collection/implementations/async-iterable-collection/_shared/async-merge-iterable.js.map +1 -1
  228. package/dist/esm/collection/implementations/async-iterable-collection/_shared/async-retry-iterable.js +1 -1
  229. package/dist/esm/collection/implementations/async-iterable-collection/_shared/async-retry-iterable.js.map +1 -1
  230. package/dist/esm/collection/implementations/async-iterable-collection/_shared/async-take-until-abort-iterable.js +1 -1
  231. package/dist/esm/collection/implementations/async-iterable-collection/_shared/async-take-until-abort-iterable.js.map +1 -1
  232. package/dist/esm/collection/implementations/async-iterable-collection/_shared/async-take-until-timeout-iterable.js +1 -1
  233. package/dist/esm/collection/implementations/async-iterable-collection/_shared/async-take-until-timeout-iterable.js.map +1 -1
  234. package/dist/esm/collection/implementations/async-iterable-collection/async-iterable-collection.js +62 -41
  235. package/dist/esm/collection/implementations/async-iterable-collection/async-iterable-collection.js.map +1 -1
  236. package/dist/esm/collection/implementations/iterable-collection/_shared/merge-iterable.js +6 -7
  237. package/dist/esm/collection/implementations/iterable-collection/_shared/merge-iterable.js.map +1 -1
  238. package/dist/esm/collection/implementations/iterable-collection/iterable-collection.js +11 -2
  239. package/dist/esm/collection/implementations/iterable-collection/iterable-collection.js.map +1 -1
  240. package/dist/esm/collection/implementations/list-collection/list-collection.js +13 -0
  241. package/dist/esm/collection/implementations/list-collection/list-collection.js.map +1 -1
  242. package/dist/esm/event-bus/contracts/_module.js +2 -2
  243. package/dist/esm/event-bus/contracts/_module.js.map +1 -1
  244. package/dist/esm/event-bus/contracts/_shared.js +5 -0
  245. package/dist/esm/event-bus/contracts/_shared.js.map +1 -1
  246. package/dist/esm/event-bus/implementations/_shared/event-bus-adapter.test-suite.js +96 -36
  247. package/dist/esm/event-bus/implementations/_shared/event-bus-adapter.test-suite.js.map +1 -1
  248. package/dist/esm/event-bus/implementations/_shared/event-bus.test-suite.js +195 -123
  249. package/dist/esm/event-bus/implementations/_shared/event-bus.test-suite.js.map +1 -1
  250. package/dist/esm/event-bus/implementations/adapters/_module.js +1 -1
  251. package/dist/esm/event-bus/implementations/adapters/_module.js.map +1 -1
  252. package/dist/esm/event-bus/implementations/adapters/memory-event-bus-adapter/_module.js +2 -1
  253. package/dist/esm/event-bus/implementations/adapters/memory-event-bus-adapter/_module.js.map +1 -1
  254. package/dist/esm/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter-settings.js +22 -0
  255. package/dist/esm/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter-settings.js.map +1 -0
  256. package/dist/esm/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter.js +29 -11
  257. package/dist/esm/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter.js.map +1 -1
  258. package/dist/esm/event-bus/implementations/adapters/no-op-event-bus-adapter/no-op-event-bus-adapter.js +9 -3
  259. package/dist/esm/event-bus/implementations/adapters/no-op-event-bus-adapter/no-op-event-bus-adapter.js.map +1 -1
  260. package/dist/esm/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/_module.js +3 -0
  261. package/dist/esm/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/_module.js.map +1 -0
  262. package/dist/esm/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter-settings.js +34 -0
  263. package/dist/esm/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter-settings.js.map +1 -0
  264. package/dist/esm/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter.js +52 -0
  265. package/dist/esm/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter.js.map +1 -0
  266. package/dist/esm/event-bus/implementations/derivables/_module.js +3 -1
  267. package/dist/esm/event-bus/implementations/derivables/_module.js.map +1 -1
  268. package/dist/esm/event-bus/implementations/derivables/event-bus-factory-settings.js +55 -0
  269. package/dist/esm/event-bus/implementations/derivables/event-bus-factory-settings.js.map +1 -0
  270. package/dist/esm/event-bus/implementations/derivables/event-bus-factory.js +29 -18
  271. package/dist/esm/event-bus/implementations/derivables/event-bus-factory.js.map +1 -1
  272. package/dist/esm/event-bus/implementations/derivables/event-bus-settings.js +52 -0
  273. package/dist/esm/event-bus/implementations/derivables/event-bus-settings.js.map +1 -0
  274. package/dist/esm/event-bus/implementations/derivables/event-bus.js +108 -39
  275. package/dist/esm/event-bus/implementations/derivables/event-bus.js.map +1 -1
  276. package/dist/esm/serde/contracts/_module.js +7 -0
  277. package/dist/esm/serde/contracts/_module.js.map +1 -0
  278. package/dist/esm/serde/contracts/deserializer.contract.js +1 -0
  279. package/dist/esm/serde/contracts/deserializer.contract.js.map +1 -0
  280. package/dist/esm/serde/contracts/flexible-serde.contract.js +1 -0
  281. package/dist/esm/serde/contracts/flexible-serde.contract.js.map +1 -0
  282. package/dist/esm/serde/contracts/serde.contract.js +1 -0
  283. package/dist/esm/serde/contracts/serde.contract.js.map +1 -0
  284. package/dist/esm/{serializer/contracts/serializer.errors.js → serde/contracts/serde.errors.js} +5 -5
  285. package/dist/esm/serde/contracts/serde.errors.js.map +1 -0
  286. package/dist/esm/serde/contracts/serializable.contract.js +1 -0
  287. package/dist/esm/serde/contracts/serializable.contract.js.map +1 -0
  288. package/dist/esm/serde/contracts/serializer.contract.js.map +1 -0
  289. package/dist/esm/serde/implementations/_module.js +7 -0
  290. package/dist/esm/serde/implementations/_module.js.map +1 -0
  291. package/dist/esm/serde/implementations/_shared/test-utilities/_module.js +3 -0
  292. package/dist/esm/serde/implementations/_shared/test-utilities/_module.js.map +1 -0
  293. package/dist/esm/serde/implementations/_shared/test-utilities/flexible-serde.test-suite.js +50 -0
  294. package/dist/esm/serde/implementations/_shared/test-utilities/flexible-serde.test-suite.js.map +1 -0
  295. package/dist/esm/{serializer/implementations/_shared/test-utilities/serializer.test-suite.js → serde/implementations/_shared/test-utilities/serde.test-suite.js} +67 -92
  296. package/dist/esm/serde/implementations/_shared/test-utilities/serde.test-suite.js.map +1 -0
  297. package/dist/esm/serde/implementations/mongodb-serde/_module.js +2 -0
  298. package/dist/esm/serde/implementations/mongodb-serde/_module.js.map +1 -0
  299. package/dist/esm/{serializer/implementations/mongodb-serializer/mongodb-serializer.js → serde/implementations/mongodb-serde/mongodb-serde.js} +10 -10
  300. package/dist/esm/serde/implementations/mongodb-serde/mongodb-serde.js.map +1 -0
  301. package/dist/esm/serde/implementations/no-op-serde/_module.js +2 -0
  302. package/dist/esm/serde/implementations/no-op-serde/_module.js.map +1 -0
  303. package/dist/esm/serde/implementations/no-op-serde/no-op-serde.js +12 -0
  304. package/dist/esm/serde/implementations/no-op-serde/no-op-serde.js.map +1 -0
  305. package/dist/esm/serde/implementations/redis-serde/_module.js +2 -0
  306. package/dist/esm/serde/implementations/redis-serde/_module.js.map +1 -0
  307. package/dist/esm/{serializer/implementations/sql-serializer/sql-serializer.js → serde/implementations/redis-serde/redis-serde.js} +10 -10
  308. package/dist/esm/serde/implementations/redis-serde/redis-serde.js.map +1 -0
  309. package/dist/esm/serde/implementations/sql-serde/_module.js +2 -0
  310. package/dist/esm/serde/implementations/sql-serde/_module.js.map +1 -0
  311. package/dist/esm/{serializer/implementations/redis-serializer/redis-serializer.js → serde/implementations/sql-serde/sql-serde.js} +10 -10
  312. package/dist/esm/serde/implementations/sql-serde/sql-serde.js.map +1 -0
  313. package/dist/esm/serde/implementations/super-json-serde/_module.js +2 -0
  314. package/dist/esm/serde/implementations/super-json-serde/_module.js.map +1 -0
  315. package/dist/esm/{serializer/implementations/super-json-serializer/super-json-serializer.js → serde/implementations/super-json-serde/super-json-serde.js} +55 -55
  316. package/dist/esm/serde/implementations/super-json-serde/super-json-serde.js.map +1 -0
  317. package/dist/esm/utilities/contracts/_module.js +1 -0
  318. package/dist/esm/utilities/contracts/_module.js.map +1 -1
  319. package/dist/esm/utilities/contracts/buildable.contract.js +1 -0
  320. package/dist/esm/utilities/contracts/buildable.contract.js.map +1 -0
  321. package/dist/esm/utilities/errors.js +7 -7
  322. package/dist/esm/utilities/errors.js.map +1 -1
  323. package/dist/esm/utilities/functions.js +7 -4
  324. package/dist/esm/utilities/functions.js.map +1 -1
  325. package/dist/esm/utilities/time-span/time-span.js +8 -0
  326. package/dist/esm/utilities/time-span/time-span.js.map +1 -1
  327. package/dist/types/_module.d.ts +2 -2
  328. package/dist/types/async/_module.d.ts +1 -1
  329. package/dist/types/async/backof-policies/_module.d.ts +1 -1
  330. package/dist/types/async/utilities/_module.d.ts +3 -0
  331. package/dist/types/async/utilities/lazy-promise/lazy-promise.d.ts +66 -39
  332. package/dist/types/cache/contracts/cache-adapter.contract.d.ts +20 -6
  333. package/dist/types/cache/contracts/cache-factory.contract.d.ts +12 -25
  334. package/dist/types/cache/contracts/cache.contract.d.ts +382 -22
  335. package/dist/types/cache/contracts/cache.events.d.ts +156 -42
  336. package/dist/types/cache/implementations/_shared/_module.d.ts +1 -0
  337. package/dist/types/cache/implementations/_shared/cache-adapter.test-suite.d.ts +21 -12
  338. package/dist/types/cache/implementations/_shared/cache.test-suite.d.ts +21 -15
  339. package/dist/types/cache/implementations/adapters/kysely-sqlite-cache-adapter/kysely-sqlite-cache-adapter.d.ts +15 -8
  340. package/dist/types/cache/implementations/adapters/libsql-cache-adapter/_module.d.ts +2 -1
  341. package/dist/types/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter-settings.d.ts +48 -0
  342. package/dist/types/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter.d.ts +54 -36
  343. package/dist/types/cache/implementations/adapters/memory-cache-adapter/_module.d.ts +1 -0
  344. package/dist/types/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter-settings.d.ts +27 -0
  345. package/dist/types/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter.d.ts +50 -20
  346. package/dist/types/cache/implementations/adapters/mongodb-cache-adapter/_module.d.ts +2 -1
  347. package/dist/types/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter-settings.d.ts +51 -0
  348. package/dist/types/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter.d.ts +66 -41
  349. package/dist/types/cache/implementations/adapters/no-op-cache-adapter/no-op-cache-adapter.d.ts +6 -3
  350. package/dist/types/cache/implementations/adapters/redis-cache-adapter/_module.d.ts +1 -0
  351. package/dist/types/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter-settings.d.ts +32 -0
  352. package/dist/types/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.d.ts +51 -29
  353. package/dist/types/cache/implementations/adapters/sqlite-cache-adapter/_module.d.ts +1 -0
  354. package/dist/types/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter-settings.d.ts +48 -0
  355. package/dist/types/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.d.ts +54 -34
  356. package/dist/types/cache/implementations/derivables/_module.d.ts +3 -2
  357. package/dist/types/cache/implementations/derivables/cache-factory-settings.d.ts +77 -0
  358. package/dist/types/cache/implementations/derivables/cache-factory.d.ts +59 -45
  359. package/dist/types/cache/implementations/derivables/cache-settings.d.ts +68 -0
  360. package/dist/types/cache/implementations/derivables/cache.d.ts +83 -62
  361. package/dist/types/collection/contracts/async-collection.contract.d.ts +1247 -666
  362. package/dist/types/collection/contracts/collection.contract.d.ts +1195 -638
  363. package/dist/types/collection/implementations/async-iterable-collection/_shared/async-merge-iterable.d.ts +4 -5
  364. package/dist/types/collection/implementations/async-iterable-collection/_shared/async-retry-iterable.d.ts +1 -1
  365. package/dist/types/collection/implementations/async-iterable-collection/async-iterable-collection.d.ts +194 -3
  366. package/dist/types/collection/implementations/iterable-collection/_shared/merge-iterable.d.ts +4 -5
  367. package/dist/types/collection/implementations/iterable-collection/iterable-collection.d.ts +141 -1
  368. package/dist/types/collection/implementations/list-collection/list-collection.d.ts +141 -1
  369. package/dist/types/event-bus/contracts/_module.d.ts +2 -2
  370. package/dist/types/event-bus/contracts/_shared.d.ts +11 -0
  371. package/dist/types/event-bus/contracts/event-bus-adapter.contract.d.ts +9 -8
  372. package/dist/types/event-bus/contracts/event-bus-factory.contract.d.ts +38 -32
  373. package/dist/types/event-bus/contracts/event-bus.contract.d.ts +52 -37
  374. package/dist/types/event-bus/implementations/_shared/event-bus-adapter.test-suite.d.ts +22 -10
  375. package/dist/types/event-bus/implementations/_shared/event-bus.test-suite.d.ts +16 -13
  376. package/dist/types/event-bus/implementations/adapters/_module.d.ts +1 -1
  377. package/dist/types/event-bus/implementations/adapters/memory-event-bus-adapter/_module.d.ts +2 -1
  378. package/dist/types/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter-settings.d.ts +28 -0
  379. package/dist/types/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter.d.ts +53 -22
  380. package/dist/types/event-bus/implementations/adapters/no-op-event-bus-adapter/no-op-event-bus-adapter.d.ts +7 -4
  381. package/dist/types/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/_module.d.ts +2 -0
  382. package/dist/types/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter-settings.d.ts +36 -0
  383. package/dist/types/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter.d.ts +62 -0
  384. package/dist/types/event-bus/implementations/derivables/_module.d.ts +3 -1
  385. package/dist/types/event-bus/implementations/derivables/event-bus-factory-settings.d.ts +70 -0
  386. package/dist/types/event-bus/implementations/derivables/event-bus-factory.d.ts +40 -24
  387. package/dist/types/event-bus/implementations/derivables/event-bus-settings.d.ts +58 -0
  388. package/dist/types/event-bus/implementations/derivables/event-bus.d.ts +31 -45
  389. package/dist/types/serde/contracts/_module.d.ts +6 -0
  390. package/dist/types/serde/contracts/deserializer.contract.d.ts +13 -0
  391. package/dist/types/serde/contracts/flexible-serde.contract.d.ts +56 -0
  392. package/dist/types/serde/contracts/serde.contract.d.ts +10 -0
  393. package/dist/types/{serializer/contracts/serializer.errors.d.ts → serde/contracts/serde.errors.d.ts} +4 -4
  394. package/dist/types/serde/contracts/serializable.contract.d.ts +10 -0
  395. package/dist/types/serde/contracts/serializer.contract.d.ts +10 -0
  396. package/dist/types/serde/implementations/_module.d.ts +6 -0
  397. package/dist/types/serde/implementations/_shared/test-utilities/_module.d.ts +2 -0
  398. package/dist/types/serde/implementations/_shared/test-utilities/flexible-serde.test-suite.d.ts +17 -0
  399. package/dist/types/serde/implementations/_shared/test-utilities/serde.test-suite.d.ts +17 -0
  400. package/dist/types/serde/implementations/mongodb-serde/_module.d.ts +1 -0
  401. package/dist/types/serde/implementations/mongodb-serde/mongodb-serde.d.ts +13 -0
  402. package/dist/types/serde/implementations/no-op-serde/_module.d.ts +1 -0
  403. package/dist/types/serde/implementations/no-op-serde/no-op-serde.d.ts +13 -0
  404. package/dist/types/serde/implementations/redis-serde/_module.d.ts +1 -0
  405. package/dist/types/serde/implementations/redis-serde/redis-serde.d.ts +13 -0
  406. package/dist/types/serde/implementations/sql-serde/_module.d.ts +1 -0
  407. package/dist/types/serde/implementations/sql-serde/sql-serde.d.ts +13 -0
  408. package/dist/types/serde/implementations/super-json-serde/_module.d.ts +1 -0
  409. package/dist/types/serde/implementations/super-json-serde/super-json-serde.d.ts +25 -0
  410. package/dist/types/utilities/contracts/_module.d.ts +1 -0
  411. package/dist/types/utilities/contracts/buildable.contract.d.ts +9 -0
  412. package/dist/types/utilities/errors.d.ts +3 -3
  413. package/dist/types/utilities/functions.d.ts +5 -1
  414. package/dist/types/utilities/time-span/time-span.d.ts +10 -1
  415. package/dist/types/utilities/types.d.ts +0 -1
  416. package/package.json +3 -9
  417. package/dist/cjs/cache/implementations/derivables/base-cache.js +0 -270
  418. package/dist/cjs/cache/implementations/derivables/base-cache.js.map +0 -1
  419. package/dist/cjs/event-bus/implementations/adapters/redis-event-bus-adapter/_module.js.map +0 -1
  420. package/dist/cjs/event-bus/implementations/adapters/redis-event-bus-adapter/redis-event-bus-adapter.js +0 -44
  421. package/dist/cjs/event-bus/implementations/adapters/redis-event-bus-adapter/redis-event-bus-adapter.js.map +0 -1
  422. package/dist/cjs/event-bus/implementations/derivables/base-event-bus.js +0 -47
  423. package/dist/cjs/event-bus/implementations/derivables/base-event-bus.js.map +0 -1
  424. package/dist/cjs/event-bus/implementations/derivables/with-namespace-event-bus-adapter.js +0 -42
  425. package/dist/cjs/event-bus/implementations/derivables/with-namespace-event-bus-adapter.js.map +0 -1
  426. package/dist/cjs/serializer/contracts/_module.js.map +0 -1
  427. package/dist/cjs/serializer/contracts/serializer.contract.js.map +0 -1
  428. package/dist/cjs/serializer/contracts/serializer.errors.js.map +0 -1
  429. package/dist/cjs/serializer/implementations/_module.js.map +0 -1
  430. package/dist/cjs/serializer/implementations/_shared/test-utilities/_module.js.map +0 -1
  431. package/dist/cjs/serializer/implementations/_shared/test-utilities/serializer.test-suite.js.map +0 -1
  432. package/dist/cjs/serializer/implementations/mongodb-serializer/_module.js.map +0 -1
  433. package/dist/cjs/serializer/implementations/mongodb-serializer/mongodb-serializer.js +0 -36
  434. package/dist/cjs/serializer/implementations/mongodb-serializer/mongodb-serializer.js.map +0 -1
  435. package/dist/cjs/serializer/implementations/redis-serializer/_module.js.map +0 -1
  436. package/dist/cjs/serializer/implementations/redis-serializer/redis-serializer.js +0 -37
  437. package/dist/cjs/serializer/implementations/redis-serializer/redis-serializer.js.map +0 -1
  438. package/dist/cjs/serializer/implementations/sql-serializer/_module.js.map +0 -1
  439. package/dist/cjs/serializer/implementations/sql-serializer/sql-serializer.js +0 -37
  440. package/dist/cjs/serializer/implementations/sql-serializer/sql-serializer.js.map +0 -1
  441. package/dist/cjs/serializer/implementations/super-json-serializer/_module.js +0 -18
  442. package/dist/cjs/serializer/implementations/super-json-serializer/_module.js.map +0 -1
  443. package/dist/cjs/serializer/implementations/super-json-serializer/super-json-serializer.js.map +0 -1
  444. package/dist/esm/cache/implementations/derivables/base-cache.js +0 -266
  445. package/dist/esm/cache/implementations/derivables/base-cache.js.map +0 -1
  446. package/dist/esm/event-bus/implementations/adapters/redis-event-bus-adapter/_module.js +0 -2
  447. package/dist/esm/event-bus/implementations/adapters/redis-event-bus-adapter/_module.js.map +0 -1
  448. package/dist/esm/event-bus/implementations/adapters/redis-event-bus-adapter/redis-event-bus-adapter.js +0 -40
  449. package/dist/esm/event-bus/implementations/adapters/redis-event-bus-adapter/redis-event-bus-adapter.js.map +0 -1
  450. package/dist/esm/event-bus/implementations/derivables/base-event-bus.js +0 -43
  451. package/dist/esm/event-bus/implementations/derivables/base-event-bus.js.map +0 -1
  452. package/dist/esm/event-bus/implementations/derivables/with-namespace-event-bus-adapter.js +0 -38
  453. package/dist/esm/event-bus/implementations/derivables/with-namespace-event-bus-adapter.js.map +0 -1
  454. package/dist/esm/serializer/contracts/_module.js +0 -3
  455. package/dist/esm/serializer/contracts/_module.js.map +0 -1
  456. package/dist/esm/serializer/contracts/serializer.contract.js.map +0 -1
  457. package/dist/esm/serializer/contracts/serializer.errors.js.map +0 -1
  458. package/dist/esm/serializer/implementations/_module.js +0 -6
  459. package/dist/esm/serializer/implementations/_module.js.map +0 -1
  460. package/dist/esm/serializer/implementations/_shared/test-utilities/_module.js +0 -2
  461. package/dist/esm/serializer/implementations/_shared/test-utilities/_module.js.map +0 -1
  462. package/dist/esm/serializer/implementations/_shared/test-utilities/serializer.test-suite.js.map +0 -1
  463. package/dist/esm/serializer/implementations/mongodb-serializer/_module.js +0 -2
  464. package/dist/esm/serializer/implementations/mongodb-serializer/_module.js.map +0 -1
  465. package/dist/esm/serializer/implementations/mongodb-serializer/mongodb-serializer.js.map +0 -1
  466. package/dist/esm/serializer/implementations/redis-serializer/_module.js +0 -2
  467. package/dist/esm/serializer/implementations/redis-serializer/_module.js.map +0 -1
  468. package/dist/esm/serializer/implementations/redis-serializer/redis-serializer.js.map +0 -1
  469. package/dist/esm/serializer/implementations/sql-serializer/_module.js +0 -2
  470. package/dist/esm/serializer/implementations/sql-serializer/_module.js.map +0 -1
  471. package/dist/esm/serializer/implementations/sql-serializer/sql-serializer.js.map +0 -1
  472. package/dist/esm/serializer/implementations/super-json-serializer/_module.js +0 -2
  473. package/dist/esm/serializer/implementations/super-json-serializer/_module.js.map +0 -1
  474. package/dist/esm/serializer/implementations/super-json-serializer/super-json-serializer.js.map +0 -1
  475. package/dist/types/cache/implementations/derivables/base-cache.d.ts +0 -58
  476. package/dist/types/event-bus/implementations/adapters/redis-event-bus-adapter/_module.d.ts +0 -1
  477. package/dist/types/event-bus/implementations/adapters/redis-event-bus-adapter/redis-event-bus-adapter.d.ts +0 -43
  478. package/dist/types/event-bus/implementations/derivables/base-event-bus.d.ts +0 -23
  479. package/dist/types/event-bus/implementations/derivables/with-namespace-event-bus-adapter.d.ts +0 -16
  480. package/dist/types/serializer/contracts/_module.d.ts +0 -2
  481. package/dist/types/serializer/contracts/serializer.contract.d.ts +0 -16
  482. package/dist/types/serializer/implementations/_module.d.ts +0 -5
  483. package/dist/types/serializer/implementations/_shared/test-utilities/_module.d.ts +0 -1
  484. package/dist/types/serializer/implementations/_shared/test-utilities/serializer.test-suite.d.ts +0 -18
  485. package/dist/types/serializer/implementations/mongodb-serializer/_module.d.ts +0 -1
  486. package/dist/types/serializer/implementations/mongodb-serializer/mongodb-serializer.d.ts +0 -13
  487. package/dist/types/serializer/implementations/redis-serializer/_module.d.ts +0 -1
  488. package/dist/types/serializer/implementations/redis-serializer/redis-serializer.d.ts +0 -13
  489. package/dist/types/serializer/implementations/sql-serializer/_module.d.ts +0 -1
  490. package/dist/types/serializer/implementations/sql-serializer/sql-serializer.d.ts +0 -13
  491. package/dist/types/serializer/implementations/super-json-serializer/_module.d.ts +0 -1
  492. package/dist/types/serializer/implementations/super-json-serializer/super-json-serializer.d.ts +0 -37
  493. /package/dist/cjs/{serializer → serde}/contracts/serializer.contract.js +0 -0
  494. /package/dist/esm/{serializer → serde}/contracts/serializer.contract.js +0 -0
@@ -12,7 +12,7 @@ export type AsyncCollapse<TValue> = TValue extends Array<infer TItem> | Iterable
12
12
  * @group Contracts
13
13
  * @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
14
14
  */
15
- export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
15
+ export type IAsyncCollection<TInput = unknown> = AsyncIterable<TInput> & {
16
16
  /**
17
17
  * The <i>toIterator</i> method converts the collection to a new iterator.
18
18
  */
@@ -33,12 +33,16 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
33
33
  * The <i>filter</i> method filters the collection using <i>predicateFn</i>, keeping only those items that pass <i>predicateFn</i>.
34
34
  * @example
35
35
  * ```ts
36
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
36
+ * import type { IAsyncCollection } from "@daiso-tech/core";
37
37
  *
38
- * const collection = new AsyncIterableCollection([1, 2, 3, 4, 5, 6]);
39
- * const filtered = collection.filter(item => 2 < item && item < 5);
40
- * await filtered.toArray();
41
- * // [3, 4]
38
+ * // Asume the inputed collection is empty.
39
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
40
+ * await collection
41
+ * .append([1, 2, 3, 4, 5, 6])
42
+ * .filter(item => 2 < item && item < 5)
43
+ * .toArray();
44
+ * // [3, 4]
45
+ * }
42
46
  * ```
43
47
  */
44
48
  filter<TOutput extends TInput>(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>): IAsyncCollection<TOutput>;
@@ -46,12 +50,16 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
46
50
  * The <i>reject</i> method filters the collection using <i>predicateFn</i>, keeping only those items that not pass <i>predicateFn</i>.
47
51
  * @example
48
52
  * ```ts
49
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
53
+ * import type { IAsyncCollection } from "@daiso-tech/core";
50
54
  *
51
- * const collection = new AsyncIterableCollection([1, 2, 3, 4, 5, 6]);
52
- * const filtered = collection.reject(item => 2 < item && item < 5);
53
- * await filtered.toArray();
54
- * // [1, 2, 5, 6]
55
+ * // Asume the inputed collection is empty.
56
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
57
+ * await collection
58
+ * .append([1, 2, 3, 4, 5, 6])
59
+ * .reject(item => 2 < item && item < 5)
60
+ * .toArray();
61
+ * // [1, 2, 5, 6]
62
+ * }
55
63
  * ```
56
64
  */
57
65
  reject<TOutput extends TInput>(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>): IAsyncCollection<Exclude<TInput, TOutput>>;
@@ -60,12 +68,16 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
60
68
  * The <i>mapFn</i> is free to modify the item and return it, thus forming a new collection of modified items.
61
69
  * @example
62
70
  * ```ts
63
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
71
+ * import type { IAsyncCollection } from "@daiso-tech/core";
64
72
  *
65
- * const collection = new AsyncIterableCollection([1, 2, 3, 4, 5]);
66
- * const mapped = collection.map(item => item * 2);
67
- * await mapped.toArray();
68
- * // [2, 4, 6, 8, 10]
73
+ * // Asume the inputed collection is empty.
74
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
75
+ * await collection
76
+ * .append([1, 2, 3, 4, 5])
77
+ * .map(item => item * 2)
78
+ * .toArray();
79
+ * // [2, 4, 6, 8, 10]
80
+ * }
69
81
  * ```
70
82
  */
71
83
  map<TOutput>(mapFn: AsyncMap<TInput, IAsyncCollection<TInput>, TOutput>): IAsyncCollection<TOutput>;
@@ -74,25 +86,34 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
74
86
  * The final result of running the reducer across all items of the array is a single value.
75
87
  * @example
76
88
  * ```ts
77
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
89
+ * import type { IAsyncCollection } from "@daiso-tech/core";
78
90
  *
79
- * const collection = new AsyncIterableCollection([1, 2, 3]);
80
- * await collection.reduce((sum, item) => sum + item);
81
- * // 6
91
+ * // Asume the inputed collection is empty.
92
+ * async function main(collection: IAsyncCollection<string>): Promise<void> {
93
+ * await collection
94
+ * .append([1, 2, 3])
95
+ * .reduce((sum, item) => sum + item);
96
+ * // 6
97
+ * }
82
98
  * ```
83
99
  * @example
84
100
  * ```ts
85
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
101
+ * import type { IAsyncCollection } from "@daiso-tech/core";
86
102
  *
87
- * const collection = new AsyncIterableCollection(["a", "b", "c"]);
88
- * await collection.entries().reduce(
89
- * (record, [key, value]) => ({
90
- * ...record,
91
- * [key]: value
92
- * }),
93
- * {} as Record<number, string>
94
- * );
95
- * // { 0: "a", 1: "b", 2: "c" }
103
+ * // Asume the inputed collection is empty.
104
+ * async function main(collection: IAsyncCollection<string>): Promise<void> {
105
+ * await collection
106
+ * .append(["a", "b", "c"])
107
+ * .entries()
108
+ * .reduce(
109
+ * (record, [key, value]) => ({
110
+ * ...record,
111
+ * [key]: value
112
+ * }),
113
+ * {} as Record<number, string>
114
+ * );
115
+ * // { 0: "a", 1: "b", 2: "c" }
116
+ * }
96
117
  * ```
97
118
  */
98
119
  reduce(reduceFn: AsyncReduce<TInput, IAsyncCollection<TInput>, TInput>): LazyPromise<TInput>;
@@ -103,19 +124,29 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
103
124
  * @throws {TypeCollectionError}
104
125
  * @example
105
126
  * ```ts
106
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
127
+ * import type { IAsyncCollection } from "@daiso-tech/core";
107
128
  *
108
- * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
109
- * await collection.map(item => item.toString()).join();
110
- * // "1,2,3,4"
129
+ * // Asume the inputed collection is empty.
130
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
131
+ * await collection
132
+ * .append([1, 2, 3, 4])
133
+ * .map(item => item.toString())
134
+ * .join();
135
+ * // "1,2,3,4"
136
+ * }
111
137
  * ```
112
138
  * @example
113
139
  * ```ts
114
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
140
+ * import type { IAsyncCollection } from "@daiso-tech/core";
115
141
  *
116
- * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
117
- * await collection.map(item => item.toString()).join("_");
118
- * // "1_2_3_4"
142
+ * // Asume the inputed collection is empty.
143
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
144
+ * await collection
145
+ * .append([1, 2, 3, 4])
146
+ * .map(item => item.toString())
147
+ * .join("_");
148
+ * // "1_2_3_4"
149
+ * }
119
150
  * ```
120
151
  */
121
152
  join(separator?: string): LazyPromise<Extract<TInput, string>>;
@@ -123,12 +154,16 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
123
154
  * The <i>collapse</i> method collapses a collection of iterables into a single, flat collection.
124
155
  * @example
125
156
  * ```ts
126
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
157
+ * import type { IAsyncCollection } from "@daiso-tech/core";
127
158
  *
128
- * const collection = new AsyncIterableCollection([[1, 2], [3, 4]]);
129
- * const collapsed = collection.collapse();
130
- * await collapsed.toArray();
131
- * // [1, 2, 3, 4]
159
+ * // Asume the inputed collection is empty.
160
+ * async function main(collection: IAsyncCollection<number[]>): Promise<void> {
161
+ * await collection
162
+ * .append([[1, 2], [3, 4]])
163
+ * .collapse()
164
+ * .toArray();
165
+ * // [1, 2, 3, 4]
166
+ * }
132
167
  * ```
133
168
  */
134
169
  collapse(): IAsyncCollection<AsyncCollapse<TInput>>;
@@ -137,11 +172,16 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
137
172
  * It is identical to a <i>map</i> method followed by a <i>collapse</i> method.
138
173
  * @example
139
174
  * ```ts
140
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
175
+ * import type { IAsyncCollection } from "@daiso-tech/core";
141
176
  *
142
- * const collection = new AsyncIterableCollection([["a", "b"], ["c", "d"]]).flatMap(item => [item.length, ...item]);
143
- * await collection.toArray();
144
- * // [2, "a", "b", 2, "c", "d"]
177
+ * // Asume the inputed collection is empty.
178
+ * async function main(collection: IAsyncCollection<string[]>): Promise<void> {
179
+ * await collection
180
+ * .append([["a", "b"], ["c", "d"]])
181
+ * .flatMap(item => [item.length, ...item])
182
+ * .toArray();
183
+ * // [2, "a", "b", 2, "c", "d"]
184
+ * }
145
185
  * ```
146
186
  */
147
187
  flatMap<TOutput>(mapFn: AsyncMap<TInput, IAsyncCollection<TInput>, Iterable<TOutput>>): IAsyncCollection<TOutput>;
@@ -149,12 +189,16 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
149
189
  * The <i>change</i> method changes only the items that passes <i>predicateFn</i> using <i>mapFn</i>.
150
190
  * @example
151
191
  * ```ts
152
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
192
+ * import type { IAsyncCollection } from "@daiso-tech/core";
153
193
  *
154
- * const collection = new AsyncIterableCollection([1, 2, 3, 4, 5]);
155
- * const newCollection = collection.change(item => item % 2 === 0, item => item * 2);
156
- * await newCollection.toArray();
157
- * // [1, 4, 3, 8, 5]
194
+ * // Asume the inputed collection is empty.
195
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
196
+ * await collection
197
+ * .append([1, 2, 3, 4, 5])
198
+ * .change(item => item % 2 === 0, item => item * 2)
199
+ * .toArray();
200
+ * // [1, 4, 3, 8, 5]
201
+ * }
158
202
  * ```
159
203
  */
160
204
  change<TFilterOutput extends TInput, TMapOutput>(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>, TFilterOutput>, mapFn: AsyncMap<TFilterOutput, IAsyncCollection<TInput>, TMapOutput>): IAsyncCollection<TInput | TFilterOutput | TMapOutput>;
@@ -162,21 +206,29 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
162
206
  * The <i>set</i> method changes a item by i>index</i> using <i>value</i>.
163
207
  * @example
164
208
  * ```ts
165
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
209
+ * import type { IAsyncCollection } from "@daiso-tech/core";
166
210
  *
167
- * const collection = new AsyncIterableCollection([1, 2, 3, 4, 5]);
168
- * const newCollection = collection.set(1, -1);
169
- * await newCollection.toArray();
170
- * // [1, -1, 3, 4, 5]
211
+ * // Asume the inputed collection is empty.
212
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
213
+ * await collection
214
+ * .append([1, 2, 3, 4, 5])
215
+ * .set(1, -1)
216
+ * .toArray();
217
+ * // [1, -1, 3, 4, 5]
218
+ * }
171
219
  * ```
172
220
  * @example
173
221
  * ```ts
174
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
222
+ * import type { IAsyncCollection } from "@daiso-tech/core";
175
223
  *
176
- * const collection = new AsyncIterableCollection([1, 2, 3, 4, 5]);
177
- * const newCollection = collection.set(1, (prevValue) => prevValue - 2);
178
- * await newCollection.toArray();
179
- * // [1, 0, 3, 4, 5]
224
+ * // Asume the inputed collection is empty.
225
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
226
+ * await collection
227
+ * .append([1, 2, 3, 4, 5])
228
+ * .set(1, (prevValue) => prevValue - 2)
229
+ * .toArray();
230
+ * // [1, 0, 3, 4, 5]
231
+ * }
180
232
  * ```
181
233
  */
182
234
  set(index: number, value: TInput | AsyncMap<TInput, IAsyncCollection<TInput>, TInput>): IAsyncCollection<TInput>;
@@ -184,14 +236,18 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
184
236
  * The <i>get</i> method returns the item by index. If the item is not found null will returned.
185
237
  * @example
186
238
  * ```ts
187
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
239
+ * import type { IAsyncCollection } from "@daiso-tech/core";
240
+ *
241
+ * // Asume the inputed collection is empty.
242
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
243
+ * collection = collection.append([1, 4, 2, 8, -2]);
188
244
  *
189
- * const collection = new AsyncIterableCollection([1, 4, 2, 8, -2]);
190
- * // Will be 2
191
- * await collection.get(2);
245
+ * // Will be 2
246
+ * await collection.get(2);
192
247
  *
193
- * // Will be null
194
- * await collection.get(5);
248
+ * // Will be null
249
+ * await collection.get(5);
250
+ * }
195
251
  * ```
196
252
  */
197
253
  get(index: number): LazyPromise<TInput | null>;
@@ -200,14 +256,18 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
200
256
  * @throws {ItemNotFoundCollectionError} {@link ItemNotFoundCollectionError}
201
257
  * @example
202
258
  * ```ts
203
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
259
+ * import type { IAsyncCollection } from "@daiso-tech/core";
204
260
  *
205
- * const collection = new AsyncIterableCollection([1, 4, 2, 8, -2]);
206
- * // Will be 2
207
- * await collection.getOrFail(2);
261
+ * // Asume the inputed collection is empty.
262
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
263
+ * collection = collection.append([1, 4, 2, 8, -2]);
208
264
  *
209
- * // An error will thrown
210
- * await collection.getOrFail(5);
265
+ * // Will be 2
266
+ * await collection.getOrFail(2);
267
+ *
268
+ * // An error will thrown
269
+ * await collection.getOrFail(5);
270
+ * }
211
271
  * ```
212
272
  */
213
273
  getOrFail(index: number): LazyPromise<TInput>;
@@ -215,12 +275,16 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
215
275
  * The <i>page</i> method returns a new collection containing the items that would be present on <i> page </i> with custom <i> pageSize </i>.
216
276
  * @example
217
277
  * ```ts
218
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
278
+ * import type { IAsyncCollection } from "@daiso-tech/core";
219
279
  *
220
- * const collection = new AsyncIterableCollection([1, 2, 3, 4, 5, 6, 7, 8, 9]);
221
- * const page = collection.page(2, 3);
222
- * await page.toArray();
223
- * // [4, 5, 6]
280
+ * // Asume the inputed collection is empty.
281
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
282
+ * await collection
283
+ * .append([1, 2, 3, 4, 5, 6, 7, 8, 9])
284
+ * .page(2, 3)
285
+ * .toArray();
286
+ * // [4, 5, 6]
287
+ * }
224
288
  * ```
225
289
  */
226
290
  page(page: number, pageSize: number): IAsyncCollection<TInput>;
@@ -230,11 +294,15 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
230
294
  * @throws {EmptyCollectionError} {@link EmptyCollectionError}
231
295
  * @example
232
296
  * ```ts
233
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
297
+ * import type { IAsyncCollection } from "@daiso-tech/core";
234
298
  *
235
- * const collection = new AsyncIterableCollection([1, 2, 3]);
236
- * await collection.sum();
237
- * // 6
299
+ * // Asume the inputed collection is empty.
300
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
301
+ * await collection
302
+ * .append([1, 2, 3])
303
+ * .sum();
304
+ * // 6
305
+ * }
238
306
  * ```
239
307
  */
240
308
  sum(): LazyPromise<Extract<TInput, number>>;
@@ -244,11 +312,15 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
244
312
  * @throws {EmptyCollectionError} {@link EmptyCollectionError}
245
313
  * @example
246
314
  * ```ts
247
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
315
+ * import type { IAsyncCollection } from "@daiso-tech/core";
248
316
  *
249
- * const collection = new AsyncIterableCollection([1, 2, 3]);
250
- * await collection.average();
251
- * // 2
317
+ * // Asume the inputed collection is empty.
318
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
319
+ * await collection
320
+ * .append([1, 2, 3])
321
+ * .average();
322
+ * // 2
323
+ * }
252
324
  * ```
253
325
  */
254
326
  average(): LazyPromise<Extract<TInput, number>>;
@@ -258,11 +330,15 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
258
330
  * @throws {EmptyCollectionError} {@link EmptyCollectionError}
259
331
  * @example
260
332
  * ```ts
261
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
333
+ * import type { IAsyncCollection } from "@daiso-tech/core";
262
334
  *
263
- * const collection = new AsyncIterableCollection([1, 2, 3]);
264
- * await collection.median();
265
- * // 2
335
+ * // Asume the inputed collection is empty.
336
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
337
+ * await collection
338
+ * .append([1, 2, 3])
339
+ * .median();
340
+ * // 2
341
+ * }
266
342
  * ```
267
343
  */
268
344
  median(): LazyPromise<Extract<TInput, number>>;
@@ -272,11 +348,15 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
272
348
  * @throws {EmptyCollectionError} {@link EmptyCollectionError}
273
349
  * @example
274
350
  * ```ts
275
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
351
+ * import type { IAsyncCollection } from "@daiso-tech/core";
276
352
  *
277
- * const collection = new AsyncIterableCollection([1, 2, 3]);
278
- * await collection.min();
279
- * // 1
353
+ * // Asume the inputed collection is empty.
354
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
355
+ * await collection
356
+ * .append([1, 2, 3])
357
+ * .min();
358
+ * // 1
359
+ * }
280
360
  * ```
281
361
  */
282
362
  min(): LazyPromise<Extract<TInput, number>>;
@@ -286,11 +366,15 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
286
366
  * @throws {EmptyCollectionError} {@link EmptyCollectionError}
287
367
  * @example
288
368
  * ```ts
289
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
369
+ * import type { IAsyncCollection } from "@daiso-tech/core";
290
370
  *
291
- * const collection = new AsyncIterableCollection([1, 2, 3]);
292
- * await collection.max();
293
- * // 3
371
+ * // Asume the inputed collection is empty.
372
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
373
+ * await collection
374
+ * .append([1, 2, 3])
375
+ * .max();
376
+ * // 3
377
+ * }
294
378
  * ```
295
379
  */
296
380
  max(): LazyPromise<Extract<TInput, number>>;
@@ -299,11 +383,15 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
299
383
  * @throws {EmptyCollectionError} {@link EmptyCollectionError}
300
384
  * @example
301
385
  * ```ts
302
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
386
+ * import type { IAsyncCollection } from "@daiso-tech/core";
303
387
  *
304
- * const collection = new AsyncIterableCollection([1, 1, 2, 2, 2, 3]);
305
- * await collection.percentage(value => value === 1);
306
- * // 33.333
388
+ * // Asume the inputed collection is empty.
389
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
390
+ * await collection
391
+ * .append([1, 1, 2, 2, 2, 3])
392
+ * .percentage(value => value === 1);
393
+ * // 33.333
394
+ * }
307
395
  * ```
308
396
  */
309
397
  percentage(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): LazyPromise<number>;
@@ -311,11 +399,15 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
311
399
  * The <i>some</i> method determines whether at least one item in the collection matches <i>predicateFn</i>.
312
400
  * @example
313
401
  * ```ts
314
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
402
+ * import type { IAsyncCollection } from "@daiso-tech/core";
315
403
  *
316
- * const collection = new AsyncIterableCollection([0, 1, 2, 3, 4, 5]);
317
- * await collection.some(item => item === 1);
318
- * // true
404
+ * // Asume the inputed collection is empty.
405
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
406
+ * await collection
407
+ * .append([0, 1, 2, 3, 4, 5])
408
+ * .some(item => item === 1);
409
+ * // true
410
+ * }
319
411
  * ```
320
412
  */
321
413
  some<TOutput extends TInput>(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>): LazyPromise<boolean>;
@@ -323,11 +415,15 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
323
415
  * The <i>every</i> method determines whether all items in the collection matches <i>predicateFn</i>.
324
416
  * @example
325
417
  * ```ts
326
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
418
+ * import type { IAsyncCollection } from "@daiso-tech/core";
327
419
  *
328
- * const collection = new AsyncIterableCollection([0, 1, 2, 3, 4, 5]);
329
- * await collection.every(item => item < 6);
330
- * // true
420
+ * // Asume the inputed collection is empty.
421
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
422
+ * await collection
423
+ * .append([0, 1, 2, 3, 4, 5])
424
+ * .every(item => item < 6);
425
+ * // true
426
+ * }
331
427
  * ```
332
428
  */
333
429
  every<TOutput extends TInput>(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>): LazyPromise<boolean>;
@@ -335,21 +431,29 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
335
431
  * The <i>take</i> method takes the first <i>limit</i> items.
336
432
  * @example
337
433
  * ```ts
338
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
434
+ * import type { IAsyncCollection } from "@daiso-tech/core";
339
435
  *
340
- * const collection = new AsyncIterableCollection([0, 1, 2, 3, 4, 5]);
341
- * const chunk = collection.take(3);
342
- * await chunk.toArray();
343
- * // [0, 1, 2]
436
+ * // Asume the inputed collection is empty.
437
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
438
+ * await collection
439
+ * .append([0, 1, 2, 3, 4, 5])
440
+ * .take(3)
441
+ * .toArray();
442
+ * // [0, 1, 2]
443
+ * }
344
444
  * ```
345
445
  * @example
346
446
  * ```ts
347
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
447
+ * import type { IAsyncCollection } from "@daiso-tech/core";
348
448
  *
349
- * const collection = new AsyncIterableCollection([0, 1, 2, 3, 4, 5]);
350
- * const chunk = collection.take(-2);
351
- * await chunk.toArray();
352
- * // [0, 1, 2, 3]
449
+ * // Asume the inputed collection is empty.
450
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
451
+ * await collection
452
+ * .append([0, 1, 2, 3, 4, 5])
453
+ * .take(-2)
454
+ * .toArray();
455
+ * // [0, 1, 2, 3]
456
+ * }
353
457
  * ```
354
458
  */
355
459
  take(limit: number): IAsyncCollection<TInput>;
@@ -357,12 +461,16 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
357
461
  * The <i>takeUntil</i> method takes items until <i>predicateFn</i> returns true.
358
462
  * @example
359
463
  * ```ts
360
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
464
+ * import type { IAsyncCollection } from "@daiso-tech/core";
361
465
  *
362
- * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
363
- * const chunk = collection.takeUntil(item => item >= 3);
364
- * await chunk.toArray();
365
- * // [1, 2]
466
+ * // Asume the inputed collection is empty.
467
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
468
+ * await collection
469
+ * .append([1, 2, 3, 4])
470
+ * .takeUntil(item => item >= 3)
471
+ * .toArray();
472
+ * // [1, 2]
473
+ * }
366
474
  * ```
367
475
  */
368
476
  takeUntil(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): IAsyncCollection<TInput>;
@@ -370,12 +478,16 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
370
478
  * The <i>takeWhile</i> method takes items until <i>predicateFn</i> returns false.
371
479
  * @example
372
480
  * ```ts
373
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
481
+ * import type { IAsyncCollection } from "@daiso-tech/core";
374
482
  *
375
- * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
376
- * const chunk = collection.takeWhile(item => item < 4);
377
- * await chunk.toArray();
378
- * // [1, 2, 3]
483
+ * // Asume the inputed collection is empty.
484
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
485
+ * await collection
486
+ * .append([1, 2, 3, 4])
487
+ * .takeWhile(item => item < 4)
488
+ * .toArray();
489
+ * // [1, 2, 3]
490
+ * }
379
491
  * ```
380
492
  */
381
493
  takeWhile(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): IAsyncCollection<TInput>;
@@ -383,11 +495,16 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
383
495
  * The <i>skip</i> method skips the first <i>offset</i> items.
384
496
  * @example
385
497
  * ```ts
386
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
498
+ * import type { IAsyncCollection } from "@daiso-tech/core";
387
499
  *
388
- * const collection = new AsyncIterableCollection([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]).skip(4);
389
- * await collection.toArray();
390
- * // [5, 6, 7, 8, 9, 10]
500
+ * // Asume the inputed collection is empty.
501
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
502
+ * await collection
503
+ * .append([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
504
+ * .skip(4)
505
+ * .toArray();
506
+ * // [5, 6, 7, 8, 9, 10]
507
+ * }
391
508
  * ```
392
509
  */
393
510
  skip(offset: number): IAsyncCollection<TInput>;
@@ -395,11 +512,16 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
395
512
  * The <i>skipUntil</i> method skips items until <i>predicateFn</i> returns true.
396
513
  * @example
397
514
  * ```ts
398
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
515
+ * import type { IAsyncCollection } from "@daiso-tech/core";
399
516
  *
400
- * const collection = new AsyncIterableCollection([1, 2, 3, 4]).skipUntil(item => item >= 3);
401
- * await collection.toArray();
402
- * // [3, 4]
517
+ * // Asume the inputed collection is empty.
518
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
519
+ * await collection
520
+ * .append([1, 2, 3, 4])
521
+ * .skipUntil(item => item >= 3)
522
+ * .toArray();
523
+ * // [3, 4]
524
+ * }
403
525
  * ```
404
526
  */
405
527
  skipUntil(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): IAsyncCollection<TInput>;
@@ -407,11 +529,16 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
407
529
  * The <i>skipWhile</i> method skips items until <i>predicateFn</i> returns false.
408
530
  * @example
409
531
  * ```ts
410
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
532
+ * import type { IAsyncCollection } from "@daiso-tech/core";
411
533
  *
412
- * const collection = new AsyncIterableCollection([1, 2, 3, 4]).skipWhile(item => item <= 3);
413
- * await collection.toArray();
414
- * // [4]
534
+ * // Asume the inputed collection is empty.
535
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
536
+ * await collection
537
+ * .append([1, 2, 3, 4])
538
+ * .skipWhile(item => item <= 3)
539
+ * .toArray();
540
+ * // [4]
541
+ * }
415
542
  * ```
416
543
  */
417
544
  skipWhile(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): IAsyncCollection<TInput>;
@@ -419,13 +546,17 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
419
546
  * The <i>when</i> method will execute <i>callback</i> when <i>condition</i> evaluates to true.
420
547
  * @example
421
548
  * ```ts
422
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
549
+ * import type { IAsyncCollection } from "@daiso-tech/core";
423
550
  *
424
- * const collection = new AsyncIterableCollection([1, 2, 3, 4])
425
- * .when(true, collection => collection.append([-3]))
426
- * .when(false, collection => collection.append([20]));
427
- * await collection.toArray();
428
- * // [1, 2, 3, 4, -3]
551
+ * // Asume the inputed collection is empty.
552
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
553
+ * await collection
554
+ * .append([1, 2, 3, 4])
555
+ * .when(true, collection => collection.append([-3]))
556
+ * .when(false, collection => collection.append([20]))
557
+ * .toArray();
558
+ * // [1, 2, 3, 4, -3]
559
+ * }
429
560
  * ```
430
561
  */
431
562
  when<TExtended = TInput>(condition: boolean, callback: AsyncModifier<IAsyncCollection<TInput>, IAsyncCollection<TExtended>>): IAsyncCollection<TInput | TExtended>;
@@ -433,21 +564,29 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
433
564
  * The <i>whenEmpty</i> method will execute <i>callback</i> when the collection is empty.
434
565
  * @example
435
566
  * ```ts
436
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
567
+ * import type { IAsyncCollection } from "@daiso-tech/core";
437
568
  *
438
- * const collection = new AsyncIterableCollection([])
439
- * .whenEmpty(collection => collection.append([-3]))
440
- * await collection.toArray();
441
- * // [-3]
569
+ * // Asume the inputed collection is empty.
570
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
571
+ * await collection
572
+ * .append([])
573
+ * .whenEmpty(collection => collection.append([-3]))
574
+ * .toArray();
575
+ * // [-3]
576
+ * }
442
577
  * ```
443
578
  * @example
444
579
  * ```ts
445
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
580
+ * import type { IAsyncCollection } from "@daiso-tech/core";
446
581
  *
447
- * const collection = new AsyncIterableCollection([1])
448
- * .whenEmpty(collection => collection.append([-3]))
449
- * await collection.toArray();
450
- * // [1]
582
+ * // Asume the inputed collection is empty.
583
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
584
+ * await collection
585
+ * .append([1])
586
+ * .whenEmpty(collection => collection.append([-3]))
587
+ * .toArray();
588
+ * // [1]
589
+ * }
451
590
  * ```
452
591
  */
453
592
  whenEmpty<TExtended = TInput>(callback: AsyncModifier<IAsyncCollection<TInput>, IAsyncCollection<TExtended>>): IAsyncCollection<TInput | TExtended>;
@@ -455,13 +594,17 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
455
594
  * The <i>whenNot</i> method will execute <i>callback</i> when <i>condition</i> evaluates to false.
456
595
  * @example
457
596
  * ```ts
458
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
597
+ * import type { IAsyncCollection } from "@daiso-tech/core";
459
598
  *
460
- * const collection = new AsyncIterableCollection([1, 2, 3, 4])
461
- * .whenNot(true, collection => collection.append([-3]))
462
- * .whenNot(false, collection => collection.append([20]));
463
- * await collection.toArray();
464
- * // [1, 2, 3, 4, 20]
599
+ * // Asume the inputed collection is empty.
600
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
601
+ * await collection
602
+ * .append([1, 2, 3, 4])
603
+ * .whenNot(true, collection => collection.append([-3]))
604
+ * .whenNot(false, collection => collection.append([20]))
605
+ * .toArray();
606
+ * // [1, 2, 3, 4, 20]
607
+ * }
465
608
  * ```
466
609
  */
467
610
  whenNot<TExtended = TInput>(condition: boolean, callback: AsyncModifier<IAsyncCollection<TInput>, IAsyncCollection<TExtended>>): IAsyncCollection<TInput | TExtended>;
@@ -469,21 +612,28 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
469
612
  * The <i>whenNotEmpty</i> method will execute <i>callback</i> when the collection is not empty.
470
613
  * @example
471
614
  * ```ts
472
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
615
+ * import type { IAsyncCollection } from "@daiso-tech/core";
473
616
  *
474
- * const collection = new AsyncIterableCollection([])
475
- * .whenNotEmpty(collection => collection.append([-3]))
476
- * await collection.toArray();
477
- * // []
617
+ * // Asume the inputed collection is empty.
618
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
619
+ * await collection
620
+ * .append([])
621
+ * .whenNotEmpty(collection => collection.append([-3])).toArray();
622
+ * // []
623
+ * }
478
624
  * ```
479
625
  * @example
480
626
  * ```ts
481
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
627
+ * import type { IAsyncCollection } from "@daiso-tech/core";
482
628
  *
483
- * const collection = new AsyncIterableCollection([1])
484
- * .whenNotEmpty(collection => collection.append([-3]))
485
- * await collection.toArray();
486
- * // [1, -3]
629
+ * // Asume the inputed collection is empty.
630
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
631
+ * await collection
632
+ * .append([1])
633
+ * .whenNotEmpty(collection => collection.append([-3]))
634
+ * .toArray();
635
+ * // [1, -3]
636
+ * }
487
637
  * ```
488
638
  */
489
639
  whenNotEmpty<TExtended = TInput>(callback: AsyncModifier<IAsyncCollection<TInput>, IAsyncCollection<TExtended>>): IAsyncCollection<TInput | TExtended>;
@@ -492,22 +642,26 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
492
642
  * This method is useful when you want compose multiple smaller functions.
493
643
  * @example
494
644
  * ```ts
495
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
496
- *
497
- * const collection = new AsyncIterableCollection([1, "2", "a", 1, 3, {}]);
498
- * function toNbrs<TInput>(
499
- * collection: IAsyncCollection<TInput>,
500
- * ): IAsyncCollection<number> {
501
- * return collection
502
- * .map((item) => Number(item))
503
- * .reject((nbr) => Number.isNaN(nbr));
504
- * }
505
- * function nbrToStr(collection: IAsyncCollection<number>): number[] {
506
- * return collection.repeat(2).toArray();
645
+ * import type { IAsyncCollection } from "@daiso-tech/core";
646
+ *
647
+ * // Asume the inputed collection is empty.
648
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
649
+ * function toNbrs<TInput>(
650
+ * collection: IAsyncCollection<TInput>,
651
+ * ): IAsyncCollection<number> {
652
+ * return collection
653
+ * .map((item) => Number(item))
654
+ * .reject((nbr) => Number.isNaN(nbr));
655
+ * }
656
+ * function nbrToStr(collection: IAsyncCollection<number>): number[] {
657
+ * return collection.repeat(2).toArray();
658
+ * }
659
+ * await collection
660
+ * .append([1, "2", "a", 1, 3, {}])
661
+ * .pipe(toNbrs)
662
+ * .then(nbrToStr);
663
+ * // [ 1, 2, 1, 3 ]
507
664
  * }
508
- * const piped = await collection.pipe(toNbrs).then(nbrToStr);
509
- * console.log(piped);
510
- * // [ 1, 2, 1, 3 ]
511
665
  * ```
512
666
  */
513
667
  pipe<TOutput = TInput>(callback: AsyncTransform<IAsyncCollection<TInput>, TOutput>): LazyPromise<TOutput>;
@@ -515,16 +669,20 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
515
669
  * The <i>tap</i> method passes a copy of the original collection to <i>callback</i>, allowing you to do something with the items while not affecting the original collection.
516
670
  * @example
517
671
  * ```ts
518
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
672
+ * import type { IAsyncCollection } from "@daiso-tech/core";
519
673
  *
520
- * const collection = await new AsyncIterableCollection([1, 2, 3, 4, 5, 6])
521
- * .tap(collection => {
522
- * collection
523
- * .filter(value => value % 2 === 0)
524
- * .forEach(value => console.log(value))
525
- * })
526
- * .toArray();
527
- * // [1, 2, 3, 4, 5, 6]
674
+ * // Asume the inputed collection is empty.
675
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
676
+ * await collection
677
+ * .append([1, 2, 3, 4, 5, 6])
678
+ * .tap(collection => {
679
+ * collection
680
+ * .filter(value => value % 2 === 0)
681
+ * .forEach(value => console.log(value))
682
+ * })
683
+ * .toArray();
684
+ * // [1, 2, 3, 4, 5, 6]
685
+ * }
528
686
  * ```
529
687
  */
530
688
  tap(callback: AsyncTap<IAsyncCollection<TInput>>): IAsyncCollection<TInput>;
@@ -533,12 +691,17 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
533
691
  * If <i>chunkSize</i> is not divisible with total number of items then the last chunk will contain the remaining items.
534
692
  * @example
535
693
  * ```ts
536
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
694
+ * import type { IAsyncCollection } from "@daiso-tech/core";
537
695
  *
538
- * const collection = new AsyncIterableCollection([1, 2, 3, 4, 5, 6, 7]);
539
- * const chunks = collection.chunk(4);
540
- * await chunks.map(chunk => chunk.toArray()).toArray();
541
- * // [[1, 2, 3, 4], [5, 6, 7]]
696
+ * // Asume the inputed collection is empty.
697
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
698
+ * await collection
699
+ * .append([1, 2, 3, 4, 5, 6, 7])
700
+ * .chunk(4)
701
+ * .map(chunk => chunk.toArray())
702
+ * .toArray();
703
+ * // [[1, 2, 3, 4], [5, 6, 7]]
704
+ * }
542
705
  * ```
543
706
  */
544
707
  chunk(chunkSize: number): IAsyncCollection<IAsyncCollection<TInput>>;
@@ -547,14 +710,19 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
547
710
  * The chunk variable passed to the <i>predicateFn</i> may be used to inspect the previous item.
548
711
  * @example
549
712
  * ```ts
550
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
713
+ * import type { IAsyncCollection } from "@daiso-tech/core";
551
714
  *
552
- * const collection = new AsyncIterableCollection("AABBCCCD");
553
- * const chunks = collection.chunkWhile((value, index, chunk) => {
554
- * return value === chunk.last();
555
- * });
556
- * await chunks.map(chunk => chunk.toArray()).toArray();
557
- * // [["A", "A"], ["B", "B"], ["C", "C", "C"], ["D"]]
715
+ * // Asume the inputed collection is empty.
716
+ * async function main(collection: IAsyncCollection<string>): Promise<void> {
717
+ * await collection
718
+ * .append("AABBCCCD")
719
+ * .chunkWhile((value, index, chunk) => {
720
+ * return value === chunk.last();
721
+ * })
722
+ * .map(chunk => chunk.toArray())
723
+ * .toArray();
724
+ * // [["A", "A"], ["B", "B"], ["C", "C", "C"], ["D"]]
725
+ * }
558
726
  * ```
559
727
  */
560
728
  chunkWhile(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): IAsyncCollection<IAsyncCollection<TInput>>;
@@ -562,42 +730,62 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
562
730
  * The <i>split</i> method breaks a collection evenly into <i>chunkAmount</i> of chunks.
563
731
  * @example
564
732
  * ```ts
565
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
733
+ * import type { IAsyncCollection } from "@daiso-tech/core";
566
734
  *
567
- * const collection = new AsyncIterableCollection([1, 2, 3, 4, 5]);
568
- * const chunks = collection.split(3);
569
- * await chunks.map(chunk => chunk.toArray()).toArray();
570
- * // [[1, 2], [3, 4], [5]]
735
+ * // Asume the inputed collection is empty.
736
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
737
+ * await collection
738
+ * .append([1, 2, 3, 4, 5])
739
+ * .split(3)
740
+ * .map(chunk => chunk.toArray())
741
+ * .toArray();
742
+ * // [[1, 2], [3, 4], [5]]
743
+ * }
571
744
  * ```
572
745
  * @example
573
746
  * ```ts
574
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
747
+ * import type { IAsyncCollection } from "@daiso-tech/core";
575
748
  *
576
- * const collection = new AsyncIterableCollection([1, 2, 3, 4, 5, 6]);
577
- * const chunks = collection.split(3);
578
- * await chunks.map(chunk => chunk.toArray()).toArray();
579
- * // [[1, 2], [3, 4], [5, 6]]
749
+ * // Asume the inputed collection is empty.
750
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
751
+ * await collection
752
+ * .append([1, 2, 3, 4, 5, 6])
753
+ * .split(3)
754
+ * .map(chunk => chunk.toArray())
755
+ * .toArray();
756
+ * // [[1, 2], [3, 4], [5, 6]]
757
+ * }
580
758
  * ```
581
759
  * @example
582
760
  * ```ts
583
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
761
+ * import type { IAsyncCollection } from "@daiso-tech/core";
584
762
  *
585
- * const collection = new AsyncIterableCollection([1, 2, 3, 4, 5, 6, 7]);
586
- * const chunks = collection.split(3);
587
- * await chunks.map(chunk => chunk.toArray()).toArray();
588
- * // [[1, 2, 7], [3, 4], [5, 6]]
763
+ * // Asume the inputed collection is empty.
764
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
765
+ * await collection
766
+ * .append([1, 2, 3, 4, 5, 6, 7])
767
+ * .split(3)
768
+ * .map(chunk => chunk.toArray())
769
+ * .toArray();
770
+ * // [[1, 2, 7], [3, 4], [5, 6]]
771
+ * }
589
772
  */
590
773
  split(chunkAmount: number): IAsyncCollection<IAsyncCollection<TInput>>;
591
774
  /**
592
775
  * The <i>partition</i> method is used to separate items that pass <i>predicateFn</i> from those that do not.
593
776
  * @example
594
777
  * ```ts
595
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
778
+ * import type { IAsyncCollection } from "@daiso-tech/core";
596
779
  *
597
- * const collection = new AsyncIterableCollection([1, 2, 3, 4, 5, 6]);
598
- * const chunks = collection.partition(item => item < 3);
599
- * await chunks.map(chunk => chunk.toArray()).toArray();
600
- * // [[1, 2], [3, 4, 5, 6]]
780
+ * // Asume the inputed collection is empty.
781
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
782
+ * await collection
783
+ * .append([1, 2, 3, 4, 5, 6])
784
+ * .partition(item => item < 3)
785
+ * .map(chunk => chunk.toArray())
786
+ * .toArray();
787
+ * // [[1, 2], [3, 4, 5, 6]]
788
+ * }
601
789
  * ```
602
790
  */
603
791
  partition(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): IAsyncCollection<IAsyncCollection<TInput>>;
@@ -605,12 +793,17 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
605
793
  * The <i>sliding</i> method returns a new collection of chunks representing a "sliding window" view of the items in the collection.
606
794
  * @example
607
795
  * ```ts
608
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
796
+ * import type { IAsyncCollection } from "@daiso-tech/core";
609
797
  *
610
- * const collection = new AsyncIterableCollection([1, 2, 3, 4, 5])
611
- * const chunks = collection.sliding(2);
612
- * await chunks.map(chunk => chunk.toArray()).toArray();
613
- * // [[1, 2], [2, 3], [3, 4], [4, 5]]
798
+ * // Asume the inputed collection is empty.
799
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
800
+ * await collection
801
+ * .append([1, 2, 3, 4, 5])
802
+ * .sliding(2)
803
+ * .map(chunk => chunk.toArray())
804
+ * .toArray();
805
+ * // [[1, 2], [2, 3], [3, 4], [4, 5]]
806
+ * }
614
807
  * ```
615
808
  */
616
809
  sliding(chunkSize: number, step?: number): IAsyncCollection<IAsyncCollection<TInput>>;
@@ -619,47 +812,53 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
619
812
  * By default the equality check occurs on the item.
620
813
  * @example
621
814
  * ```ts
622
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
623
- *
624
- * const collection = new AsyncIterableCollection(["a", "a", "a", "b", "b", "c"]);
625
- * const group = await collection
626
- * .groupBy()
627
- * .map(([key, collection]) => [key, collection.toArray()])
628
- * .toArray();
629
- * // [
630
- * // [
631
- * // "a",
632
- * // ["a", "a", "a"]
633
- * // ],
634
- * // [
635
- * // "b",
636
- * // ["b", "b"]
637
- * // ],
638
- * // [
639
- * // "c",
640
- * // ["c"]
641
- * // ]
642
- * // ]
643
- * ```
644
- * @example
645
- * ```ts
646
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
647
- *
648
- * const collection = new AsyncIterableCollection(["alice@gmail.com", "bob@yahoo.com", "carlos@gmail.com"]);
649
- * const group = await collection
650
- * .groupBy(item => item.split("@")[1])
651
- * .map(([key, collection]) => [key, collection.toArray()])
652
- * .toArray();
653
- * // [
654
- * // [
655
- * // "gmail.com",
656
- * // ["alice@gmail.com", "carlos@gmail.com"]
657
- * // ],
658
- * // [
659
- * // "yahoo.com",
660
- * // ["bob@yahoo.com"]
661
- * // ]
662
- * // ]
815
+ * import type { IAsyncCollection } from "@daiso-tech/core";
816
+ *
817
+ * // Asume the inputed collection is empty.
818
+ * async function main(collection: IAsyncCollection<string>): Promise<void> {
819
+ * await collection
820
+ * .append(["a", "a", "a", "b", "b", "c"])
821
+ * .groupBy()
822
+ * .map(([key, collection]) => [key, collection.toArray()])
823
+ * .toArray();
824
+ * // [
825
+ * // [
826
+ * // "a",
827
+ * // ["a", "a", "a"]
828
+ * // ],
829
+ * // [
830
+ * // "b",
831
+ * // ["b", "b"]
832
+ * // ],
833
+ * // [
834
+ * // "c",
835
+ * // ["c"]
836
+ * // ]
837
+ * // ]
838
+ * }
839
+ * ```
840
+ * @example
841
+ * ```ts
842
+ * import type { IAsyncCollection } from "@daiso-tech/core";
843
+ *
844
+ * // Asume the inputed collection is empty.
845
+ * async function main(collection: IAsyncCollection<string>): Promise<void> {
846
+ * await collection
847
+ * .append(["alice@gmail.com", "bob@yahoo.com", "carlos@gmail.com"])
848
+ * .groupBy(item => item.split("@")[1])
849
+ * .map(([key, collection]) => [key, collection.toArray()])
850
+ * .toArray();
851
+ * // [
852
+ * // [
853
+ * // "gmail.com",
854
+ * // ["alice@gmail.com", "carlos@gmail.com"]
855
+ * // ],
856
+ * // [
857
+ * // "yahoo.com",
858
+ * // ["bob@yahoo.com"]
859
+ * // ]
860
+ * // ]
861
+ * }
663
862
  * ```
664
863
  */
665
864
  groupBy<TOutput = TInput>(selectFn?: AsyncMap<TInput, IAsyncCollection<TInput>, TOutput>): IAsyncCollection<[TOutput, IAsyncCollection<TInput>]>;
@@ -668,31 +867,37 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
668
867
  * By default the equality check occurs on the item.
669
868
  * @example
670
869
  * ```ts
671
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
672
- *
673
- * const collection = new AsyncIterableCollection(["a", "a", "a", "b", "b", "c"]);
674
- * const count = await collection
675
- * .countBy()
676
- * .map(([key, collection]) => [key, collection.toArray()])
677
- * .toArray();
678
- * // [
679
- * // ["a", 3],
680
- * // ["b", 2],
681
- * // ["c", 1]
682
- * // ]
870
+ * import type { IAsyncCollection } from "@daiso-tech/core";
871
+ *
872
+ * // Asume the inputed collection is empty.
873
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
874
+ * await collection
875
+ * .append(["a", "a", "a", "b", "b", "c"])
876
+ * .countBy()
877
+ * .map(([key, collection]) => [key, collection.toArray()])
878
+ * .toArray();
879
+ * // [
880
+ * // ["a", 3],
881
+ * // ["b", 2],
882
+ * // ["c", 1]
883
+ * // ]
884
+ * }
683
885
  * ```
684
886
  * @example
685
887
  * ```ts
686
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
888
+ * import type { IAsyncCollection } from "@daiso-tech/core";
687
889
  *
688
- * const collection = new AsyncIterableCollection(["alice@gmail.com", "bob@yahoo.com", "carlos@gmail.com"]);
689
- * const count = await collection
690
- * .countBy(item => item.split("@")[1])
691
- * .toArray();
692
- * // [
693
- * // ["gmail.com", 2],
694
- * // ["yahoo.com", 1]
695
- * // ]
890
+ * // Asume the inputed collection is empty.
891
+ * async function main(collection: IAsyncCollection<string>): Promise<void> {
892
+ * await collection
893
+ * .append(["alice@gmail.com", "bob@yahoo.com", "carlos@gmail.com"])
894
+ * .countBy(item => item.split("@")[1])
895
+ * .toArray();
896
+ * // [
897
+ * // ["gmail.com", 2],
898
+ * // ["yahoo.com", 1]
899
+ * // ]
900
+ * }
696
901
  * ```
697
902
  */
698
903
  countBy<TOutput = TInput>(selectFn?: AsyncMap<TInput, IAsyncCollection<TInput>, TOutput>): IAsyncCollection<[TOutput, number]>;
@@ -701,30 +906,44 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
701
906
  * By default the equality check occurs on the item.
702
907
  * @example
703
908
  * ```ts
704
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
909
+ * import type { IAsyncCollection } from "@daiso-tech/core";
910
+ *
911
+ * type Phone = {
912
+ * name: string;
913
+ * brand: string;
914
+ * type: string;
915
+ * };
705
916
  *
706
- * const collection = new AsyncIterableCollection([1, 1, 2, 2, 3, 4, 2]);
707
- * await collection.unique().toArray();
708
- * // [1, 2, 3, 4]
917
+ * // Asume the inputed collection is empty.
918
+ * async function main(collection: IAsyncCollection<Phone>): Promise<void> {
919
+ * await collection
920
+ * .append([1, 1, 2, 2, 3, 4, 2])
921
+ * .unique()
922
+ * .toArray();
923
+ * // [1, 2, 3, 4]
924
+ * }
709
925
  * ```
710
926
  * @example
711
927
  * ```ts
712
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
713
- *
714
- * const collection = new AsyncIterableCollection([
715
- * { name: "iPhone 6", brand: "Apple", type: "phone" },
716
- * { name: "iPhone 5", brand: "Apple", type: "phone" },
717
- * { name: "Apple Watch", brand: "Apple", type: "watch" },
718
- * { name: "Galaxy S6", brand: "Samsung", type: "phone" },
719
- * { name: "Galaxy Gear", brand: "Samsung", type: "watch" },
720
- * ]);
721
- * const unique = await collection.unique({
722
- * selectFn: item => item.brand
723
- * }).toArray();
724
- * // [
725
- * // { name: "iPhone 6", brand: "Apple", type: "phone" },
726
- * // { name: "Galaxy S6", brand: "Samsung", type: "phone" },
727
- * // ]
928
+ * import type { IAsyncCollection } from "@daiso-tech/core";
929
+ *
930
+ * // Asume the inputed collection is empty.
931
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
932
+ * await collection
933
+ * .append([
934
+ * { name: "iPhone 6", brand: "Apple", type: "phone" },
935
+ * { name: "iPhone 5", brand: "Apple", type: "phone" },
936
+ * { name: "Apple Watch", brand: "Apple", type: "watch" },
937
+ * { name: "Galaxy S6", brand: "Samsung", type: "phone" },
938
+ * { name: "Galaxy Gear", brand: "Samsung", type: "watch" },
939
+ * ])
940
+ * .unique(item => item.brand)
941
+ * .toArray();
942
+ * // [
943
+ * // { name: "iPhone 6", brand: "Apple", type: "phone" },
944
+ * // { name: "Galaxy S6", brand: "Samsung", type: "phone" },
945
+ * // ]
946
+ * }
728
947
  * ```
729
948
  */
730
949
  unique<TOutput = TInput>(selectFn?: AsyncMap<TInput, IAsyncCollection<TInput>, TOutput>): IAsyncCollection<TInput>;
@@ -733,36 +952,50 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
733
952
  * By default the equality check occurs on the item.
734
953
  * @example
735
954
  * ```ts
736
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
955
+ * import type { IAsyncCollection } from "@daiso-tech/core";
737
956
  *
738
- * const collection = new AsyncIterableCollection([1, 2, 2, 3, 4, 5]);
739
- * const difference = collection.difference([2, 4, 6, 8]);
740
- * await difference.toArray();
741
- * // [1, 3, 5]
957
+ * // Asume the inputed collection is empty.
958
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
959
+ * await collection
960
+ * .append([1, 2, 2, 3, 4, 5])
961
+ * .difference([2, 4, 6, 8])
962
+ * .toArray();
963
+ * // [1, 3, 5]
964
+ * }
742
965
  * ```
743
966
  * @example
744
967
  * ```ts
745
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
746
- *
747
- * const collection = new AsyncIterableCollection([
748
- * { name: "iPhone 6", brand: "Apple", type: "phone" },
749
- * { name: "iPhone 5", brand: "Apple", type: "phone" },
750
- * { name: "Apple Watch", brand: "Apple", type: "watch" },
751
- * { name: "Galaxy S6", brand: "Samsung", type: "phone" },
752
- * { name: "Galaxy Gear", brand: "Samsung", type: "watch" },
753
- * ]);
754
- * const difference = collection.difference(
755
- * [
756
- * { name: "Apple Watch", brand: "Apple", type: "watch" },
757
- * ],
758
- * (product) => product.type
759
- * );
760
- * await difference.toArray();
761
- * // [
762
- * // { name: "iPhone 6", brand: "Apple", type: "phone" },
763
- * // { name: "iPhone 5", brand: "Apple", type: "phone" },
764
- * // { name: "Galaxy S6", brand: "Samsung", type: "phone" },
765
- * // ]
968
+ * import type { IAsyncCollection } from "@daiso-tech/core";
969
+ *
970
+ * type Phone = {
971
+ * name: string;
972
+ * brand: string;
973
+ * type: string;
974
+ * };
975
+ *
976
+ * // Asume the inputed collection is empty.
977
+ * async function main(collection: IAsyncCollection<Phone>): Promise<void> {
978
+ * await collection
979
+ * .append([
980
+ * { name: "iPhone 6", brand: "Apple", type: "phone" },
981
+ * { name: "iPhone 5", brand: "Apple", type: "phone" },
982
+ * { name: "Apple Watch", brand: "Apple", type: "watch" },
983
+ * { name: "Galaxy S6", brand: "Samsung", type: "phone" },
984
+ * { name: "Galaxy Gear", brand: "Samsung", type: "watch" },
985
+ * ])
986
+ * .difference(
987
+ * [
988
+ * { name: "Apple Watch", brand: "Apple", type: "watch" },
989
+ * ],
990
+ * (product) => product.type
991
+ * )
992
+ * .toArray();
993
+ * // [
994
+ * // { name: "iPhone 6", brand: "Apple", type: "phone" },
995
+ * // { name: "iPhone 5", brand: "Apple", type: "phone" },
996
+ * // { name: "Galaxy S6", brand: "Samsung", type: "phone" },
997
+ * // ]
998
+ * }
766
999
  * ```
767
1000
  */
768
1001
  difference<TOutput = TInput>(iterable: AsyncIterableValue<TInput>, selectFn?: AsyncMap<TInput, IAsyncCollection<TInput>, TOutput>): IAsyncCollection<TInput>;
@@ -770,12 +1003,16 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
770
1003
  * The <i>repeat</i> method will repeat the original collection <i>amount</i> times.
771
1004
  * @example
772
1005
  * ```ts
773
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
1006
+ * import type { IAsyncCollection } from "@daiso-tech/core";
774
1007
  *
775
- * const collection = new AsyncIterableCollection([1, 2, 3]);
776
- * const newCollection = collection.repeat(3);
777
- * await newCollection.toArray();
778
- * // [1, 2, 3, 1, 2, 3, 1, 2, 3]
1008
+ * // Asume the inputed collection is empty.
1009
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
1010
+ * await collection
1011
+ * .append([1, 2, 3])
1012
+ * .repeat(3)
1013
+ * .toArray();
1014
+ * // [1, 2, 3, 1, 2, 3, 1, 2, 3]
1015
+ * }
779
1016
  * ```
780
1017
  */
781
1018
  repeat(amount: number): IAsyncCollection<TInput>;
@@ -784,19 +1021,46 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
784
1021
  * The padding is applied from the start of this collection.
785
1022
  * @example
786
1023
  * ```ts
787
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
788
- *
789
- * await new AsyncIterableCollection("abc").padStart(10, "foo").join("");
790
- * // "foofoofabc"
1024
+ * import type { IAsyncCollection } from "@daiso-tech/core";
791
1025
  *
792
- * await new AsyncIterableCollection("abc").padStart(6, "123465").join("");
793
- * // "123abc"
794
- *
795
- * await new AsyncIterableCollection("abc").padStart(8, "0").join("");
796
- * // "00000abc"
797
- *
798
- * await new AsyncIterableCollection("abc").padStart(1, "_").join("");
799
- * // "abc"
1026
+ * // Asume the inputed collection is empty.
1027
+ * async function main(collection: IAsyncCollection<string>): Promise<void> {
1028
+ * await collection
1029
+ * .append("abc")
1030
+ * .padStart(10, "foo")
1031
+ * .join("");
1032
+ * // "foofoofabc"
1033
+ * }
1034
+ * ```
1035
+ * @example
1036
+ * ```ts
1037
+ * async function main(collection: IAsyncCollection<string>): Promise<void> {
1038
+ * await collection
1039
+ * .append("abc")
1040
+ * .padStart(6, "123465")
1041
+ * .join("");
1042
+ * // "123abc"
1043
+ * }
1044
+ * ```
1045
+ * @example
1046
+ * ```ts
1047
+ * async function main(collection: IAsyncCollection<string>): Promise<void> {
1048
+ * await collection
1049
+ * .append("abc")
1050
+ * .padStart(8, "0")
1051
+ * .join("");
1052
+ * // "00000abc"
1053
+ * }
1054
+ * ```
1055
+ * @example
1056
+ * ```ts
1057
+ * async function main(collection: IAsyncCollection<string>): Promise<void> {
1058
+ * await collection
1059
+ * .append("abc")
1060
+ * .padStart(1, "_")
1061
+ * .join("");
1062
+ * // "abc"
1063
+ * }
800
1064
  * ```
801
1065
  */
802
1066
  padStart<TExtended = TInput>(maxLength: number, fillItems: AsyncIterableValue<TExtended>): IAsyncCollection<TInput | TExtended>;
@@ -805,19 +1069,46 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
805
1069
  * The padding is applied from the end of this collection.
806
1070
  * @example
807
1071
  * ```ts
808
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
809
- *
810
- * await new AsyncIterableCollection("abc").padEnd(10, "foo").join("");
811
- * // "abcfoofoof"
1072
+ * import type { IAsyncCollection } from "@daiso-tech/core";
812
1073
  *
813
- * await new AsyncIterableCollection("abc").padEnd(6, "123465").join("");
814
- * // "abc123"
815
- *
816
- * await new AsyncIterableCollection("abc").padEnd(8, "0").join("");
817
- * // "abc00000"
818
- *
819
- * await new AsyncIterableCollection("abc").padEnd(1, "_").join("");
820
- * // "abc"
1074
+ * // Asume the inputed collection is empty.
1075
+ * async function main(collection: IAsyncCollection<string>): Promise<void> {
1076
+ * await collection
1077
+ * .append("abc")
1078
+ * .padEnd(10, "foo")
1079
+ * .join("");
1080
+ * // "abcfoofoof"
1081
+ * }
1082
+ * ```
1083
+ * @example
1084
+ * ```ts
1085
+ * async function main(collection: IAsyncCollection<string>): Promise<void> {
1086
+ * await collection
1087
+ * .append("abc")
1088
+ * .padEnd(6, "123465")
1089
+ * .join("");
1090
+ * // "abc123"
1091
+ * }
1092
+ * ```
1093
+ * @example
1094
+ * ```ts
1095
+ * async function main(collection: IAsyncCollection<string>): Promise<void> {
1096
+ * await collection
1097
+ * .append("abc")
1098
+ * .padEnd(8, "0")
1099
+ * .join("");
1100
+ * // "abc00000"
1101
+ * }
1102
+ * ```
1103
+ * @example
1104
+ * ```ts
1105
+ * async function main(collection: IAsyncCollection<string>): Promise<void> {
1106
+ * await collection
1107
+ * .append("abc")
1108
+ * .padEnd(1, "_")
1109
+ * .join("");
1110
+ * // "abc"
1111
+ * }
821
1112
  * ```
822
1113
  */
823
1114
  padEnd<TExtended = TInput>(maxLength: number, fillItems: AsyncIterableValue<TExtended>): IAsyncCollection<TInput | TExtended>;
@@ -826,51 +1117,81 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
826
1117
  * where <i>start</i> and <i>end</i> (end not included) represent the index of items in the collection.
827
1118
  * @example
828
1119
  * ```ts
829
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
1120
+ * import type { IAsyncCollection } from "@daiso-tech/core";
830
1121
  *
831
- * const collection = new AsyncIterableCollection(["a", "b", "c", "d", "e", "f"]);
832
- * await collection.slice(3).toArray();
833
- * // ["d", "e", "f"]
1122
+ * // Asume the inputed collection is empty.
1123
+ * async function main(collection: IAsyncCollection<string>): Promise<void> {
1124
+ * await collection
1125
+ * .append(["a", "b", "c", "d", "e", "f"])
1126
+ * .slice(3)
1127
+ * .toArray();
1128
+ * // ["d", "e", "f"]
1129
+ * }
834
1130
  * ```
835
1131
  * @example
836
1132
  * ```ts
837
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
1133
+ * import type { IAsyncCollection } from "@daiso-tech/core";
838
1134
  *
839
- * const collection = new AsyncIterableCollection(["a", "b", "c", "d", "e", "f"]);
840
- * await collection.slice(undefined, 2).toArray();
841
- * // ["a", "b"]
1135
+ * // Asume the inputed collection is empty.
1136
+ * async function main(collection: IAsyncCollection<string>): Promise<void> {
1137
+ * await collection
1138
+ * .append(["a", "b", "c", "d", "e", "f"])
1139
+ * .slice(undefined, 2)
1140
+ * .toArray();
1141
+ * // ["a", "b"]
1142
+ * }
842
1143
  * ```
843
1144
  * @example
844
1145
  * ```ts
845
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
1146
+ * import type { IAsyncCollection } from "@daiso-tech/core";
846
1147
  *
847
- * const collection = new AsyncIterableCollection(["a", "b", "c", "d", "e", "f"]);
848
- * await collection.slice(2, 5).toArray();
849
- * // ["c", "d", "e"]
1148
+ * // Asume the inputed collection is empty.
1149
+ * async function main(collection: IAsyncCollection<string>): Promise<void> {
1150
+ * await collection
1151
+ * .append(["a", "b", "c", "d", "e", "f"])
1152
+ * .slice(2, 5)
1153
+ * .toArray();
1154
+ * // ["c", "d", "e"]
1155
+ * }
850
1156
  * ```
851
1157
  * @example
852
1158
  * ```ts
853
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
1159
+ * import type { IAsyncCollection } from "@daiso-tech/core";
854
1160
  *
855
- * const collection = new AsyncIterableCollection(["a", "b", "c", "d", "e", "f"]);
856
- * await collection.slice(-2).toArray();
857
- * // ["e", "f"]
1161
+ * // Asume the inputed collection is empty.
1162
+ * async function main(collection: IAsyncCollection<string>): Promise<void> {
1163
+ * await collection
1164
+ * .append(["a", "b", "c", "d", "e", "f"])
1165
+ * .slice(-2)
1166
+ * .toArray();
1167
+ * // ["e", "f"]
1168
+ * }
858
1169
  * ```
859
1170
  * @example
860
1171
  * ```ts
861
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
1172
+ * import type { IAsyncCollection } from "@daiso-tech/core";
862
1173
  *
863
- * const collection = new AsyncIterableCollection(["a", "b", "c", "d", "e", "f"]);
864
- * await collection.slice(undefined, -2).toArray();
865
- * // ["a", "b", "c", "d"]
1174
+ * // Asume the inputed collection is empty.
1175
+ * async function main(collection: IAsyncCollection<string>): Promise<void> {
1176
+ * await collection
1177
+ * .append(["a", "b", "c", "d", "e", "f"])
1178
+ * .slice(undefined, -2)
1179
+ * .toArray();
1180
+ * // ["a", "b", "c", "d"]
1181
+ * }
866
1182
  * ```
867
1183
  * @example
868
1184
  * ```ts
869
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
1185
+ * import type { IAsyncCollection } from "@daiso-tech/core";
870
1186
  *
871
- * const collection = new AsyncIterableCollection(["a", "b", "c", "d", "e", "f"]);
872
- * await collection.slice(-4, -2).toArray();
873
- * // ["c", "d"]
1187
+ * // Asume the inputed collection is empty.
1188
+ * async function main(collection: IAsyncCollection<string>): Promise<void> {
1189
+ * await collection
1190
+ * .append(["a", "b", "c", "d", "e", "f"])
1191
+ * .slice(-4, -2)
1192
+ * .toArray();
1193
+ * // ["c", "d"]
1194
+ * }
874
1195
  * ```
875
1196
  */
876
1197
  slice(start?: number, end?: number): IAsyncCollection<TInput>;
@@ -878,11 +1199,16 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
878
1199
  * The <i>prepend</i> method adds <i>iterable</i> to the beginning of the collection.
879
1200
  * @example
880
1201
  * ```ts
881
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
1202
+ * import type { IAsyncCollection } from "@daiso-tech/core";
882
1203
  *
883
- * const collection = new AsyncIterableCollection([1, 2, 3, 4, 5]).prepend([-1, 20]);
884
- * await collection.toArray();
885
- * // [-1, 20, 1, 2, 3, 4, 5]
1204
+ * // Asume the inputed collection is empty.
1205
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
1206
+ * await collection
1207
+ * .append([1, 2, 3, 4, 5])
1208
+ * .prepend([-1, 20])
1209
+ * .toArray();
1210
+ * // [-1, 20, 1, 2, 3, 4, 5]
1211
+ * }
886
1212
  * ```
887
1213
  */
888
1214
  prepend<TExtended = TInput>(iterable: AsyncIterableValue<TInput | TExtended>): IAsyncCollection<TInput | TExtended>;
@@ -890,11 +1216,16 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
890
1216
  * The <i>append</i> method adds <i>iterable</i> to the end of the collection.
891
1217
  * @example
892
1218
  * ```ts
893
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
1219
+ * import type { IAsyncCollection } from "@daiso-tech/core";
894
1220
  *
895
- * const collection = new AsyncIterableCollection([1, 2, 3, 4, 5]).append([-1, -2]);
896
- * await collection.toArray();
897
- * // [1, 2, 3, 4, 5, -1, -2,]
1221
+ * // Asume the inputed collection is empty.
1222
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
1223
+ * await collection
1224
+ * .append([1, 2, 3, 4, 5])
1225
+ * .append([-1, -2])
1226
+ * .toArray();
1227
+ * // [1, 2, 3, 4, 5, -1, -2,]
1228
+ * }
898
1229
  * ```
899
1230
  */
900
1231
  append<TExtended = TInput>(iterable: AsyncIterableValue<TInput | TExtended>): IAsyncCollection<TInput | TExtended>;
@@ -902,11 +1233,16 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
902
1233
  * The <i>insertBefore</i> method adds <i>iterable</i> before the first item that matches <i>predicateFn</i>.
903
1234
  * @example
904
1235
  * ```ts
905
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
1236
+ * import type { IAsyncCollection } from "@daiso-tech/core";
906
1237
  *
907
- * const collection = new AsyncIterableCollection([1, 2, 2, 3, 4, 5]).insertBefore(item => item === 2, [-1, 20]);
908
- * await collection.toArray();
909
- * // [1, -1, 20, 2, 2, 3, 4, 5]
1238
+ * // Asume the inputed collection is empty.
1239
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
1240
+ * await collection
1241
+ * .append([1, 2, 2, 3, 4, 5])
1242
+ * .insertBefore(item => item === 2, [-1, 20])
1243
+ * .toArray();
1244
+ * // [1, -1, 20, 2, 2, 3, 4, 5]
1245
+ * }
910
1246
  * ```
911
1247
  */
912
1248
  insertBefore<TExtended = TInput>(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>, iterable: AsyncIterableValue<TInput | TExtended>): IAsyncCollection<TInput | TExtended>;
@@ -914,11 +1250,16 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
914
1250
  * The <i>insertAfter</i> method adds <i>iterable</i> after the first item that matches <i>predicateFn</i>.
915
1251
  * @example
916
1252
  * ```ts
917
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
1253
+ * import type { IAsyncCollection } from "@daiso-tech/core";
918
1254
  *
919
- * const collection = new AsyncIterableCollection([1, 2, 2, 3, 4, 5]).insertAfter(item => item === 2, [-1, 20]);
920
- * await collection.toArray();
921
- * // [1, 2, -1, 20, 2, 3, 4, 5]
1255
+ * // Asume the inputed collection is empty.
1256
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
1257
+ * await collection
1258
+ * .append([1, 2, 2, 3, 4, 5])
1259
+ * .insertAfter(item => item === 2, [-1, 20])
1260
+ * .toArray();
1261
+ * // [1, 2, -1, 20, 2, 3, 4, 5]
1262
+ * }
922
1263
  * ```
923
1264
  */
924
1265
  insertAfter<TExtended = TInput>(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>, iterable: AsyncIterableValue<TInput | TExtended>): IAsyncCollection<TInput | TExtended>;
@@ -926,35 +1267,42 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
926
1267
  * The <i>crossJoin</i> method cross joins the collection's values among <i>iterables</i>, returning a Cartesian product with all possible permutations.
927
1268
  * @example
928
1269
  * ```ts
929
- * import { ListCollection } from "@daiso-tech/core";;
1270
+ * import { ICollection } from "@daiso-tech/core";;
930
1271
  *
931
- * const collection = new ListCollection([1, 2]);
932
- * const matrix = collection.cross(["a", "b"]);
933
- * await matrix.toArray();
934
- * // [
935
- * // [1, "a"],
936
- * // [1, "b"],
937
- * // [2, "a"],
938
- * // [2, "b"],
939
- * // ]
1272
+ * async function(): Promise<void> {
1273
+ * await collection
1274
+ * .append([1, 2])
1275
+ * .cross(["a", "b"])
1276
+ * .toArray();
1277
+ * // [
1278
+ * // [1, "a"],
1279
+ * // [1, "b"],
1280
+ * // [2, "a"],
1281
+ * // [2, "b"],
1282
+ * // ]
1283
+ * }
940
1284
  * ```
941
1285
  * @example
942
1286
  * ```ts
943
- * import { ListCollection } from "@daiso-tech/core";;
944
- *
945
- * const collection = new ListCollection([1, 2]);
946
- * const matrix = collection.cross(["a", "b"]).cross(["I", "II"]);
947
- * await matrix.toArray();
948
- * // [
949
- * // [1, "a", "I"],
950
- * // [1, "a", "II"],
951
- * // [1, "b", "I"],
952
- * // [1, "b", "II"],
953
- * // [2, "a", "I"],
954
- * // [2, "a", "II"],
955
- * // [2, "b", "I"],
956
- * // [2, "b", "II"],
957
- * // ]
1287
+ * import { ICollection } from "@daiso-tech/core";;
1288
+ *
1289
+ * async function(): Promise<void> {
1290
+ * await collection
1291
+ * .append([1, 2])
1292
+ * .cross(["a", "b"])
1293
+ * .cross(["I", "II"])
1294
+ * .toArray();
1295
+ * // [
1296
+ * // [1, "a", "I"],
1297
+ * // [1, "a", "II"],
1298
+ * // [1, "b", "I"],
1299
+ * // [1, "b", "II"],
1300
+ * // [2, "a", "I"],
1301
+ * // [2, "a", "II"],
1302
+ * // [2, "b", "I"],
1303
+ * // [2, "b", "II"],
1304
+ * // ]
1305
+ * }
958
1306
  * ```
959
1307
  */
960
1308
  crossJoin<TExtended>(iterable: AsyncIterableValue<TExtended>): IAsyncCollection<CrossJoinResult<TInput, TExtended>>;
@@ -963,30 +1311,42 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
963
1311
  * The returned collection has size of the shortest collection.
964
1312
  * @example
965
1313
  * ```ts
966
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
1314
+ * import type { IAsyncCollection } from "@daiso-tech/core";
967
1315
  *
968
- * const collection = new AsyncIterableCollection(["Chair", "Desk"]);
969
- * const zipped = collection.zip([100, 200]);
970
- * await zipped.toArray();
971
- * // [["Chair", 100], ["Desk", 200]]
1316
+ * // Asume the inputed collection is empty.
1317
+ * async function main(collection: IAsyncCollection<string>): Promise<void> {
1318
+ * await collection
1319
+ * .append(["Chair", "Desk"])
1320
+ * .zip([100, 200])
1321
+ * .toArray();
1322
+ * // [["Chair", 100], ["Desk", 200]]
1323
+ * }
972
1324
  * ```
973
1325
  * @example
974
1326
  * ```ts
975
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
1327
+ * import type { IAsyncCollection } from "@daiso-tech/core";
976
1328
  *
977
- * const collection = new AsyncIterableCollection(["Chair", "Desk", "Couch"]);
978
- * const zipped = collection.zip([100, 200]);
979
- * await zipped.toArray();
980
- * // [["Chair", 100], ["Desk", 200]]
1329
+ * // Asume the inputed collection is empty.
1330
+ * async function main(collection: IAsyncCollection<string>): Promise<void> {
1331
+ * await collection
1332
+ * .append(["Chair", "Desk", "Couch"])
1333
+ * .zip([100, 200])
1334
+ * .toArray();
1335
+ * // [["Chair", 100], ["Desk", 200]]
1336
+ * }
981
1337
  * ```
982
1338
  * @example
983
1339
  * ```ts
984
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
1340
+ * import type { IAsyncCollection } from "@daiso-tech/core";
985
1341
  *
986
- * const collection = new AsyncIterableCollection(["Chair", "Desk"]);
987
- * const zipped = collection.zip([100, 200, 300]);
988
- * await zipped.toArray();
989
- * // [["Chair", 100], ["Desk", 200]]
1342
+ * // Asume the inputed collection is empty.
1343
+ * async function main(collection: IAsyncCollection<string>): Promise<void> {
1344
+ * await collection
1345
+ * .append(["Chair", "Desk"])
1346
+ * .zip([100, 200, 300])
1347
+ * .toArray();
1348
+ * // [["Chair", 100], ["Desk", 200]]
1349
+ * }
990
1350
  * ```
991
1351
  */
992
1352
  zip<TExtended>(iterable: AsyncIterableValue<TExtended>): IAsyncCollection<[TInput, TExtended]>;
@@ -994,29 +1354,44 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
994
1354
  * The <i>sort</i> method sorts the collection. You can provide a <i>comparator</i> function.
995
1355
  * @example
996
1356
  * ```ts
997
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
1357
+ * import type { IAsyncCollection } from "@daiso-tech/core";
998
1358
  *
999
- * const collection = new AsyncIterableCollection([-1, 2, 4, 3]);
1000
- * await collection.sort().toArray();
1001
- * // [-1, 2, 3, 4]
1359
+ * type Person = {
1360
+ * name: string;
1361
+ * age: number;
1362
+ * };
1363
+ *
1364
+ * // Asume the inputed collection is empty.
1365
+ * async function main(collection: IAsyncCollection<Person>): Promise<void> {
1366
+ * await collection
1367
+ * .append([-1, 2, 4, 3])
1368
+ * .sort()
1369
+ * .toArray();
1370
+ * // [-1, 2, 3, 4]
1371
+ * }
1002
1372
  * ```
1003
1373
  * @example
1004
1374
  * ```ts
1005
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
1006
- *
1007
- * const collection = new AsyncIterableCollection([
1008
- * { name: "Anders", age: 30 },
1009
- * { name: "Joe", age: 20 },
1010
- * { name: "Hasan", age: 25 },
1011
- * { name: "Linda", age: 19 }
1012
- * ]);
1013
- * await collection.sort(({ age: ageA }, { age: ageB }) => ageA - ageB).toArray();
1014
- * // [
1015
- * // { name: "Linda", age: 19 }
1016
- * // { name: "Joe", age: 20 },
1017
- * // { name: "Hasan", age: 25 },
1018
- * // { name: "Anders", age: 30 },
1019
- * // ]
1375
+ * import type { IAsyncCollection } from "@daiso-tech/core";
1376
+ *
1377
+ * // Asume the inputed collection is empty.
1378
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
1379
+ * await collection
1380
+ * .append([
1381
+ * { name: "Anders", age: 30 },
1382
+ * { name: "Joe", age: 20 },
1383
+ * { name: "Hasan", age: 25 },
1384
+ * { name: "Linda", age: 19 }
1385
+ * ])
1386
+ * .sort(({ age: ageA }, { age: ageB }) => ageA - ageB)
1387
+ * .toArray();
1388
+ * // [
1389
+ * // { name: "Linda", age: 19 }
1390
+ * // { name: "Joe", age: 20 },
1391
+ * // { name: "Hasan", age: 25 },
1392
+ * // { name: "Anders", age: 30 },
1393
+ * // ]
1394
+ * }
1020
1395
  * ```
1021
1396
  */
1022
1397
  sort(comparator?: Comparator<TInput>): IAsyncCollection<TInput>;
@@ -1025,11 +1400,16 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
1025
1400
  * The reversing of the collection will be applied in chunks that are the size of <i> chunkSize </i>.
1026
1401
  * @example
1027
1402
  * ```ts
1028
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
1403
+ * import type { IAsyncCollection } from "@daiso-tech/core";
1029
1404
  *
1030
- * const collection = new AsyncIterableCollection([-1, 2, 4, 3]);
1031
- * await collection.reverse().toArray();
1032
- * // [3, 4, 2, -1]
1405
+ * // Asume the inputed collection is empty.
1406
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
1407
+ * await collection
1408
+ * .append([-1, 2, 4, 3])
1409
+ * .reverse()
1410
+ * .toArray();
1411
+ * // [3, 4, 2, -1]
1412
+ * }
1033
1413
  * ```
1034
1414
  */
1035
1415
  reverse(chunkSize?: number): IAsyncCollection<TInput>;
@@ -1042,29 +1422,40 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
1042
1422
  * By default it will get the first item. If the collection is empty or no items passes <i> predicateFn </i> than null i returned.
1043
1423
  * @example
1044
1424
  * ```ts
1045
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
1425
+ * import type { IAsyncCollection } from "@daiso-tech/core";
1046
1426
  *
1047
- * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
1048
- * await collection.first();
1049
- * // 1
1427
+ * // Asume the inputed collection is empty.
1428
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
1429
+ * await collection
1430
+ * .append([1, 2, 3, 4])
1431
+ * .first();
1432
+ * // 1
1433
+ * }
1050
1434
  * ```
1051
1435
  * @example
1052
1436
  * ```ts
1053
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
1437
+ * import type { IAsyncCollection } from "@daiso-tech/core";
1054
1438
  *
1055
- * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
1056
- * await collection.first(item => item > 2);
1057
- * // 3
1439
+ * // Asume the inputed collection is empty.
1440
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
1441
+ * await collection
1442
+ * .append([1, 2, 3, 4])
1443
+ * .first(item => item > 2);
1444
+ * // 3
1445
+ * }
1058
1446
  * ```
1059
1447
  * @example
1060
1448
  * ```ts
1061
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
1449
+ * import type { IAsyncCollection } from "@daiso-tech/core";
1062
1450
  *
1063
- * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
1064
- * await collection.first(item => item > 10);
1065
- * // null
1451
+ * // Asume the inputed collection is empty.
1452
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
1453
+ * await collection
1454
+ * .append([1, 2, 3, 4])
1455
+ * .first(item => item > 10);
1456
+ * // null
1457
+ * }
1066
1458
  * ```
1067
- * // 3
1068
1459
  */
1069
1460
  first<TOutput extends TInput>(predicateFn?: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>): LazyPromise<TOutput | null>;
1070
1461
  /**
@@ -1072,35 +1463,51 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
1072
1463
  * By default it will get the first item. If the collection is empty or no items passes <i> predicateFn </i> than <i> defaultValue </i>.
1073
1464
  * @example
1074
1465
  * ```ts
1075
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
1466
+ * import type { IAsyncCollection } from "@daiso-tech/core";
1076
1467
  *
1077
- * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
1078
- * await collection.firstOr(-1);
1079
- * // 1
1468
+ * // Asume the inputed collection is empty.
1469
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
1470
+ * await collection
1471
+ * .append([1, 2, 3, 4])
1472
+ * .firstOr(-1);
1473
+ * // 1
1474
+ * }
1080
1475
  * ```
1081
1476
  * @example
1082
1477
  * ```ts
1083
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
1478
+ * import type { IAsyncCollection } from "@daiso-tech/core";
1084
1479
  *
1085
- * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
1086
- * await collection.firstOr(-1, item => item > 2);
1087
- * // 3
1480
+ * // Asume the inputed collection is empty.
1481
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
1482
+ * await collection
1483
+ * .append([1, 2, 3, 4])
1484
+ * .firstOr(-1, item => item > 2);
1485
+ * // 3
1486
+ * }
1088
1487
  * ```
1089
1488
  * @example
1090
1489
  * ```ts
1091
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
1490
+ * import type { IAsyncCollection } from "@daiso-tech/core";
1092
1491
  *
1093
- * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
1094
- * await collection.firstOr(-1, item => item > 10);
1095
- * // -1
1492
+ * // Asume the inputed collection is empty.
1493
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
1494
+ * await collection
1495
+ * .append([1, 2, 3, 4])
1496
+ * .firstOr(-1, item => item > 10);
1497
+ * // -1
1498
+ * }
1096
1499
  * ```
1097
1500
  * @example
1098
1501
  * ```ts
1099
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
1502
+ * import type { IAsyncCollection } from "@daiso-tech/core";
1100
1503
  *
1101
- * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
1102
- * await collection.firstOr(() => -1, item => item > 10);
1103
- * // -1
1504
+ * // Asume the inputed collection is empty.
1505
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
1506
+ * await collection
1507
+ * .append([1, 2, 3, 4])
1508
+ * .firstOr(() => -1, item => item > 10);
1509
+ * // -1
1510
+ * }
1104
1511
  * ```
1105
1512
  */
1106
1513
  firstOr<TOutput extends TInput, TExtended = TInput>(defaultValue: AsyncLazyable<TExtended>, predicateFn?: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>): LazyPromise<TOutput | TExtended>;
@@ -1110,27 +1517,39 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
1110
1517
  * @throws {ItemNotFoundCollectionError} {@link ItemNotFoundCollectionError}
1111
1518
  * @example
1112
1519
  * ```ts
1113
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
1520
+ * import type { IAsyncCollection } from "@daiso-tech/core";
1114
1521
  *
1115
- * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
1116
- * await collection.firstOrFail();
1117
- * // 1
1522
+ * // Asume the inputed collection is empty.
1523
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
1524
+ * await collection
1525
+ * .append([1, 2, 3, 4])
1526
+ * .firstOrFail();
1527
+ * // 1
1528
+ * }
1118
1529
  * ```
1119
1530
  * @example
1120
1531
  * ```ts
1121
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
1532
+ * import type { IAsyncCollection } from "@daiso-tech/core";
1122
1533
  *
1123
- * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
1124
- * await collection.firstOrFail(item => item > 2);
1125
- * // 3
1534
+ * // Asume the inputed collection is empty.
1535
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
1536
+ * await collection
1537
+ * .append([1, 2, 3, 4])
1538
+ * .firstOrFail(item => item > 2);
1539
+ * // 3
1540
+ * }
1126
1541
  * ```
1127
1542
  * @example
1128
1543
  * ```ts
1129
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
1544
+ * import type { IAsyncCollection } from "@daiso-tech/core";
1130
1545
  *
1131
- * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
1132
- * await collection.firstOrFail(item => item > 10);
1133
- * // throws an error
1546
+ * // Asume the inputed collection is empty.
1547
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
1548
+ * await collection
1549
+ * .append([1, 2, 3, 4])
1550
+ * .firstOrFail(item => item > 10);
1551
+ * // throws an error
1552
+ * }
1134
1553
  * ```
1135
1554
  */
1136
1555
  firstOrFail<TOutput extends TInput>(predicateFn?: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>): LazyPromise<TOutput>;
@@ -1139,29 +1558,40 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
1139
1558
  * By default it will get the last item. If the collection is empty or no items passes <i> predicateFn </i> than null i returned.
1140
1559
  * @example
1141
1560
  * ```ts
1142
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
1561
+ * import type { IAsyncCollection } from "@daiso-tech/core";
1143
1562
  *
1144
- * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
1145
- * await collection.last();
1146
- * // 4
1563
+ * // Asume the inputed collection is empty.
1564
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
1565
+ * await collection
1566
+ * .append([1, 2, 3, 4])
1567
+ * .last();
1568
+ * // 4
1569
+ * }
1147
1570
  * ```
1148
1571
  * @example
1149
1572
  * ```ts
1150
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
1573
+ * import type { IAsyncCollection } from "@daiso-tech/core";
1151
1574
  *
1152
- * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
1153
- * await collection.last(item => item < 4);
1154
- * // 3
1575
+ * // Asume the inputed collection is empty.
1576
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
1577
+ * await collection
1578
+ * .append([1, 2, 3, 4])
1579
+ * .last(item => item < 4);
1580
+ * // 3
1581
+ * }
1155
1582
  * ```
1156
1583
  * @example
1157
1584
  * ```ts
1158
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
1585
+ * import type { IAsyncCollection } from "@daiso-tech/core";
1159
1586
  *
1160
- * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
1161
- * await collection.last(item => item > 10);
1162
- * // null
1587
+ * // Asume the inputed collection is empty.
1588
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
1589
+ * await collection
1590
+ * .append([1, 2, 3, 4])
1591
+ * .last(item => item > 10);
1592
+ * // null
1593
+ * }
1163
1594
  * ```
1164
- * // 3
1165
1595
  */
1166
1596
  last<TOutput extends TInput>(predicateFn?: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>): LazyPromise<TOutput | null>;
1167
1597
  /**
@@ -1169,35 +1599,51 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
1169
1599
  * By default it will get the last item. If the collection is empty or no items passes <i> predicateFn </i> than <i> defaultValue </i>.
1170
1600
  * @example
1171
1601
  * ```ts
1172
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
1602
+ * import type { IAsyncCollection } from "@daiso-tech/core";
1173
1603
  *
1174
- * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
1175
- * await collection.lastOr(-1);
1176
- * // 4
1604
+ * // Asume the inputed collection is empty.
1605
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
1606
+ * await collection
1607
+ * .append([1, 2, 3, 4])
1608
+ * .lastOr(-1);
1609
+ * // 4
1610
+ * }
1177
1611
  * ```
1178
1612
  * @example
1179
1613
  * ```ts
1180
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
1614
+ * import type { IAsyncCollection } from "@daiso-tech/core";
1181
1615
  *
1182
- * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
1183
- * await collection.lastOr(-1, item => item < 4);
1184
- * // 3
1616
+ * // Asume the inputed collection is empty.
1617
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
1618
+ * await collection
1619
+ * .append([1, 2, 3, 4])
1620
+ * .lastOr(-1, item => item < 4);
1621
+ * // 3
1622
+ * }
1185
1623
  * ```
1186
1624
  * @example
1187
1625
  * ```ts
1188
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
1626
+ * import type { IAsyncCollection } from "@daiso-tech/core";
1189
1627
  *
1190
- * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
1191
- * await collection.lastOr(-1, item => item > 10);
1192
- * // -1
1628
+ * // Asume the inputed collection is empty.
1629
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
1630
+ * await collection
1631
+ * .append([1, 2, 3, 4])
1632
+ * .lastOr(-1, item => item > 10);
1633
+ * // -1
1634
+ * }
1193
1635
  * ```
1194
1636
  * @example
1195
1637
  * ```ts
1196
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
1638
+ * import type { IAsyncCollection } from "@daiso-tech/core";
1197
1639
  *
1198
- * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
1199
- * await collection.lastOr(() => -1, item => item > 10);
1200
- * // -1
1640
+ * // Asume the inputed collection is empty.
1641
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
1642
+ * await collection
1643
+ * .append([1, 2, 3, 4])
1644
+ * .lastOr(() => -1, item => item > 10);
1645
+ * // -1
1646
+ * }
1201
1647
  * ```
1202
1648
  */
1203
1649
  lastOr<TOutput extends TInput, TExtended = TInput>(defaultValue: AsyncLazyable<TExtended>, predicateFn?: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>): LazyPromise<TOutput | TExtended>;
@@ -1207,27 +1653,39 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
1207
1653
  * @throws {ItemNotFoundCollectionError} {@link ItemNotFoundCollectionError}
1208
1654
  * @example
1209
1655
  * ```ts
1210
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
1656
+ * import type { IAsyncCollection } from "@daiso-tech/core";
1211
1657
  *
1212
- * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
1213
- * await collection.lastOrFail();
1214
- * // 4
1658
+ * // Asume the inputed collection is empty.
1659
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
1660
+ * await collection
1661
+ * .append([1, 2, 3, 4])
1662
+ * .lastOrFail();
1663
+ * // 4
1664
+ * }
1215
1665
  * ```
1216
1666
  * @example
1217
1667
  * ```ts
1218
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
1668
+ * import type { IAsyncCollection } from "@daiso-tech/core";
1219
1669
  *
1220
- * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
1221
- * await collection.lastOrFail(item => item < 4);
1222
- * // 3
1670
+ * // Asume the inputed collection is empty.
1671
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
1672
+ * await collection
1673
+ * .append([1, 2, 3, 4])
1674
+ * .lastOrFail(item => item < 4);
1675
+ * // 3
1676
+ * }
1223
1677
  * ```
1224
1678
  * @example
1225
1679
  * ```ts
1226
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
1680
+ * import type { IAsyncCollection } from "@daiso-tech/core";
1227
1681
  *
1228
- * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
1229
- * await collection.lastOrFail(item => item > 10);
1230
- * // throws an error
1682
+ * // Asume the inputed collection is empty.
1683
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
1684
+ * await collection
1685
+ * .append([1, 2, 3, 4])
1686
+ * .lastOrFail(item => item > 10);
1687
+ * // throws an error
1688
+ * }
1231
1689
  * ```
1232
1690
  */
1233
1691
  lastOrFail<TOutput extends TInput>(predicateFn?: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>): LazyPromise<TOutput>;
@@ -1236,19 +1694,27 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
1236
1694
  * If the <i>predicateFn</i> does not match or matches the first item then null is returned.
1237
1695
  * @example
1238
1696
  * ```ts
1239
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
1697
+ * import type { IAsyncCollection } from "@daiso-tech/core";
1240
1698
  *
1241
- * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
1242
- * await collection.before(item => item === 2);
1243
- * // 1
1699
+ * // Asume the inputed collection is empty.
1700
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
1701
+ * await collection
1702
+ * .append([1, 2, 3, 4])
1703
+ * .before(item => item === 2);
1704
+ * // 1
1705
+ * }
1244
1706
  * ```
1245
1707
  * @example
1246
1708
  * ```ts
1247
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
1709
+ * import type { IAsyncCollection } from "@daiso-tech/core";
1248
1710
  *
1249
- * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
1250
- * await collection.before(item => item === 1);
1251
- * // null
1711
+ * // Asume the inputed collection is empty.
1712
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
1713
+ * await collection
1714
+ * .append([1, 2, 3, 4])
1715
+ * .before(item => item === 1);
1716
+ * // null
1717
+ * }
1252
1718
  * ```
1253
1719
  */
1254
1720
  before(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): LazyPromise<TInput | null>;
@@ -1257,27 +1723,39 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
1257
1723
  * If the collection is empty or the <i>predicateFn</i> does not match or matches the first item then <i>defaultValue</i> is returned.
1258
1724
  * @example
1259
1725
  * ```ts
1260
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
1726
+ * import type { IAsyncCollection } from "@daiso-tech/core";
1261
1727
  *
1262
- * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
1263
- * await collection.beforeOr(-1, item => item === 2);
1264
- * // 1
1728
+ * // Asume the inputed collection is empty.
1729
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
1730
+ * await collection
1731
+ * .append([1, 2, 3, 4])
1732
+ * .beforeOr(-1, item => item === 2);
1733
+ * // 1
1734
+ * }
1265
1735
  * ```
1266
1736
  * @example
1267
1737
  * ```ts
1268
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
1738
+ * import type { IAsyncCollection } from "@daiso-tech/core";
1269
1739
  *
1270
- * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
1271
- * await collection.beforeOr(-1, item => item === 1);
1272
- * // -1
1740
+ * // Asume the inputed collection is empty.
1741
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
1742
+ * await collection
1743
+ * .append([1, 2, 3, 4])
1744
+ * .beforeOr(-1, item => item === 1);
1745
+ * // -1
1746
+ * }
1273
1747
  * ```
1274
1748
  * @example
1275
1749
  * ```ts
1276
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
1750
+ * import type { IAsyncCollection } from "@daiso-tech/core";
1277
1751
  *
1278
- * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
1279
- * await collection.beforeOr(() => -1, item => item === 1);
1280
- * // -1
1752
+ * // Asume the inputed collection is empty.
1753
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
1754
+ * await collection
1755
+ * .append([1, 2, 3, 4])
1756
+ * .beforeOr(() => -1, item => item === 1);
1757
+ * // -1
1758
+ * }
1281
1759
  * ```
1282
1760
  */
1283
1761
  beforeOr<TExtended = TInput>(defaultValue: AsyncLazyable<TExtended>, predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): LazyPromise<TInput | TExtended>;
@@ -1287,19 +1765,27 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
1287
1765
  * @throws {ItemNotFoundCollectionError} {@link ItemNotFoundCollectionError}
1288
1766
  * @example
1289
1767
  * ```ts
1290
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
1768
+ * import type { IAsyncCollection } from "@daiso-tech/core";
1291
1769
  *
1292
- * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
1293
- * await collection.beforeOrFail(item => item === 2);
1294
- * // 1
1770
+ * // Asume the inputed collection is empty.
1771
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
1772
+ * await collection
1773
+ * .append([1, 2, 3, 4])
1774
+ * .beforeOrFail(item => item === 2);
1775
+ * // 1
1776
+ * }
1295
1777
  * ```
1296
1778
  * @example
1297
1779
  * ```ts
1298
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
1780
+ * import type { IAsyncCollection } from "@daiso-tech/core";
1299
1781
  *
1300
- * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
1301
- * await collection.beforeOrFail(item => item === 1);
1302
- * // error is thrown
1782
+ * // Asume the inputed collection is empty.
1783
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
1784
+ * await collection
1785
+ * .append([1, 2, 3, 4])
1786
+ * .beforeOrFail(item => item === 1);
1787
+ * // error is thrown
1788
+ * }
1303
1789
  * ```
1304
1790
  */
1305
1791
  beforeOrFail(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): LazyPromise<TInput>;
@@ -1308,19 +1794,27 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
1308
1794
  * If the collection is empty or the <i>predicateFn</i> does not match or matches the last item then null is returned.
1309
1795
  * @example
1310
1796
  * ```ts
1311
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
1797
+ * import type { IAsyncCollection } from "@daiso-tech/core";
1312
1798
  *
1313
- * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
1314
- * await collection.after(item => item === 2);
1315
- * // 3
1799
+ * // Asume the inputed collection is empty.
1800
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
1801
+ * await collection
1802
+ * .append([1, 2, 3, 4])
1803
+ * .after(item => item === 2);
1804
+ * // 3
1805
+ * }
1316
1806
  * ```
1317
1807
  * @example
1318
1808
  * ```ts
1319
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
1809
+ * import type { IAsyncCollection } from "@daiso-tech/core";
1320
1810
  *
1321
- * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
1322
- * await collection.after(item => item === 4);
1323
- * // null
1811
+ * // Asume the inputed collection is empty.
1812
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
1813
+ * await collection
1814
+ * .append([1, 2, 3, 4])
1815
+ * .after(item => item === 4);
1816
+ * // null
1817
+ * }
1324
1818
  * ```
1325
1819
  */
1326
1820
  after(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): LazyPromise<TInput | null>;
@@ -1329,27 +1823,39 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
1329
1823
  * If the collection is empty or the <i>predicateFn</i> does not match or matches the last item then <i>defaultValue</i> is returned.
1330
1824
  * @example
1331
1825
  * ```ts
1332
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
1826
+ * import type { IAsyncCollection } from "@daiso-tech/core";
1333
1827
  *
1334
- * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
1335
- * await collection.afterOr(-1, item => item === 2);
1336
- * // 3
1828
+ * // Asume the inputed collection is empty.
1829
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
1830
+ * await collection
1831
+ * .append([1, 2, 3, 4])
1832
+ * .afterOr(-1, item => item === 2);
1833
+ * // 3
1834
+ * }
1337
1835
  * ```
1338
1836
  * @example
1339
1837
  * ```ts
1340
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
1838
+ * import type { IAsyncCollection } from "@daiso-tech/core";
1341
1839
  *
1342
- * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
1343
- * await collection.afterOr(-1, item => item === 4);
1344
- * // -1
1840
+ * // Asume the inputed collection is empty.
1841
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
1842
+ * await collection
1843
+ * .append([1, 2, 3, 4])
1844
+ * .afterOr(-1, item => item === 4);
1845
+ * // -1
1846
+ * }
1345
1847
  * ```
1346
1848
  * @example
1347
1849
  * ```ts
1348
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
1850
+ * import type { IAsyncCollection } from "@daiso-tech/core";
1349
1851
  *
1350
- * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
1351
- * await collection.afterOr(() => -1, item => item === 4);
1352
- * // -1
1852
+ * // Asume the inputed collection is empty.
1853
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
1854
+ * await collection
1855
+ * .append([1, 2, 3, 4])
1856
+ * .afterOr(() => -1, item => item === 4);
1857
+ * // -1
1858
+ * }
1353
1859
  * ```
1354
1860
  */
1355
1861
  afterOr<TExtended = TInput>(defaultValue: AsyncLazyable<TExtended>, predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): LazyPromise<TInput | TExtended>;
@@ -1359,19 +1865,27 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
1359
1865
  * @throws {ItemNotFoundCollectionError} {@link ItemNotFoundCollectionError}
1360
1866
  * @example
1361
1867
  * ```ts
1362
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
1868
+ * import type { IAsyncCollection } from "@daiso-tech/core";
1363
1869
  *
1364
- * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
1365
- * await collection.afterOrFail(item => item === 2);
1366
- * // 3
1870
+ * // Asume the inputed collection is empty.
1871
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
1872
+ * await collection
1873
+ * .append([1, 2, 3, 4])
1874
+ * .afterOrFail(item => item === 2);
1875
+ * // 3
1876
+ * }
1367
1877
  * ```
1368
1878
  * @example
1369
1879
  * ```ts
1370
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
1880
+ * import type { IAsyncCollection } from "@daiso-tech/core";
1371
1881
  *
1372
- * const collection = new AsyncIterableCollection([1, 2, 3, 4]);
1373
- * await collection.afterOrFail(item => item === 4);
1374
- * // error is thrown
1882
+ * // Asume the inputed collection is empty.
1883
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
1884
+ * await collection
1885
+ * .append([1, 2, 3, 4])
1886
+ * .afterOrFail(item => item === 4);
1887
+ * // error is thrown
1888
+ * }
1375
1889
  * ```
1376
1890
  */
1377
1891
  afterOrFail(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): LazyPromise<TInput>;
@@ -1382,27 +1896,39 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
1382
1896
  * @throws {MultipleItemsFoundCollectionError} {@link MultipleItemsFoundCollectionError}
1383
1897
  * @example
1384
1898
  * ```ts
1385
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
1899
+ * import type { IAsyncCollection } from "@daiso-tech/core";
1386
1900
  *
1387
- * const collection = new AsyncIterableCollection([1, 2, 3, 4, 5]);
1388
- * await collection.sole(item => item === 4);
1389
- * // 4
1901
+ * // Asume the inputed collection is empty.
1902
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
1903
+ * await collection
1904
+ * .append([1, 2, 3, 4, 5])
1905
+ * .sole(item => item === 4);
1906
+ * // 4
1907
+ * }
1390
1908
  * ```
1391
1909
  * @example
1392
1910
  * ```ts
1393
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
1911
+ * import type { IAsyncCollection } from "@daiso-tech/core";
1394
1912
  *
1395
- * const collection = new AsyncIterableCollection([1, 2, 3, 4, 4, 5]);
1396
- * await collection.sole(item => item === 4);
1397
- * // error is thrown
1913
+ * // Asume the inputed collection is empty.
1914
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
1915
+ * await collection
1916
+ * .append([1, 2, 3, 4, 4, 5])
1917
+ * .sole(item => item === 4);
1918
+ * // error is thrown
1919
+ * }
1398
1920
  * ```
1399
1921
  * @example
1400
1922
  * ```ts
1401
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
1923
+ * import type { IAsyncCollection } from "@daiso-tech/core";
1402
1924
  *
1403
- * const collection = new AsyncIterableCollection([1, 2, 3, 5]);
1404
- * await collection.sole(item => item === 4);
1405
- * // error is thrown
1925
+ * // Asume the inputed collection is empty.
1926
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
1927
+ * await collection
1928
+ * .append([1, 2, 3, 5])
1929
+ * .sole(item => item === 4);
1930
+ * // error is thrown
1931
+ * }
1406
1932
  * ```
1407
1933
  */
1408
1934
  sole<TOutput extends TInput>(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>): LazyPromise<TOutput>;
@@ -1410,11 +1936,15 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
1410
1936
  * The <i>nth</i> method creates a new collection consisting of every n-th item.
1411
1937
  * @example
1412
1938
  * ```ts
1413
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
1939
+ * import type { IAsyncCollection } from "@daiso-tech/core";
1414
1940
  *
1415
- * const collection = new AsyncIterableCollection(["a", "b", "c", "d", "e", "f"]).nth(4);
1416
- * await collection.toArray();
1417
- * // ["a", "e"]
1941
+ * // Asume the inputed collection is empty.
1942
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
1943
+ * await collection.append(["a", "b", "c", "d", "e", "f"])
1944
+ * .nth(4)
1945
+ * .toArray();
1946
+ * // ["a", "e"]
1947
+ * }
1418
1948
  * ```
1419
1949
  */
1420
1950
  nth(step: number): IAsyncCollection<TInput>;
@@ -1422,11 +1952,15 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
1422
1952
  * The <i>count</i> method returns the total number of items in the collection that passes <i>predicateFn</i>.
1423
1953
  * @example
1424
1954
  * ```ts
1425
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
1955
+ * import type { IAsyncCollection } from "@daiso-tech/core";
1426
1956
  *
1427
- * const collection = new AsyncIterableCollection([1, 2, 3, 4, 5, 6]);
1428
- * await collection.count(value => value % 2 === 0);
1429
- * // 3
1957
+ * // Asume the inputed collection is empty.
1958
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
1959
+ * await collection
1960
+ * .append([1, 2, 3, 4, 5, 6])
1961
+ * .count(value => value % 2 === 0);
1962
+ * // 3
1963
+ * }
1430
1964
  * ```
1431
1965
  */
1432
1966
  count(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): LazyPromise<number>;
@@ -1446,11 +1980,15 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
1446
1980
  * The <i>searchFirst</i> return the index of the first item that matches <i>predicateFn</i>.
1447
1981
  * @example
1448
1982
  * ```ts
1449
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
1983
+ * import type { IAsyncCollection } from "@daiso-tech/core";
1450
1984
  *
1451
- * const collection = new AsyncIterableCollection(["a", "b", "b", "c"]);
1452
- * await collection.searchFirst(item => item === "b");
1453
- * // 1
1985
+ * // Asume the inputed collection is empty.
1986
+ * async function main(collection: IAsyncCollection<string>): Promise<void> {
1987
+ * await collection
1988
+ * .append(["a", "b", "b", "c"])
1989
+ * .searchFirst(item => item === "b");
1990
+ * // 1
1991
+ * }
1454
1992
  * ```
1455
1993
  */
1456
1994
  searchFirst(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): LazyPromise<number>;
@@ -1458,11 +1996,15 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
1458
1996
  * The <i>searchLast</i> return the index of the last item that matches <i>predicateFn</i>.
1459
1997
  * @example
1460
1998
  * ```ts
1461
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
1999
+ * import type { IAsyncCollection } from "@daiso-tech/core";
1462
2000
  *
1463
- * const collection = new AsyncIterableCollection(["a", "b", "b", "c"]);
1464
- * await collection.searchLast(item => item === "b");
1465
- * // 2
2001
+ * // Asume the inputed collection is empty.
2002
+ * async function main(collection: IAsyncCollection<string>): Promise<void> {
2003
+ * await collection
2004
+ * .append(["a", "b", "b", "c"])
2005
+ * .searchLast(item => item === "b");
2006
+ * // 2
2007
+ * }
1466
2008
  * ```
1467
2009
  */
1468
2010
  searchLast(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): LazyPromise<number>;
@@ -1475,13 +2017,25 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
1475
2017
  * This method is especially useful for situations where you may be interacting with external APIs that rate limit incoming requests:
1476
2018
  * @example
1477
2019
  * ```ts
1478
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
2020
+ * import type { IAsyncCollection } from "@daiso-tech/core";
1479
2021
  *
1480
- * // An iterator that will fetch all users from a specific api
1481
- * class ApiIterator implements AsyncIterable<IUser> { ... }
1482
- * const apiIterator = new ApiIterator();
1483
- * const collection = new AsyncIterableCollection(apiIterator);
1484
- * await collection.delay(1000).forEach(user => console.log(user))
2022
+ * // Asume the inputed collection is empty.
2023
+ * class MyIterable implements Iterable<number> {
2024
+ * async *[Symbol.asyncIterator]() {
2025
+ * for (let i = 0; i < 10; i++) {
2026
+ * yield i;
2027
+ * }
2028
+ * }
2029
+ * }
2030
+ *
2031
+ * // Asume the inputed collection is empty.
2032
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
2033
+ * const myIterable = new MyIterable();
2034
+ * await collection
2035
+ * .append(myIterable)
2036
+ * .delay(1000)
2037
+ * .forEach(user => console.log(user))
2038
+ * }
1485
2039
  * ```
1486
2040
  */
1487
2041
  delay(time: TimeSpan): IAsyncCollection<TInput>;
@@ -1491,13 +2045,30 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
1491
2045
  * After when aborted, the collection will stop iterating:
1492
2046
  * @example
1493
2047
  * ```ts
1494
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
2048
+ * import type { IAsyncCollection } from "@daiso-tech/core";
2049
+ *
2050
+ * class InfiniteIterable implements Iterable<number> {
2051
+ * async *[Symbol.asyncIterator]() {
2052
+ * let index = 0;
2053
+ * while(true) {
2054
+ * index++;
2055
+ * yield index;
2056
+ * }
2057
+ * }
2058
+ * }
1495
2059
  *
1496
- * // An iterator that will fetch all users from a specific api
1497
- * class ApiIterator implements AsyncIterable<IUser> { ... }
1498
- * const apiIterator = new ApiIterator();
1499
- * const collection = new AsyncIterableCollection(apiIterator);
1500
- * await collection.delay(1000).forEach(user => console.log(user))
2060
+ * // Asume the inputed collection is empty.
2061
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
2062
+ * const abortController = new AbortController();
2063
+ * setTimeout(() => {
2064
+ * abortController.abort("My abort error");
2065
+ * }, 1000)
2066
+ * const infiniteIterable = new InfiniteIterable();
2067
+ * await collection
2068
+ * .append(infiniteIterable);
2069
+ * .takeUntilAbort(abortController)
2070
+ * .forEach(nbr => console.log(nbr))
2071
+ * }
1501
2072
  * ```
1502
2073
  */
1503
2074
  takeUntilAbort(abortSignal: AbortSignal, shouldThrow?: boolean): IAsyncCollection<TInput>;
@@ -1507,20 +2078,26 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
1507
2078
  * After that time, the collection will stop iterating:
1508
2079
  * @example
1509
2080
  * ```ts
1510
- * import { AsyncIterableCollection } from "@daiso-tech/core";;
2081
+ * import type { IAsyncCollection } from "@daiso-tech/core";
2082
+ *
2083
+ * class InfiniteIterable implements AsyncIterable<number> {
2084
+ * async *[Symbol.asyncIterator]() {
2085
+ * let index = 0;
2086
+ * while(true) {
2087
+ * index++;
2088
+ * yield index;
2089
+ * }
2090
+ * }
2091
+ * }
1511
2092
  *
1512
- * class AsyncInfiniteIterable implements AsyncIterable<number> {
1513
- * async *[Symbol.asyncIterator]() {
1514
- * while(true) {
1515
- * yield 1;
1516
- * }
1517
- * }
2093
+ * // Asume the inputed collection is empty.
2094
+ * async function main(collection: IAsyncCollection<number>): Promise<void> {
2095
+ * const infiniteIterable = new InfiniteIterable();
2096
+ * await collection
2097
+ * .append(infiniteIterable)
2098
+ * .takeUntilTimeout(1000)
2099
+ * .forEach(nbr => console.log(nbr))
1518
2100
  * }
1519
- * const asyncInfiniteIterable = new AsyncInfiniteIterable();
1520
- * const collection = new AsyncIterableCollection(asyncInfiniteIterable);
1521
- * await collection
1522
- * .timeout(1000)
1523
- * .forEach(nbr => console.log(nbr))
1524
2101
  * ```
1525
2102
  */
1526
2103
  takeUntilTimeout(time: TimeSpan, shouldThrow?: boolean): IAsyncCollection<TInput>;
@@ -1530,10 +2107,14 @@ export type IAsyncCollection<TInput> = AsyncIterable<TInput> & {
1530
2107
  toArray(): LazyPromise<TInput[]>;
1531
2108
  /**
1532
2109
  * The <i>toRecord</i> method converts the collection to a new <i>{@link Record}</i>.
2110
+ * An error will be thrown if item is not a tuple of size 2 where the first element is a string or a number.
2111
+ * @throws {TypeCollectionError} {@link TypeCollectionError}
1533
2112
  */
1534
2113
  toRecord(): LazyPromise<EnsureRecord<TInput>>;
1535
2114
  /**
1536
2115
  * The <i>toMap</i> method converts the collection to a new <i>{@link Map}</i>.
2116
+ * An error will be thrown if item is not a tuple of size 2.
2117
+ * @throws {TypeCollectionError} {@link TypeCollectionError}
1537
2118
  */
1538
2119
  toMap(): LazyPromise<EnsureMap<TInput>>;
1539
2120
  };