@daiso-tech/core 0.33.0 → 0.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +66 -45
- package/dist/async/_module-exports.d.ts +1 -1
- package/dist/async/_module-exports.js +1 -1
- package/dist/async/_module-exports.js.map +1 -1
- package/dist/async/async.errors.d.ts +27 -19
- package/dist/async/async.errors.js +33 -20
- package/dist/async/async.errors.js.map +1 -1
- package/dist/async/backof-policies/_shared.d.ts +6 -2
- package/dist/async/backof-policies/_shared.js +1 -0
- package/dist/async/backof-policies/_shared.js.map +1 -1
- package/dist/async/backof-policies/constant-backoff-policy/constant-backoff-policy.d.ts +2 -2
- package/dist/async/backof-policies/constant-backoff-policy/constant-backoff-policy.js +1 -1
- package/dist/async/backof-policies/exponential-backoff-policy/exponential-backoff-policy.d.ts +2 -2
- package/dist/async/backof-policies/exponential-backoff-policy/exponential-backoff-policy.js +1 -1
- package/dist/async/backof-policies/linear-backoff-policy/linear-backoff-policy.d.ts +2 -2
- package/dist/async/backof-policies/linear-backoff-policy/linear-backoff-policy.js +1 -1
- package/dist/async/backof-policies/polynomial-backoff-policy/polynomial-backoff-policy.d.ts +2 -2
- package/dist/async/backof-policies/polynomial-backoff-policy/polynomial-backoff-policy.js +1 -1
- package/dist/async/middlewares/_module.d.ts +8 -0
- package/dist/async/middlewares/_module.js +9 -0
- package/dist/async/middlewares/_module.js.map +1 -0
- package/dist/async/middlewares/_shared.d.ts +10 -0
- package/dist/async/middlewares/_shared.js +5 -0
- package/dist/async/middlewares/_shared.js.map +1 -0
- package/dist/async/middlewares/bulkhead/_module.d.ts +1 -0
- package/dist/async/middlewares/bulkhead/_module.js +2 -0
- package/dist/async/middlewares/bulkhead/_module.js.map +1 -0
- package/dist/async/middlewares/bulkhead/bulkhead.middleware.d.ts +80 -0
- package/dist/async/middlewares/bulkhead/bulkhead.middleware.js +46 -0
- package/dist/async/middlewares/bulkhead/bulkhead.middleware.js.map +1 -0
- package/dist/async/middlewares/dynamic/_module.d.ts +1 -0
- package/dist/async/middlewares/dynamic/_module.js +2 -0
- package/dist/async/middlewares/dynamic/_module.js.map +1 -0
- package/dist/async/middlewares/dynamic/dynamic.middleware.d.ts +34 -0
- package/dist/async/middlewares/dynamic/dynamic.middleware.js +36 -0
- package/dist/async/middlewares/dynamic/dynamic.middleware.js.map +1 -0
- package/dist/async/middlewares/fallback/_module.d.ts +1 -0
- package/dist/async/middlewares/fallback/_module.js +2 -0
- package/dist/async/middlewares/fallback/_module.js.map +1 -0
- package/dist/async/middlewares/fallback/fallback.middleware.d.ts +78 -0
- package/dist/async/middlewares/fallback/fallback.middleware.js +52 -0
- package/dist/async/middlewares/fallback/fallback.middleware.js.map +1 -0
- package/dist/async/middlewares/hedging/_module.d.ts +2 -0
- package/dist/async/middlewares/hedging/_module.js +3 -0
- package/dist/async/middlewares/hedging/_module.js.map +1 -0
- package/dist/async/middlewares/hedging/_shared.d.ts +93 -0
- package/dist/async/middlewares/hedging/_shared.js +5 -0
- package/dist/async/middlewares/hedging/_shared.js.map +1 -0
- package/dist/async/middlewares/hedging/concurrent-hedging/_module.d.ts +1 -0
- package/dist/async/middlewares/hedging/concurrent-hedging/_module.js +2 -0
- package/dist/async/middlewares/hedging/concurrent-hedging/_module.js.map +1 -0
- package/dist/async/middlewares/hedging/concurrent-hedging/concurrent-hedging.middleware.d.ts +51 -0
- package/dist/async/middlewares/hedging/concurrent-hedging/concurrent-hedging.middleware.js +138 -0
- package/dist/async/middlewares/hedging/concurrent-hedging/concurrent-hedging.middleware.js.map +1 -0
- package/dist/async/middlewares/hedging/sequential-hedging/_module.d.ts +1 -0
- package/dist/async/middlewares/hedging/sequential-hedging/_module.js +2 -0
- package/dist/async/middlewares/hedging/sequential-hedging/_module.js.map +1 -0
- package/dist/async/middlewares/hedging/sequential-hedging/sequential-hedging.middleware.d.ts +51 -0
- package/dist/async/middlewares/hedging/sequential-hedging/sequential-hedging.middleware.js +104 -0
- package/dist/async/middlewares/hedging/sequential-hedging/sequential-hedging.middleware.js.map +1 -0
- package/dist/async/middlewares/observe/_module.d.ts +1 -0
- package/dist/async/middlewares/observe/_module.js +2 -0
- package/dist/async/middlewares/observe/_module.js.map +1 -0
- package/dist/async/middlewares/observe/observe.middleware.d.ts +130 -0
- package/dist/async/middlewares/observe/observe.middleware.js +80 -0
- package/dist/async/middlewares/observe/observe.middleware.js.map +1 -0
- package/dist/async/middlewares/retry/_module.d.ts +1 -0
- package/dist/async/middlewares/retry/_module.js +2 -0
- package/dist/async/middlewares/retry/_module.js.map +1 -0
- package/dist/async/middlewares/retry/retry.middleware.d.ts +117 -0
- package/dist/async/middlewares/retry/retry.middleware.js +82 -0
- package/dist/async/middlewares/retry/retry.middleware.js.map +1 -0
- package/dist/async/middlewares/timeout/_module.d.ts +1 -0
- package/dist/async/middlewares/timeout/_module.js +2 -0
- package/dist/async/middlewares/timeout/_module.js.map +1 -0
- package/dist/async/middlewares/timeout/timeout.middleware.d.ts +83 -0
- package/dist/async/middlewares/timeout/timeout.middleware.js +60 -0
- package/dist/async/middlewares/timeout/timeout.middleware.js.map +1 -0
- package/dist/async/utilities/_module.d.ts +3 -4
- package/dist/async/utilities/_module.js +3 -4
- package/dist/async/utilities/_module.js.map +1 -1
- package/dist/async/utilities/abort-and-fail/_module.d.ts +1 -0
- package/dist/async/utilities/abort-and-fail/_module.js +2 -0
- package/dist/async/utilities/abort-and-fail/_module.js.map +1 -0
- package/dist/async/utilities/abort-and-fail/abort-and-fail.d.ts +7 -0
- package/dist/async/utilities/{abort → abort-and-fail}/abort-and-fail.js +6 -6
- package/dist/async/utilities/abort-and-fail/abort-and-fail.js.map +1 -0
- package/dist/async/utilities/lazy-promise/lazy-promise.d.ts +37 -194
- package/dist/async/utilities/lazy-promise/lazy-promise.js +62 -359
- package/dist/async/utilities/lazy-promise/lazy-promise.js.map +1 -1
- package/dist/async/utilities/promise-queue/_module.d.ts +1 -0
- package/dist/async/utilities/promise-queue/_module.js +2 -0
- package/dist/async/utilities/promise-queue/_module.js.map +1 -0
- package/dist/async/utilities/promise-queue/promise-queue.d.ts +32 -0
- package/dist/async/utilities/promise-queue/promise-queue.js +107 -0
- package/dist/async/utilities/promise-queue/promise-queue.js.map +1 -0
- package/dist/async/utilities/timeout-and-fail/_module.d.ts +1 -0
- package/dist/async/utilities/timeout-and-fail/_module.js +2 -0
- package/dist/async/utilities/timeout-and-fail/_module.js.map +1 -0
- package/dist/async/utilities/timeout-and-fail/timeout-and-fail.d.ts +7 -0
- package/dist/async/utilities/timeout-and-fail/timeout-and-fail.js +19 -0
- package/dist/async/utilities/timeout-and-fail/timeout-and-fail.js.map +1 -0
- package/dist/cache/contracts/cache-adapter.contract.d.ts +14 -14
- package/dist/cache/contracts/cache-factory.contract.d.ts +3 -3
- package/dist/cache/contracts/cache.contract.d.ts +73 -73
- package/dist/cache/contracts/cache.errors.d.ts +7 -7
- package/dist/cache/contracts/cache.errors.js +7 -7
- package/dist/cache/contracts/cache.events.d.ts +54 -58
- package/dist/cache/contracts/cache.events.js +6 -104
- package/dist/cache/contracts/cache.events.js.map +1 -1
- package/dist/cache/contracts/database-cache-adapter.contract.d.ts +16 -16
- package/dist/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter.d.ts +3 -3
- package/dist/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter.js +2 -2
- package/dist/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter.d.ts +3 -9
- package/dist/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter.js +3 -9
- package/dist/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter.js.map +1 -1
- package/dist/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter.d.ts +4 -4
- package/dist/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter.js +3 -3
- package/dist/cache/implementations/adapters/no-op-cache-adapter/no-op-cache-adapter.d.ts +2 -2
- package/dist/cache/implementations/adapters/no-op-cache-adapter/no-op-cache-adapter.js +2 -2
- package/dist/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.d.ts +3 -3
- package/dist/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.js +2 -2
- package/dist/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.d.ts +3 -3
- package/dist/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.js +2 -2
- package/dist/cache/implementations/derivables/cache/cache.d.ts +26 -27
- package/dist/cache/implementations/derivables/cache/cache.js +102 -91
- package/dist/cache/implementations/derivables/cache/cache.js.map +1 -1
- package/dist/cache/implementations/derivables/cache-factory/cache-factory.d.ts +5 -4
- package/dist/cache/implementations/derivables/cache-factory/cache-factory.js +2 -1
- package/dist/cache/implementations/derivables/cache-factory/cache-factory.js.map +1 -1
- package/dist/cache/implementations/test-utilities/cache-adapter.test-suite.d.ts +3 -3
- package/dist/cache/implementations/test-utilities/cache-adapter.test-suite.js +2 -2
- package/dist/cache/implementations/test-utilities/cache.test-suite.d.ts +3 -3
- package/dist/cache/implementations/test-utilities/cache.test-suite.js +140 -149
- package/dist/cache/implementations/test-utilities/cache.test-suite.js.map +1 -1
- package/dist/cache/implementations/test-utilities/database-cache-dapter.test-suite.d.ts +3 -3
- package/dist/cache/implementations/test-utilities/database-cache-dapter.test-suite.js +2 -2
- package/dist/collection/contracts/_shared/compartor.type.d.ts +1 -1
- package/dist/collection/contracts/_shared/cross-join-result.type.d.ts +1 -1
- package/dist/collection/contracts/_shared/ensure-map.type.d.ts +1 -1
- package/dist/collection/contracts/_shared/ensure-record.type.d.ts +1 -1
- package/dist/collection/contracts/_shared/foreach.type.d.ts +2 -2
- package/dist/collection/contracts/_shared/map.type.d.ts +2 -2
- package/dist/collection/contracts/_shared/modifier.type.d.ts +2 -2
- package/dist/collection/contracts/_shared/predicate.type.d.ts +7 -7
- package/dist/collection/contracts/_shared/reduce.type.d.ts +2 -2
- package/dist/collection/contracts/_shared/tap.type.d.ts +2 -2
- package/dist/collection/contracts/_shared/transform.type.d.ts +2 -2
- package/dist/collection/contracts/async-collection.contract.d.ts +109 -198
- package/dist/collection/contracts/collection.contract.d.ts +103 -103
- package/dist/collection/contracts/collection.errors.d.ts +11 -11
- package/dist/collection/contracts/collection.errors.js +11 -11
- package/dist/collection/implementations/_shared.d.ts +8 -8
- package/dist/collection/implementations/_shared.js +8 -8
- package/dist/collection/implementations/async-iterable-collection/_shared/_module.d.ts +0 -4
- package/dist/collection/implementations/async-iterable-collection/_shared/_module.js +0 -4
- package/dist/collection/implementations/async-iterable-collection/_shared/_module.js.map +1 -1
- package/dist/collection/implementations/async-iterable-collection/_shared/async-cross-join-iterable.js +21 -19
- package/dist/collection/implementations/async-iterable-collection/_shared/async-cross-join-iterable.js.map +1 -1
- package/dist/collection/implementations/async-iterable-collection/async-iterable-collection.d.ts +15 -19
- package/dist/collection/implementations/async-iterable-collection/async-iterable-collection.js +15 -30
- package/dist/collection/implementations/async-iterable-collection/async-iterable-collection.js.map +1 -1
- package/dist/collection/implementations/iterable-collection/_shared/cross-join-iterable.d.ts +3 -3
- package/dist/collection/implementations/iterable-collection/_shared/cross-join-iterable.js +18 -20
- package/dist/collection/implementations/iterable-collection/_shared/cross-join-iterable.js.map +1 -1
- package/dist/collection/implementations/iterable-collection/iterable-collection.d.ts +11 -12
- package/dist/collection/implementations/iterable-collection/iterable-collection.js +11 -12
- package/dist/collection/implementations/iterable-collection/iterable-collection.js.map +1 -1
- package/dist/collection/implementations/list-collection/list-collection.d.ts +11 -11
- package/dist/collection/implementations/list-collection/list-collection.js +24 -30
- package/dist/collection/implementations/list-collection/list-collection.js.map +1 -1
- package/dist/event-bus/contracts/_module-exports.d.ts +0 -1
- package/dist/event-bus/contracts/_module-exports.js +0 -1
- package/dist/event-bus/contracts/_module-exports.js.map +1 -1
- package/dist/event-bus/contracts/event-bus-adapter.contract.d.ts +13 -8
- package/dist/event-bus/contracts/event-bus-factory.contract.d.ts +6 -7
- package/dist/event-bus/contracts/event-bus-factory.contract.js.map +1 -1
- package/dist/event-bus/contracts/event-bus.contract.d.ts +30 -41
- package/dist/event-bus/contracts/event-bus.errors.d.ts +8 -8
- package/dist/event-bus/contracts/event-bus.errors.js +8 -8
- package/dist/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter.d.ts +3 -3
- package/dist/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter.js +3 -3
- package/dist/event-bus/implementations/adapters/no-op-event-bus-adapter/no-op-event-bus-adapter.d.ts +2 -2
- package/dist/event-bus/implementations/adapters/no-op-event-bus-adapter/no-op-event-bus-adapter.js +2 -2
- package/dist/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter.d.ts +3 -3
- package/dist/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter.js +2 -2
- package/dist/event-bus/implementations/derivables/event-bus/event-bus.d.ts +15 -15
- package/dist/event-bus/implementations/derivables/event-bus/event-bus.js +32 -32
- package/dist/event-bus/implementations/derivables/event-bus/event-bus.js.map +1 -1
- package/dist/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.d.ts +17 -10
- package/dist/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.js +13 -6
- package/dist/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.js.map +1 -1
- package/dist/event-bus/implementations/test-utilities/event-bus-adapter.test-suite.d.ts +3 -5
- package/dist/event-bus/implementations/test-utilities/event-bus-adapter.test-suite.js +15 -22
- package/dist/event-bus/implementations/test-utilities/event-bus-adapter.test-suite.js.map +1 -1
- package/dist/event-bus/implementations/test-utilities/event-bus.test-suite.d.ts +3 -5
- package/dist/event-bus/implementations/test-utilities/event-bus.test-suite.js +189 -209
- package/dist/event-bus/implementations/test-utilities/event-bus.test-suite.js.map +1 -1
- package/dist/lock/contracts/database-lock-adapter.contract.d.ts +9 -9
- package/dist/lock/contracts/lock-adapter.contract.d.ts +7 -7
- package/dist/lock/contracts/lock-provider-factory.contract.d.ts +4 -4
- package/dist/lock/contracts/lock-provider.contract.d.ts +14 -14
- package/dist/lock/contracts/lock.contract.d.ts +22 -22
- package/dist/lock/contracts/lock.errors.d.ts +10 -10
- package/dist/lock/contracts/lock.errors.js +10 -10
- package/dist/lock/contracts/lock.events.d.ts +45 -54
- package/dist/lock/contracts/lock.events.js +9 -91
- package/dist/lock/contracts/lock.events.js.map +1 -1
- package/dist/lock/implementations/adapters/libsql-lock-adapter/libsql-lock-adapter.d.ts +5 -5
- package/dist/lock/implementations/adapters/libsql-lock-adapter/libsql-lock-adapter.js +4 -4
- package/dist/lock/implementations/adapters/memory-lock-adapter/memory-lock-adapter.d.ts +3 -3
- package/dist/lock/implementations/adapters/memory-lock-adapter/memory-lock-adapter.js +3 -3
- package/dist/lock/implementations/adapters/mongodb-lock-adapter/mongodb-lock-adapter.d.ts +5 -5
- package/dist/lock/implementations/adapters/mongodb-lock-adapter/mongodb-lock-adapter.js +4 -4
- package/dist/lock/implementations/adapters/no-op-lock-adapter/no-op-lock-adapter.d.ts +2 -2
- package/dist/lock/implementations/adapters/no-op-lock-adapter/no-op-lock-adapter.js +2 -2
- package/dist/lock/implementations/adapters/redis-lock-adapter/redis-lock-adapter.d.ts +3 -3
- package/dist/lock/implementations/adapters/redis-lock-adapter/redis-lock-adapter.js +3 -3
- package/dist/lock/implementations/adapters/sqlite-lock-adapter/sqlite-lock-adapter.d.ts +5 -5
- package/dist/lock/implementations/adapters/sqlite-lock-adapter/sqlite-lock-adapter.js +4 -4
- package/dist/lock/implementations/derivables/lock-provider/lock-provider.d.ts +33 -33
- package/dist/lock/implementations/derivables/lock-provider/lock-provider.js +30 -30
- package/dist/lock/implementations/derivables/lock-provider/lock-provider.js.map +1 -1
- package/dist/lock/implementations/derivables/lock-provider/lock-serde-transformer.d.ts +2 -2
- package/dist/lock/implementations/derivables/lock-provider/lock-serde-transformer.js.map +1 -1
- package/dist/lock/implementations/derivables/lock-provider/lock.d.ts +3 -3
- package/dist/lock/implementations/derivables/lock-provider/lock.js +77 -58
- package/dist/lock/implementations/derivables/lock-provider/lock.js.map +1 -1
- package/dist/lock/implementations/derivables/lock-provider-factory/lock-provider-factory.d.ts +5 -4
- package/dist/lock/implementations/derivables/lock-provider-factory/lock-provider-factory.js +2 -1
- package/dist/lock/implementations/derivables/lock-provider-factory/lock-provider-factory.js.map +1 -1
- package/dist/lock/implementations/test-utilities/database-lock-adapter.test-suite.d.ts +3 -3
- package/dist/lock/implementations/test-utilities/database-lock-adapter.test-suite.js +2 -2
- package/dist/lock/implementations/test-utilities/lock-adapter.test-suite.d.ts +3 -3
- package/dist/lock/implementations/test-utilities/lock-adapter.test-suite.js +2 -2
- package/dist/lock/implementations/test-utilities/lock-provider.test-suite.d.ts +3 -3
- package/dist/lock/implementations/test-utilities/lock-provider.test-suite.js +214 -214
- package/dist/lock/implementations/test-utilities/lock-provider.test-suite.js.map +1 -1
- package/dist/serde/contracts/deserializer.contract.d.ts +2 -2
- package/dist/serde/contracts/flexible-serde-adapter.contract.d.ts +4 -4
- package/dist/serde/contracts/flexible-serde.contract.d.ts +8 -19
- package/dist/serde/contracts/serde.contract.d.ts +2 -2
- package/dist/serde/contracts/serde.errors.d.ts +4 -4
- package/dist/serde/contracts/serde.errors.js +4 -4
- package/dist/serde/contracts/serializable.contract.d.ts +2 -2
- package/dist/serde/contracts/serializer.contract.d.ts +2 -2
- package/dist/serde/implementations/adapters/no-op-serde-adapter/no-op-serde-adapter.d.ts +2 -2
- package/dist/serde/implementations/adapters/no-op-serde-adapter/no-op-serde-adapter.js +2 -2
- package/dist/serde/implementations/adapters/super-json-serde-adapter/super-json-serde-adapter.d.ts +1 -1
- package/dist/serde/implementations/adapters/super-json-serde-adapter/super-json-serde-adapter.js +1 -1
- package/dist/serde/implementations/derivables/serde.d.ts +4 -35
- package/dist/serde/implementations/derivables/serde.js +2 -47
- package/dist/serde/implementations/derivables/serde.js.map +1 -1
- package/dist/serde/implementations/test-utilities/flexible-serde-adapter.test-suite.d.ts +3 -3
- package/dist/serde/implementations/test-utilities/flexible-serde-adapter.test-suite.js +2 -2
- package/dist/serde/implementations/test-utilities/flexible-serde.test-suite.d.ts +3 -3
- package/dist/serde/implementations/test-utilities/flexible-serde.test-suite.js +2 -2
- package/dist/utilities/classes/_module.d.ts +1 -1
- package/dist/utilities/classes/_module.js +1 -1
- package/dist/utilities/classes/_module.js.map +1 -1
- package/dist/utilities/classes/hooks/_module.d.ts +3 -0
- package/dist/utilities/classes/hooks/_module.js +4 -0
- package/dist/utilities/classes/hooks/_module.js.map +1 -0
- package/dist/utilities/classes/hooks/async-hooks.d.ts +209 -0
- package/dist/utilities/classes/hooks/async-hooks.js +145 -0
- package/dist/utilities/classes/hooks/async-hooks.js.map +1 -0
- package/dist/utilities/classes/hooks/hooks.d.ts +139 -0
- package/dist/utilities/classes/hooks/hooks.js +116 -0
- package/dist/utilities/classes/hooks/hooks.js.map +1 -0
- package/dist/utilities/classes/hooks/types.d.ts +9 -0
- package/dist/utilities/classes/hooks/types.js +5 -0
- package/dist/utilities/classes/hooks/types.js.map +1 -0
- package/dist/utilities/classes/key-prefixer/key-prefixer.d.ts +3 -3
- package/dist/utilities/classes/key-prefixer/key-prefixer.js +4 -4
- package/dist/utilities/classes/key-prefixer/key-prefixer.js.map +1 -1
- package/dist/utilities/classes/time-span/time-span.d.ts +5 -5
- package/dist/utilities/classes/time-span/time-span.js +5 -5
- package/dist/utilities/contracts/_module.d.ts +0 -1
- package/dist/utilities/contracts/_module.js +0 -1
- package/dist/utilities/contracts/_module.js.map +1 -1
- package/dist/utilities/contracts/deinitizable.contract.d.ts +1 -1
- package/dist/utilities/contracts/initizable.contract.d.ts +1 -1
- package/dist/utilities/contracts/prunable.contract.d.ts +1 -1
- package/dist/utilities/contracts/serialized-error.contract.d.ts +1 -1
- package/dist/utilities/contracts/sqlite-database.contract.d.ts +2 -2
- package/dist/utilities/errors.d.ts +5 -5
- package/dist/utilities/errors.js +5 -5
- package/dist/utilities/functions/factory.js +3 -3
- package/dist/utilities/functions/factory.js.map +1 -1
- package/dist/utilities/functions/invokable.d.ts +9 -5
- package/dist/utilities/functions/invokable.js +12 -2
- package/dist/utilities/functions/invokable.js.map +1 -1
- package/dist/utilities/functions/lazy.d.ts +5 -0
- package/dist/utilities/functions/lazy.js +12 -3
- package/dist/utilities/functions/lazy.js.map +1 -1
- package/dist/utilities/types/async-iterable-value.type.d.ts +1 -1
- package/dist/utilities/types/at-least-one.type.d.ts +1 -1
- package/dist/utilities/types/factory.type.d.ts +8 -8
- package/dist/utilities/types/invokable.type.d.ts +3 -3
- package/dist/utilities/types/items.type.d.ts +1 -1
- package/dist/utilities/types/lazy.type.d.ts +5 -5
- package/dist/utilities/types/none-func.type.d.ts +1 -1
- package/dist/utilities/types/one-or-more.type.d.ts +1 -1
- package/dist/utilities/types/promiseable.type.d.ts +1 -1
- package/dist/utilities/types/result.type.d.ts +1 -1
- package/package.json +22 -2
- package/dist/async/async.events.d.ts +0 -105
- package/dist/async/async.events.js +0 -82
- package/dist/async/async.events.js.map +0 -1
- package/dist/async/utilities/abort/_module.d.ts +0 -2
- package/dist/async/utilities/abort/_module.js +0 -3
- package/dist/async/utilities/abort/_module.js.map +0 -1
- package/dist/async/utilities/abort/abort-and-fail.d.ts +0 -4
- package/dist/async/utilities/abort/abort-and-fail.js.map +0 -1
- package/dist/async/utilities/abort/abort.d.ts +0 -9
- package/dist/async/utilities/abort/abort.js +0 -18
- package/dist/async/utilities/abort/abort.js.map +0 -1
- package/dist/async/utilities/delay/_module.d.ts +0 -1
- package/dist/async/utilities/delay/_module.js +0 -2
- package/dist/async/utilities/delay/_module.js.map +0 -1
- package/dist/async/utilities/delay/delay.d.ts +0 -10
- package/dist/async/utilities/delay/delay.js +0 -34
- package/dist/async/utilities/delay/delay.js.map +0 -1
- package/dist/async/utilities/retry/_module.d.ts +0 -2
- package/dist/async/utilities/retry/_module.js +0 -3
- package/dist/async/utilities/retry/_module.js.map +0 -1
- package/dist/async/utilities/retry/retry-or-fail.d.ts +0 -29
- package/dist/async/utilities/retry/retry-or-fail.js +0 -39
- package/dist/async/utilities/retry/retry-or-fail.js.map +0 -1
- package/dist/async/utilities/retry/retry.d.ts +0 -10
- package/dist/async/utilities/retry/retry.js +0 -21
- package/dist/async/utilities/retry/retry.js.map +0 -1
- package/dist/async/utilities/timeout/_module.d.ts +0 -2
- package/dist/async/utilities/timeout/_module.js +0 -3
- package/dist/async/utilities/timeout/_module.js.map +0 -1
- package/dist/async/utilities/timeout/timeout-and-fail.d.ts +0 -5
- package/dist/async/utilities/timeout/timeout-and-fail.js +0 -28
- package/dist/async/utilities/timeout/timeout-and-fail.js.map +0 -1
- package/dist/async/utilities/timeout/timeout.d.ts +0 -10
- package/dist/async/utilities/timeout/timeout.js +0 -21
- package/dist/async/utilities/timeout/timeout.js.map +0 -1
- package/dist/collection/implementations/async-iterable-collection/_shared/async-delay-iterable.d.ts +0 -13
- package/dist/collection/implementations/async-iterable-collection/_shared/async-delay-iterable.js +0 -30
- package/dist/collection/implementations/async-iterable-collection/_shared/async-delay-iterable.js.map +0 -1
- package/dist/collection/implementations/async-iterable-collection/_shared/async-retry-iterable.d.ts +0 -13
- package/dist/collection/implementations/async-iterable-collection/_shared/async-retry-iterable.js +0 -36
- package/dist/collection/implementations/async-iterable-collection/_shared/async-retry-iterable.js.map +0 -1
- package/dist/collection/implementations/async-iterable-collection/_shared/async-take-until-abort-iterable.d.ts +0 -9
- package/dist/collection/implementations/async-iterable-collection/_shared/async-take-until-abort-iterable.js +0 -39
- package/dist/collection/implementations/async-iterable-collection/_shared/async-take-until-abort-iterable.js.map +0 -1
- package/dist/collection/implementations/async-iterable-collection/_shared/async-take-until-timeout-iterable.d.ts +0 -13
- package/dist/collection/implementations/async-iterable-collection/_shared/async-take-until-timeout-iterable.js +0 -52
- package/dist/collection/implementations/async-iterable-collection/_shared/async-take-until-timeout-iterable.js.map +0 -1
- package/dist/event-bus/contracts/_shared.d.ts +0 -12
- package/dist/event-bus/contracts/_shared.js +0 -15
- package/dist/event-bus/contracts/_shared.js.map +0 -1
- package/dist/utilities/classes/sync-event-bus/_module.d.ts +0 -1
- package/dist/utilities/classes/sync-event-bus/_module.js +0 -2
- package/dist/utilities/classes/sync-event-bus/_module.js.map +0 -1
- package/dist/utilities/classes/sync-event-bus/sync-event-bus.d.ts +0 -16
- package/dist/utilities/classes/sync-event-bus/sync-event-bus.js +0 -53
- package/dist/utilities/classes/sync-event-bus/sync-event-bus.js.map +0 -1
- package/dist/utilities/contracts/sync-event-bus-listenable.d.ts +0 -13
- package/dist/utilities/contracts/sync-event-bus-listenable.js +0 -5
- package/dist/utilities/contracts/sync-event-bus-listenable.js.map +0 -1
|
@@ -6,32 +6,32 @@ import type { ISerializable } from "../../serde/contracts/_module-exports.js";
|
|
|
6
6
|
import type { Lazyable } from "../../utilities/_module-exports.js";
|
|
7
7
|
export type Collapse<TValue> = TValue extends Array<infer TItem> | Iterable<infer TItem> | ICollection<infer TItem> ? TItem : TValue;
|
|
8
8
|
/**
|
|
9
|
-
* The
|
|
10
|
-
*
|
|
9
|
+
* The `ICollection` contract offers a fluent and efficient approach to working with {@link Iterable | `Iterable`} objects.
|
|
10
|
+
* `ICollection` is immutable.
|
|
11
11
|
*
|
|
12
|
-
* IMPORT_PATH:
|
|
12
|
+
* IMPORT_PATH: `"@daiso-tech/core/collection/contracts"`
|
|
13
13
|
* @group Contracts
|
|
14
14
|
* @throws {UnexpectedCollectionError} {@link UnexpectedCollectionError}
|
|
15
15
|
*/
|
|
16
16
|
export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TInput[]> & {
|
|
17
17
|
/**
|
|
18
|
-
* The
|
|
18
|
+
* The `toIterator` method converts the collection to a new iterator.
|
|
19
19
|
*/
|
|
20
20
|
toIterator(): Iterator<TInput, void>;
|
|
21
21
|
/**
|
|
22
|
-
* The
|
|
22
|
+
* The `entries` returns an ICollection of key, value pairs for every entry in the collection.
|
|
23
23
|
*/
|
|
24
24
|
entries(): ICollection<[number, TInput]>;
|
|
25
25
|
/**
|
|
26
|
-
* The
|
|
26
|
+
* The `keys` method returns an ICollection of keys in the collection.
|
|
27
27
|
*/
|
|
28
28
|
keys(): ICollection<number>;
|
|
29
29
|
/**
|
|
30
|
-
* The
|
|
30
|
+
* The `values` method returns a copy of the collection.
|
|
31
31
|
*/
|
|
32
32
|
values(): ICollection<TInput>;
|
|
33
33
|
/**
|
|
34
|
-
* The
|
|
34
|
+
* The `filter` method filters the collection using `predicateFn`, keeping only those items that pass `predicateFn`.
|
|
35
35
|
* @example
|
|
36
36
|
* ```ts
|
|
37
37
|
* import type { ICollection } from "@daiso-tech/core";
|
|
@@ -48,7 +48,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
48
48
|
*/
|
|
49
49
|
filter<TOutput extends TInput>(predicateFn: PredicateInvokable<TInput, ICollection<TInput>, TOutput>): ICollection<TOutput>;
|
|
50
50
|
/**
|
|
51
|
-
* The
|
|
51
|
+
* The `reject` method filters the collection using `predicateFn`, keeping only those items that not pass `predicateFn`.
|
|
52
52
|
* @example
|
|
53
53
|
* ```ts
|
|
54
54
|
* import type { ICollection } from "@daiso-tech/core";
|
|
@@ -65,8 +65,8 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
65
65
|
*/
|
|
66
66
|
reject<TOutput extends TInput>(predicateFn: PredicateInvokable<TInput, ICollection<TInput>, TOutput>): ICollection<Exclude<TInput, TOutput>>;
|
|
67
67
|
/**
|
|
68
|
-
* The
|
|
69
|
-
* The
|
|
68
|
+
* The `map` method iterates through the collection and passes each item to `mapFn`.
|
|
69
|
+
* The `mapFn` is free to modify the item and return it, thus forming a new collection of modified items.
|
|
70
70
|
* @example
|
|
71
71
|
* ```ts
|
|
72
72
|
* import type { ICollection } from "@daiso-tech/core";
|
|
@@ -83,7 +83,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
83
83
|
*/
|
|
84
84
|
map<TOutput>(mapFn: Map<TInput, ICollection<TInput>, TOutput>): ICollection<TOutput>;
|
|
85
85
|
/**
|
|
86
|
-
* The
|
|
86
|
+
* The `reduce` method executes ` reduceFn ` function on each item of the array, passing in the return value from the calculation on the preceding item.
|
|
87
87
|
* The final result of running the reducer across all items of the array is a single value.
|
|
88
88
|
* @example
|
|
89
89
|
* ```ts
|
|
@@ -121,7 +121,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
121
121
|
reduce(reduceFn: Reduce<TInput, ICollection<TInput>, TInput>, initialValue: TInput): TInput;
|
|
122
122
|
reduce<TOutput>(reduceFn: Reduce<TInput, ICollection<TInput>, TOutput>, initialValue: TOutput): TOutput;
|
|
123
123
|
/**
|
|
124
|
-
* The
|
|
124
|
+
* The `join` method joins the collection's items with ` separator `. An error will be thrown when if a none string item is encounterd.
|
|
125
125
|
* @throws {TypeCollectionError}
|
|
126
126
|
* @example
|
|
127
127
|
* ```ts
|
|
@@ -151,7 +151,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
151
151
|
*/
|
|
152
152
|
join(separator?: string): Extract<TInput, string>;
|
|
153
153
|
/**
|
|
154
|
-
* The
|
|
154
|
+
* The `collapse` method collapses a collection of iterables into a single, flat collection.
|
|
155
155
|
* @example
|
|
156
156
|
* ```ts
|
|
157
157
|
* import type { ICollection } from "@daiso-tech/core";
|
|
@@ -168,8 +168,8 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
168
168
|
*/
|
|
169
169
|
collapse(): ICollection<Collapse<TInput>>;
|
|
170
170
|
/**
|
|
171
|
-
* The
|
|
172
|
-
* It is identical to a
|
|
171
|
+
* The `flatMap` method returns a new array formed by applying `mapFn` to each item of the array, and then collapses the result by one level.
|
|
172
|
+
* It is identical to a `map` method followed by a `collapse` method.
|
|
173
173
|
* @example
|
|
174
174
|
* ```ts
|
|
175
175
|
* import type { ICollection } from "@daiso-tech/core";
|
|
@@ -186,7 +186,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
186
186
|
*/
|
|
187
187
|
flatMap<TOutput>(mapFn: Map<TInput, ICollection<TInput>, Iterable<TOutput>>): ICollection<TOutput>;
|
|
188
188
|
/**
|
|
189
|
-
* The
|
|
189
|
+
* The `change` method changes only the items that passes `predicateFn` using `mapFn`.
|
|
190
190
|
* @example
|
|
191
191
|
* ```ts
|
|
192
192
|
* import type { ICollection } from "@daiso-tech/core";
|
|
@@ -203,7 +203,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
203
203
|
*/
|
|
204
204
|
change<TFilterOutput extends TInput, TMapOutput>(predicateFn: PredicateInvokable<TInput, ICollection<TInput>, TFilterOutput>, mapFn: Map<TFilterOutput, ICollection<TInput>, TMapOutput>): ICollection<TInput | TFilterOutput | TMapOutput>;
|
|
205
205
|
/**
|
|
206
|
-
* The
|
|
206
|
+
* The `set` method changes a item by i>index` using `value`.
|
|
207
207
|
* @example
|
|
208
208
|
* ```ts
|
|
209
209
|
* import type { ICollection } from "@daiso-tech/core";
|
|
@@ -233,7 +233,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
233
233
|
*/
|
|
234
234
|
set(index: number, value: TInput | Map<TInput, ICollection<TInput>, TInput>): ICollection<TInput>;
|
|
235
235
|
/**
|
|
236
|
-
* The
|
|
236
|
+
* The `get` method returns the item by index. If the item is not found null will returned.
|
|
237
237
|
* @example
|
|
238
238
|
* ```ts
|
|
239
239
|
* import type { ICollection } from "@daiso-tech/core";
|
|
@@ -252,7 +252,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
252
252
|
*/
|
|
253
253
|
get(index: number): TInput | null;
|
|
254
254
|
/**
|
|
255
|
-
* The
|
|
255
|
+
* The `getOrFail` method returns the item by index. If the item is not found an error will be thrown.
|
|
256
256
|
* @throws {ItemNotFoundCollectionError} {@link ItemNotFoundCollectionError}
|
|
257
257
|
* @example
|
|
258
258
|
* ```ts
|
|
@@ -272,7 +272,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
272
272
|
*/
|
|
273
273
|
getOrFail(index: number): TInput;
|
|
274
274
|
/**
|
|
275
|
-
* The
|
|
275
|
+
* The `page` method returns a new collection containing the items that would be present on ` page ` with custom ` pageSize `.
|
|
276
276
|
* @example
|
|
277
277
|
* ```ts
|
|
278
278
|
* import type { ICollection } from "@daiso-tech/core";
|
|
@@ -289,7 +289,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
289
289
|
*/
|
|
290
290
|
page(page: number, pageSize: number): ICollection<TInput>;
|
|
291
291
|
/**
|
|
292
|
-
* The
|
|
292
|
+
* The `sum` method returns the sum of all items in the collection. If the collection includes other than number items an error will be thrown.
|
|
293
293
|
* If the collection is empty an error will also be thrown.
|
|
294
294
|
* @throws {TypeCollectionError} {@link TypeCollectionError}
|
|
295
295
|
* @throws {EmptyCollectionError} {@link EmptyCollectionError}
|
|
@@ -308,7 +308,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
308
308
|
*/
|
|
309
309
|
sum(): Extract<TInput, number>;
|
|
310
310
|
/**
|
|
311
|
-
* The
|
|
311
|
+
* The `average` method returns the average of all items in the collection. If the collection includes other than number items an error will be thrown.
|
|
312
312
|
* If the collection is empty an error will also be thrown.
|
|
313
313
|
* @throws {TypeCollectionError} {@link TypeCollectionError}
|
|
314
314
|
* @throws {EmptyCollectionError} {@link EmptyCollectionError}
|
|
@@ -327,7 +327,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
327
327
|
*/
|
|
328
328
|
average(): Extract<TInput, number>;
|
|
329
329
|
/**
|
|
330
|
-
* The
|
|
330
|
+
* The `median` method returns the median of all items in the collection. If the collection includes other than number items an error will be thrown.
|
|
331
331
|
* If the collection is empty an error will also be thrown.
|
|
332
332
|
* @throws {TypeCollectionError} {@link TypeCollectionError}
|
|
333
333
|
* @throws {EmptyCollectionError} {@link EmptyCollectionError}
|
|
@@ -346,7 +346,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
346
346
|
*/
|
|
347
347
|
median(): Extract<TInput, number>;
|
|
348
348
|
/**
|
|
349
|
-
* The
|
|
349
|
+
* The `min` method returns the min of all items in the collection. If the collection includes other than number items an error will be thrown.
|
|
350
350
|
* If the collection is empty an error will also be thrown.
|
|
351
351
|
* @throws {TypeCollectionError} {@link TypeCollectionError}
|
|
352
352
|
* @throws {EmptyCollectionError} {@link EmptyCollectionError}
|
|
@@ -365,7 +365,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
365
365
|
*/
|
|
366
366
|
min(): Extract<TInput, number>;
|
|
367
367
|
/**
|
|
368
|
-
* The
|
|
368
|
+
* The `max` method returns the max of all items in the collection. If the collection includes other than number items an error will be thrown.
|
|
369
369
|
* If the collection is empty an error will also be thrown.
|
|
370
370
|
* @throws {TypeCollectionError} {@link TypeCollectionError}
|
|
371
371
|
* @throws {EmptyCollectionError} {@link EmptyCollectionError}
|
|
@@ -384,7 +384,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
384
384
|
*/
|
|
385
385
|
max(): Extract<TInput, number>;
|
|
386
386
|
/**
|
|
387
|
-
* The
|
|
387
|
+
* The `percentage` method may be used to quickly determine the percentage of items in the collection that pass `predicateFn`.
|
|
388
388
|
* If the collection is empty an error will also be thrown.
|
|
389
389
|
* @throws {EmptyCollectionError} {@link EmptyCollectionError}
|
|
390
390
|
* @example
|
|
@@ -402,7 +402,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
402
402
|
*/
|
|
403
403
|
percentage(predicateFn: PredicateInvokable<TInput, ICollection<TInput>>): number;
|
|
404
404
|
/**
|
|
405
|
-
* The
|
|
405
|
+
* The `some` method determines whether at least one item in the collection matches `predicateFn`.
|
|
406
406
|
* @example
|
|
407
407
|
* ```ts
|
|
408
408
|
* import type { ICollection } from "@daiso-tech/core";
|
|
@@ -418,7 +418,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
418
418
|
*/
|
|
419
419
|
some<TOutput extends TInput>(predicateFn: PredicateInvokable<TInput, ICollection<TInput>, TOutput>): boolean;
|
|
420
420
|
/**
|
|
421
|
-
* The
|
|
421
|
+
* The `every` method determines whether all items in the collection matches `predicateFn`.
|
|
422
422
|
* @example
|
|
423
423
|
* ```ts
|
|
424
424
|
* import type { ICollection } from "@daiso-tech/core";
|
|
@@ -434,7 +434,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
434
434
|
*/
|
|
435
435
|
every<TOutput extends TInput>(predicateFn: PredicateInvokable<TInput, ICollection<TInput>, TOutput>): boolean;
|
|
436
436
|
/**
|
|
437
|
-
* The
|
|
437
|
+
* The `take` method takes the first `limit` items.
|
|
438
438
|
* @example
|
|
439
439
|
* ```ts
|
|
440
440
|
* import type { ICollection } from "@daiso-tech/core";
|
|
@@ -465,7 +465,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
465
465
|
*/
|
|
466
466
|
take(limit: number): ICollection<TInput>;
|
|
467
467
|
/**
|
|
468
|
-
* The
|
|
468
|
+
* The `takeUntil` method takes items until `predicateFn` returns true.
|
|
469
469
|
* @example
|
|
470
470
|
* ```ts
|
|
471
471
|
* import type { ICollection } from "@daiso-tech/core";
|
|
@@ -482,7 +482,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
482
482
|
*/
|
|
483
483
|
takeUntil(predicateFn: PredicateInvokable<TInput, ICollection<TInput>>): ICollection<TInput>;
|
|
484
484
|
/**
|
|
485
|
-
* The
|
|
485
|
+
* The `takeWhile` method takes items until `predicateFn` returns false.
|
|
486
486
|
* @example
|
|
487
487
|
* ```ts
|
|
488
488
|
* import type { ICollection } from "@daiso-tech/core";
|
|
@@ -499,7 +499,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
499
499
|
*/
|
|
500
500
|
takeWhile(predicateFn: PredicateInvokable<TInput, ICollection<TInput>>): ICollection<TInput>;
|
|
501
501
|
/**
|
|
502
|
-
* The
|
|
502
|
+
* The `skip` method skips the first `offset` items.
|
|
503
503
|
* @example
|
|
504
504
|
* ```ts
|
|
505
505
|
* import type { ICollection } from "@daiso-tech/core";
|
|
@@ -516,7 +516,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
516
516
|
*/
|
|
517
517
|
skip(offset: number): ICollection<TInput>;
|
|
518
518
|
/**
|
|
519
|
-
* The
|
|
519
|
+
* The `skipUntil` method skips items until `predicateFn` returns true.
|
|
520
520
|
* @example
|
|
521
521
|
* ```ts
|
|
522
522
|
* import type { ICollection } from "@daiso-tech/core";
|
|
@@ -533,7 +533,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
533
533
|
*/
|
|
534
534
|
skipUntil(predicateFn: PredicateInvokable<TInput, ICollection<TInput>>): ICollection<TInput>;
|
|
535
535
|
/**
|
|
536
|
-
* The
|
|
536
|
+
* The `skipWhile` method skips items until `predicateFn` returns false.
|
|
537
537
|
* @example
|
|
538
538
|
* ```ts
|
|
539
539
|
* import type { ICollection } from "@daiso-tech/core";
|
|
@@ -550,7 +550,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
550
550
|
*/
|
|
551
551
|
skipWhile(predicateFn: PredicateInvokable<TInput, ICollection<TInput>>): ICollection<TInput>;
|
|
552
552
|
/**
|
|
553
|
-
* The
|
|
553
|
+
* The `when` method will execute `callback` when `condition` evaluates to true.
|
|
554
554
|
* @example
|
|
555
555
|
* ```ts
|
|
556
556
|
* import type { ICollection } from "@daiso-tech/core";
|
|
@@ -568,7 +568,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
568
568
|
*/
|
|
569
569
|
when<TExtended = TInput>(condition: boolean, callback: Modifier<ICollection<TInput>, ICollection<TExtended>>): ICollection<TInput | TExtended>;
|
|
570
570
|
/**
|
|
571
|
-
* The
|
|
571
|
+
* The `whenEmpty` method will execute `callback` when the collection is empty.
|
|
572
572
|
* @example
|
|
573
573
|
* ```ts
|
|
574
574
|
* import type { ICollection } from "@daiso-tech/core";
|
|
@@ -598,7 +598,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
598
598
|
*/
|
|
599
599
|
whenEmpty<TExtended = TInput>(callback: Modifier<ICollection<TInput>, ICollection<TExtended>>): ICollection<TInput | TExtended>;
|
|
600
600
|
/**
|
|
601
|
-
* The
|
|
601
|
+
* The `whenNot` method will execute `callback` when `condition` evaluates to false.
|
|
602
602
|
* @example
|
|
603
603
|
* ```ts
|
|
604
604
|
* import type { ICollection } from "@daiso-tech/core";
|
|
@@ -615,7 +615,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
615
615
|
*/
|
|
616
616
|
whenNot<TExtended = TInput>(condition: boolean, callback: Modifier<ICollection<TInput>, ICollection<TExtended>>): ICollection<TInput | TExtended>;
|
|
617
617
|
/**
|
|
618
|
-
* The
|
|
618
|
+
* The `whenNotEmpty` method will execute `callback` when the collection is not empty.
|
|
619
619
|
* @example
|
|
620
620
|
* ```ts
|
|
621
621
|
* import type { ICollection } from "@daiso-tech/core";
|
|
@@ -644,7 +644,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
644
644
|
*/
|
|
645
645
|
whenNotEmpty<TExtended = TInput>(callback: Modifier<ICollection<TInput>, ICollection<TExtended>>): ICollection<TInput | TExtended>;
|
|
646
646
|
/**
|
|
647
|
-
* The
|
|
647
|
+
* The `pipe` method passes the orignal collection to `callback` and returns the result from `callback`.
|
|
648
648
|
* This method is useful when you want compose multiple smaller functions.
|
|
649
649
|
* @example
|
|
650
650
|
* ```ts
|
|
@@ -674,7 +674,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
674
674
|
*/
|
|
675
675
|
pipe<TOutput = TInput>(callback: Transform<ICollection<TInput>, TOutput>): TOutput;
|
|
676
676
|
/**
|
|
677
|
-
* The
|
|
677
|
+
* The `tap` method passes a copy of the original collection to `callback`, allowing you to do something with the items while not affecting the original collection.
|
|
678
678
|
* @example
|
|
679
679
|
* ```ts
|
|
680
680
|
* import type { ICollection } from "@daiso-tech/core";
|
|
@@ -694,8 +694,8 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
694
694
|
*/
|
|
695
695
|
tap(callback: Tap<ICollection<TInput>>): ICollection<TInput>;
|
|
696
696
|
/**
|
|
697
|
-
* The
|
|
698
|
-
* If
|
|
697
|
+
* The `chunk` method breaks the collection into multiple, smaller collections of size `chunkSize`.
|
|
698
|
+
* If `chunkSize` is not divisible with total number of items then the last chunk will contain the remaining items.
|
|
699
699
|
* @example
|
|
700
700
|
* ```ts
|
|
701
701
|
* import type { ICollection } from "@daiso-tech/core";
|
|
@@ -711,8 +711,8 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
711
711
|
*/
|
|
712
712
|
chunk(chunkSize: number): ICollection<ICollection<TInput>>;
|
|
713
713
|
/**
|
|
714
|
-
* The
|
|
715
|
-
* The chunk variable passed to the
|
|
714
|
+
* The `chunkWhile` method breaks the collection into multiple, smaller collections based on the evaluation of `predicateFn`.
|
|
715
|
+
* The chunk variable passed to the `predicateFn` may be used to inspect the previous item.
|
|
716
716
|
* @example
|
|
717
717
|
* ```ts
|
|
718
718
|
* import type { ICollection } from "@daiso-tech/core";
|
|
@@ -732,7 +732,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
732
732
|
*/
|
|
733
733
|
chunkWhile(predicateFn: PredicateInvokable<TInput, ICollection<TInput>>): ICollection<ICollection<TInput>>;
|
|
734
734
|
/**
|
|
735
|
-
* The
|
|
735
|
+
* The `split` method breaks a collection evenly into `chunkAmount` of chunks.
|
|
736
736
|
* @example
|
|
737
737
|
* ```ts
|
|
738
738
|
* import type { ICollection } from "@daiso-tech/core";
|
|
@@ -778,7 +778,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
778
778
|
*/
|
|
779
779
|
split(chunkAmount: number): ICollection<ICollection<TInput>>;
|
|
780
780
|
/**
|
|
781
|
-
* The
|
|
781
|
+
* The `partition` method is used to separate items that pass `predicateFn` from those that do not.
|
|
782
782
|
* @example
|
|
783
783
|
* ```ts
|
|
784
784
|
* import type { ICollection } from "@daiso-tech/core";
|
|
@@ -796,7 +796,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
796
796
|
*/
|
|
797
797
|
partition(predicateFn: PredicateInvokable<TInput, ICollection<TInput>>): ICollection<ICollection<TInput>>;
|
|
798
798
|
/**
|
|
799
|
-
* The
|
|
799
|
+
* The `sliding` method returns a new collection of chunks representing a "sliding window" view of the items in the collection.
|
|
800
800
|
* @example
|
|
801
801
|
* ```ts
|
|
802
802
|
* import type { ICollection } from "@daiso-tech/core";
|
|
@@ -814,7 +814,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
814
814
|
*/
|
|
815
815
|
sliding(chunkSize: number, step?: number): ICollection<ICollection<TInput>>;
|
|
816
816
|
/**
|
|
817
|
-
* The
|
|
817
|
+
* The `groupBy` method groups the collection's items by ` selectFn `.
|
|
818
818
|
* By default the equality check occurs on the item.
|
|
819
819
|
* @example
|
|
820
820
|
* ```ts
|
|
@@ -869,7 +869,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
869
869
|
*/
|
|
870
870
|
groupBy<TOutput = TInput>(selectFn?: Map<TInput, ICollection<TInput>, TOutput>): ICollection<[TOutput, ICollection<TInput>]>;
|
|
871
871
|
/**
|
|
872
|
-
* The
|
|
872
|
+
* The `countBy` method counts the occurrences of values in the collection by ` selectFn `.
|
|
873
873
|
* By default the equality check occurs on the item.
|
|
874
874
|
* @example
|
|
875
875
|
* ```ts
|
|
@@ -908,7 +908,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
908
908
|
*/
|
|
909
909
|
countBy<TOutput = TInput>(selectFn?: Map<TInput, ICollection<TInput>, TOutput>): ICollection<[TOutput, number]>;
|
|
910
910
|
/**
|
|
911
|
-
* The
|
|
911
|
+
* The `unique` method removes all duplicate values from the collection by ` selectFn `.
|
|
912
912
|
* By default the equality check occurs on the item.
|
|
913
913
|
* @example
|
|
914
914
|
* ```ts
|
|
@@ -954,7 +954,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
954
954
|
*/
|
|
955
955
|
unique<TOutput = TInput>(selectFn?: Map<TInput, ICollection<TInput>, TOutput>): ICollection<TInput>;
|
|
956
956
|
/**
|
|
957
|
-
* The
|
|
957
|
+
* The `difference` method will return the values in the original collection that are not present in `iterable`.
|
|
958
958
|
* By default the equality check occurs on the item.
|
|
959
959
|
* @example
|
|
960
960
|
* ```ts
|
|
@@ -1006,7 +1006,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1006
1006
|
*/
|
|
1007
1007
|
difference<TOutput = TInput>(iterable: Iterable<TInput>, selectFn?: Map<TInput, ICollection<TInput>, TOutput>): ICollection<TInput>;
|
|
1008
1008
|
/**
|
|
1009
|
-
* The
|
|
1009
|
+
* The `repeat` method will repeat the original collection `amount` times.
|
|
1010
1010
|
* @example
|
|
1011
1011
|
* ```ts
|
|
1012
1012
|
* import type { ICollection } from "@daiso-tech/core";
|
|
@@ -1023,7 +1023,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1023
1023
|
*/
|
|
1024
1024
|
repeat(amount: number): ICollection<TInput>;
|
|
1025
1025
|
/**
|
|
1026
|
-
* The
|
|
1026
|
+
* The `padStart` method pads this collection with `fillItems` until the resulting collection size reaches `maxLength`.
|
|
1027
1027
|
* The padding is applied from the start of this collection.
|
|
1028
1028
|
* @example
|
|
1029
1029
|
* ```ts
|
|
@@ -1071,7 +1071,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1071
1071
|
*/
|
|
1072
1072
|
padStart<TExtended = TInput>(maxLength: number, fillItems: Iterable<TExtended>): ICollection<TInput | TExtended>;
|
|
1073
1073
|
/**
|
|
1074
|
-
* The
|
|
1074
|
+
* The `padEnd` method pads this collection with `fillItems` until the resulting collection size reaches `maxLength`.
|
|
1075
1075
|
* The padding is applied from the end of this collection.
|
|
1076
1076
|
* @example
|
|
1077
1077
|
* ```ts
|
|
@@ -1129,8 +1129,8 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1129
1129
|
*/
|
|
1130
1130
|
padEnd<TExtended = TInput>(maxLength: number, fillItems: Iterable<TExtended>): ICollection<TInput | TExtended>;
|
|
1131
1131
|
/**
|
|
1132
|
-
* The
|
|
1133
|
-
* where
|
|
1132
|
+
* The `slice` method creates porition of the original collection selected from `start` and `end`
|
|
1133
|
+
* where `start` and `end` (end not included) represent the index of items in the collection.
|
|
1134
1134
|
* @example
|
|
1135
1135
|
* ```ts
|
|
1136
1136
|
* import type { ICollection } from "@daiso-tech/core";
|
|
@@ -1212,7 +1212,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1212
1212
|
*/
|
|
1213
1213
|
slice(start?: number, end?: number): ICollection<TInput>;
|
|
1214
1214
|
/**
|
|
1215
|
-
* The
|
|
1215
|
+
* The `prepend` method adds `iterable` to the beginning of the collection.
|
|
1216
1216
|
* @example
|
|
1217
1217
|
* ```ts
|
|
1218
1218
|
* import type { ICollection } from "@daiso-tech/core";
|
|
@@ -1229,7 +1229,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1229
1229
|
*/
|
|
1230
1230
|
prepend<TExtended = TInput>(iterable: Iterable<TInput | TExtended>): ICollection<TInput | TExtended>;
|
|
1231
1231
|
/**
|
|
1232
|
-
* The
|
|
1232
|
+
* The `append` method adds `iterable` to the end of the collection.
|
|
1233
1233
|
* @example
|
|
1234
1234
|
* ```ts
|
|
1235
1235
|
* import type { ICollection } from "@daiso-tech/core";
|
|
@@ -1246,7 +1246,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1246
1246
|
*/
|
|
1247
1247
|
append<TExtended = TInput>(iterable: Iterable<TInput | TExtended>): ICollection<TInput | TExtended>;
|
|
1248
1248
|
/**
|
|
1249
|
-
* The
|
|
1249
|
+
* The `insertBefore` method adds `iterable` before the first item that matches `predicateFn`.
|
|
1250
1250
|
* @example
|
|
1251
1251
|
* ```ts
|
|
1252
1252
|
* import type { ICollection } from "@daiso-tech/core";
|
|
@@ -1263,7 +1263,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1263
1263
|
*/
|
|
1264
1264
|
insertBefore<TExtended = TInput>(predicateFn: PredicateInvokable<TInput, ICollection<TInput>>, iterable: Iterable<TInput | TExtended>): ICollection<TInput | TExtended>;
|
|
1265
1265
|
/**
|
|
1266
|
-
* The
|
|
1266
|
+
* The `insertAfter` method adds `iterable` after the first item that matches `predicateFn`.
|
|
1267
1267
|
* @example
|
|
1268
1268
|
* ```ts
|
|
1269
1269
|
* import type { ICollection } from "@daiso-tech/core";
|
|
@@ -1280,7 +1280,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1280
1280
|
*/
|
|
1281
1281
|
insertAfter<TExtended = TInput>(predicateFn: PredicateInvokable<TInput, ICollection<TInput>>, iterable: Iterable<TInput | TExtended>): ICollection<TInput | TExtended>;
|
|
1282
1282
|
/**
|
|
1283
|
-
* The
|
|
1283
|
+
* The `crossJoin` method cross joins the collection's values among `iterables`, returning a Cartesian product with all possible permutations.
|
|
1284
1284
|
* @example
|
|
1285
1285
|
* ```ts
|
|
1286
1286
|
* import type { ICollection } from "@daiso-tech/core";
|
|
@@ -1325,7 +1325,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1325
1325
|
*/
|
|
1326
1326
|
crossJoin<TExtended>(iterable: Iterable<TExtended>): ICollection<CrossJoinResult<TInput, TExtended>>;
|
|
1327
1327
|
/**
|
|
1328
|
-
* The
|
|
1328
|
+
* The `zip` method merges together the values of `iterable` with the values of the collection at their corresponding index.
|
|
1329
1329
|
* The returned collection has size of the shortest collection.
|
|
1330
1330
|
* @example
|
|
1331
1331
|
* ```ts
|
|
@@ -1369,7 +1369,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1369
1369
|
*/
|
|
1370
1370
|
zip<TExtended>(iterable: Iterable<TExtended>): ICollection<[TInput, TExtended]>;
|
|
1371
1371
|
/**
|
|
1372
|
-
* The
|
|
1372
|
+
* The `sort` method sorts the collection. You can provide a `comparator` function.
|
|
1373
1373
|
* @example
|
|
1374
1374
|
* ```ts
|
|
1375
1375
|
* import type { ICollection } from "@daiso-tech/core";
|
|
@@ -1414,8 +1414,8 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1414
1414
|
*/
|
|
1415
1415
|
sort(comparator?: Comparator<TInput>): ICollection<TInput>;
|
|
1416
1416
|
/**
|
|
1417
|
-
* The
|
|
1418
|
-
* The reversing of the collection will be applied in chunks that are the size of
|
|
1417
|
+
* The `reverse` method will reverse the order of the collection.
|
|
1418
|
+
* The reversing of the collection will be applied in chunks that are the size of ` chunkSize `.
|
|
1419
1419
|
* @example
|
|
1420
1420
|
* ```ts
|
|
1421
1421
|
* import type { ICollection } from "@daiso-tech/core";
|
|
@@ -1432,12 +1432,12 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1432
1432
|
*/
|
|
1433
1433
|
reverse(chunkSize?: number): ICollection<TInput>;
|
|
1434
1434
|
/**
|
|
1435
|
-
* The
|
|
1435
|
+
* The `shuffle` method randomly shuffles the items in the collection. You can provide a custom Math.random function by passing in `mathRandom`.
|
|
1436
1436
|
*/
|
|
1437
1437
|
shuffle(mathRandom?: () => number): ICollection<TInput>;
|
|
1438
1438
|
/**
|
|
1439
|
-
* The
|
|
1440
|
-
* By default it will get the first item. If the collection is empty or no items passes
|
|
1439
|
+
* The `first` method returns the first item in the collection that passes ` predicateFn `.
|
|
1440
|
+
* By default it will get the first item. If the collection is empty or no items passes ` predicateFn ` than null i returned.
|
|
1441
1441
|
* @example
|
|
1442
1442
|
* ```ts
|
|
1443
1443
|
* import type { ICollection } from "@daiso-tech/core";
|
|
@@ -1478,8 +1478,8 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1478
1478
|
*/
|
|
1479
1479
|
first<TOutput extends TInput>(predicateFn?: PredicateInvokable<TInput, ICollection<TInput>, TOutput>): TOutput | null;
|
|
1480
1480
|
/**
|
|
1481
|
-
* The
|
|
1482
|
-
* By default it will get the first item. If the collection is empty or no items passes
|
|
1481
|
+
* The `firstOr` method returns the first item in the collection that passes ` predicateFn `
|
|
1482
|
+
* By default it will get the first item. If the collection is empty or no items passes ` predicateFn ` than ` defaultValue `.
|
|
1483
1483
|
* @example
|
|
1484
1484
|
* ```ts
|
|
1485
1485
|
* import type { ICollection } from "@daiso-tech/core";
|
|
@@ -1531,8 +1531,8 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1531
1531
|
*/
|
|
1532
1532
|
firstOr<TOutput extends TInput, TExtended = TInput>(defaultValue: Lazyable<TExtended>, predicateFn?: PredicateInvokable<TInput, ICollection<TInput>, TOutput>): TOutput | TExtended;
|
|
1533
1533
|
/**
|
|
1534
|
-
* The
|
|
1535
|
-
* By default it will get the first item. If the collection is empty or no items passes
|
|
1534
|
+
* The `firstOrFail` method returns the first item in the collection that passes ` predicateFn `.
|
|
1535
|
+
* By default it will get the first item. If the collection is empty or no items passes ` predicateFn ` than error is thrown.
|
|
1536
1536
|
* @throws {ItemNotFoundCollectionError} {@link ItemNotFoundCollectionError}
|
|
1537
1537
|
* @example
|
|
1538
1538
|
* ```ts
|
|
@@ -1573,8 +1573,8 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1573
1573
|
*/
|
|
1574
1574
|
firstOrFail<TOutput extends TInput>(predicateFn?: PredicateInvokable<TInput, ICollection<TInput>, TOutput>): TOutput;
|
|
1575
1575
|
/**
|
|
1576
|
-
* The
|
|
1577
|
-
* By default it will get the last item. If the collection is empty or no items passes
|
|
1576
|
+
* The `last` method returns the last item in the collection that passes ` predicateFn `.
|
|
1577
|
+
* By default it will get the last item. If the collection is empty or no items passes ` predicateFn ` than null i returned.
|
|
1578
1578
|
* @example
|
|
1579
1579
|
* ```ts
|
|
1580
1580
|
* import type { ICollection } from "@daiso-tech/core";
|
|
@@ -1614,8 +1614,8 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1614
1614
|
*/
|
|
1615
1615
|
last<TOutput extends TInput>(predicateFn?: PredicateInvokable<TInput, ICollection<TInput>, TOutput>): TOutput | null;
|
|
1616
1616
|
/**
|
|
1617
|
-
* The
|
|
1618
|
-
* By default it will get the last item. If the collection is empty or no items passes
|
|
1617
|
+
* The `lastOr` method returns the last item in the collection that passes ` predicateFn `.
|
|
1618
|
+
* By default it will get the last item. If the collection is empty or no items passes ` predicateFn ` than ` defaultValue `.
|
|
1619
1619
|
* @example
|
|
1620
1620
|
* ```ts
|
|
1621
1621
|
* import type { ICollection } from "@daiso-tech/core";
|
|
@@ -1667,8 +1667,8 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1667
1667
|
*/
|
|
1668
1668
|
lastOr<TOutput extends TInput, TExtended = TInput>(defaultValue: Lazyable<TExtended>, predicateFn?: PredicateInvokable<TInput, ICollection<TInput>, TOutput>): TOutput | TExtended;
|
|
1669
1669
|
/**
|
|
1670
|
-
* The
|
|
1671
|
-
* By default it will get the last item. If the collection is empty or no items passes
|
|
1670
|
+
* The `lastOrFail` method returns the last item in the collection that passes ` predicateFn `.
|
|
1671
|
+
* By default it will get the last item. If the collection is empty or no items passes ` predicateFn ` than error is thrown.
|
|
1672
1672
|
* @throws {ItemNotFoundCollectionError} {@link ItemNotFoundCollectionError}
|
|
1673
1673
|
* @example
|
|
1674
1674
|
* ```ts
|
|
@@ -1709,8 +1709,8 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1709
1709
|
*/
|
|
1710
1710
|
lastOrFail<TOutput extends TInput>(predicateFn?: PredicateInvokable<TInput, ICollection<TInput>, TOutput>): TOutput;
|
|
1711
1711
|
/**
|
|
1712
|
-
* The
|
|
1713
|
-
* If the
|
|
1712
|
+
* The `before` method returns the item that comes before the first item that matches `predicateFn`.
|
|
1713
|
+
* If the `predicateFn` does not match or matches the first item then null is returned.
|
|
1714
1714
|
* @example
|
|
1715
1715
|
* ```ts
|
|
1716
1716
|
* import type { ICollection } from "@daiso-tech/core";
|
|
@@ -1738,8 +1738,8 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1738
1738
|
*/
|
|
1739
1739
|
before(predicateFn: PredicateInvokable<TInput, ICollection<TInput>>): TInput | null;
|
|
1740
1740
|
/**
|
|
1741
|
-
* The
|
|
1742
|
-
* If the collection is empty or the
|
|
1741
|
+
* The `beforeOr` method returns the item that comes before the first item that matches `predicateFn`.
|
|
1742
|
+
* If the collection is empty or the `predicateFn` does not match or matches the first item then `defaultValue` is returned.
|
|
1743
1743
|
* @example
|
|
1744
1744
|
* ```ts
|
|
1745
1745
|
* import type { ICollection } from "@daiso-tech/core";
|
|
@@ -1779,8 +1779,8 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1779
1779
|
*/
|
|
1780
1780
|
beforeOr<TExtended = TInput>(defaultValue: Lazyable<TExtended>, predicateFn: PredicateInvokable<TInput, ICollection<TInput>>): TInput | TExtended;
|
|
1781
1781
|
/**
|
|
1782
|
-
* The
|
|
1783
|
-
* If the collection is empty or the
|
|
1782
|
+
* The `beforeOrFail` method returns the item that comes before the first item that matches `predicateFn`.
|
|
1783
|
+
* If the collection is empty or the `predicateFn` does not match or matches the first item then an error is thrown.
|
|
1784
1784
|
* @throws {ItemNotFoundCollectionError} {@link ItemNotFoundCollectionError}
|
|
1785
1785
|
* @example
|
|
1786
1786
|
* ```ts
|
|
@@ -1809,8 +1809,8 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1809
1809
|
*/
|
|
1810
1810
|
beforeOrFail(predicateFn: PredicateInvokable<TInput, ICollection<TInput>>): TInput;
|
|
1811
1811
|
/**
|
|
1812
|
-
* The
|
|
1813
|
-
* If the collection is empty or the
|
|
1812
|
+
* The `after` method returns the item that comes after the first item that matches `predicateFn`.
|
|
1813
|
+
* If the collection is empty or the `predicateFn` does not match or matches the last item then null is returned.
|
|
1814
1814
|
* @example
|
|
1815
1815
|
* ```ts
|
|
1816
1816
|
* import type { ICollection } from "@daiso-tech/core";
|
|
@@ -1838,8 +1838,8 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1838
1838
|
*/
|
|
1839
1839
|
after(predicateFn: PredicateInvokable<TInput, ICollection<TInput>>): TInput | null;
|
|
1840
1840
|
/**
|
|
1841
|
-
* The
|
|
1842
|
-
* If the collection is empty or the
|
|
1841
|
+
* The `afterOr` method returns the item that comes after the first item that matches `predicateFn`.
|
|
1842
|
+
* If the collection is empty or the `predicateFn` does not match or matches the last item then `defaultValue` is returned.
|
|
1843
1843
|
* @example
|
|
1844
1844
|
* ```ts
|
|
1845
1845
|
* import type { ICollection } from "@daiso-tech/core";
|
|
@@ -1879,8 +1879,8 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1879
1879
|
*/
|
|
1880
1880
|
afterOr<TExtended = TInput>(defaultValue: Lazyable<TExtended>, predicateFn: PredicateInvokable<TInput, ICollection<TInput>>): TInput | TExtended;
|
|
1881
1881
|
/**
|
|
1882
|
-
* The
|
|
1883
|
-
* If the collection is empty or the
|
|
1882
|
+
* The `afterOrFail` method returns the item that comes after the first item that matches `predicateFn`.
|
|
1883
|
+
* If the collection is empty or the `predicateFn` does not match or matches the last item then an error is thrown.
|
|
1884
1884
|
* @throws {ItemNotFoundCollectionError} {@link ItemNotFoundCollectionError}
|
|
1885
1885
|
* @example
|
|
1886
1886
|
* ```ts
|
|
@@ -1909,7 +1909,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1909
1909
|
*/
|
|
1910
1910
|
afterOrFail(predicateFn: PredicateInvokable<TInput, ICollection<TInput>>): TInput;
|
|
1911
1911
|
/**
|
|
1912
|
-
* The
|
|
1912
|
+
* The `sole` method returns the first item in the collection that passes `predicateFn`, but only if `predicateFn` matches exactly one item.
|
|
1913
1913
|
* If no items matches or multiple items are found an error will be thrown.
|
|
1914
1914
|
* @throws {ItemNotFoundCollectionError} {@link ItemNotFoundCollectionError}
|
|
1915
1915
|
* @throws {MultipleItemsFoundCollectionError} {@link MultipleItemsFoundCollectionError}
|
|
@@ -1952,7 +1952,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1952
1952
|
*/
|
|
1953
1953
|
sole<TOutput extends TInput>(predicateFn: PredicateInvokable<TInput, ICollection<TInput>, TOutput>): TOutput;
|
|
1954
1954
|
/**
|
|
1955
|
-
* The
|
|
1955
|
+
* The `nth` method creates a new collection consisting of every n-th item.
|
|
1956
1956
|
* @example
|
|
1957
1957
|
* ```ts
|
|
1958
1958
|
* import type { ICollection } from "@daiso-tech/core";
|
|
@@ -1969,7 +1969,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1969
1969
|
*/
|
|
1970
1970
|
nth(step: number): ICollection<TInput>;
|
|
1971
1971
|
/**
|
|
1972
|
-
* The
|
|
1972
|
+
* The `count` method returns the total number of items in the collection that passes `predicateFn`.
|
|
1973
1973
|
* @example
|
|
1974
1974
|
* ```ts
|
|
1975
1975
|
* import type { ICollection } from "@daiso-tech/core";
|
|
@@ -1985,19 +1985,19 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1985
1985
|
*/
|
|
1986
1986
|
count(predicateFn: PredicateInvokable<TInput, ICollection<TInput>>): number;
|
|
1987
1987
|
/**
|
|
1988
|
-
* The
|
|
1988
|
+
* The `size` returns the size of the collection.
|
|
1989
1989
|
*/
|
|
1990
1990
|
size(): number;
|
|
1991
1991
|
/**
|
|
1992
|
-
* The
|
|
1992
|
+
* The `isEmpty` returns true if the collection is empty.
|
|
1993
1993
|
*/
|
|
1994
1994
|
isEmpty(): boolean;
|
|
1995
1995
|
/**
|
|
1996
|
-
* The
|
|
1996
|
+
* The `isNotEmpty` returns true if the collection is not empty.
|
|
1997
1997
|
*/
|
|
1998
1998
|
isNotEmpty(): boolean;
|
|
1999
1999
|
/**
|
|
2000
|
-
* The
|
|
2000
|
+
* The `searchFirst` return the index of the first item that matches `predicateFn`.
|
|
2001
2001
|
* @example
|
|
2002
2002
|
* ```ts
|
|
2003
2003
|
* import type { ICollection } from "@daiso-tech/core";
|
|
@@ -2013,7 +2013,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
2013
2013
|
*/
|
|
2014
2014
|
searchFirst(predicateFn: PredicateInvokable<TInput, ICollection<TInput>>): number;
|
|
2015
2015
|
/**
|
|
2016
|
-
* The
|
|
2016
|
+
* The `searchLast` return the index of the last item that matches `predicateFn`.
|
|
2017
2017
|
* @example
|
|
2018
2018
|
* ```ts
|
|
2019
2019
|
* import type { ICollection } from "@daiso-tech/core";
|
|
@@ -2029,21 +2029,21 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
2029
2029
|
*/
|
|
2030
2030
|
searchLast(predicateFn: PredicateInvokable<TInput, ICollection<TInput>>): number;
|
|
2031
2031
|
/**
|
|
2032
|
-
* The
|
|
2032
|
+
* The `forEach` method iterates through all items in the collection.
|
|
2033
2033
|
*/
|
|
2034
2034
|
forEach(callback: ForEach<TInput, ICollection<TInput>>): void;
|
|
2035
2035
|
/**
|
|
2036
|
-
* The
|
|
2036
|
+
* The `toArray` method converts the collection to a new {@link Array | `Array`}.
|
|
2037
2037
|
*/
|
|
2038
2038
|
toArray(): TInput[];
|
|
2039
2039
|
/**
|
|
2040
|
-
* The
|
|
2040
|
+
* The `toRecord` method converts the collection to a new {@link Record | `Record`}.
|
|
2041
2041
|
* An error will be thrown if item is not a tuple of size 2 where the first element is a string or a number.
|
|
2042
2042
|
* @throws {TypeCollectionError} {@link TypeCollectionError}
|
|
2043
2043
|
*/
|
|
2044
2044
|
toRecord(): EnsureRecord<TInput>;
|
|
2045
2045
|
/**
|
|
2046
|
-
* The
|
|
2046
|
+
* The `toMap` method converts the collection to a new {@link Map | `Map`}.
|
|
2047
2047
|
* An error will be thrown if item is not a tuple of size 2.
|
|
2048
2048
|
* @throws {TypeCollectionError} {@link TypeCollectionError}
|
|
2049
2049
|
*/
|