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