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