@daiso-tech/core 0.28.1 → 0.30.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 +8 -2
- package/dist/async/utilities/abort/abort.d.ts +1 -1
- package/dist/async/utilities/lazy-promise/lazy-promise.d.ts +3 -4
- package/dist/async/utilities/lazy-promise/lazy-promise.js.map +1 -1
- package/dist/async/utilities/retry/retry.d.ts +1 -1
- package/dist/async/utilities/timeout/timeout.d.ts +1 -1
- package/dist/cache/contracts/cache-factory.contract.js +1 -1
- package/dist/cache/contracts/cache-factory.contract.js.map +1 -1
- package/dist/cache/contracts/cache.contract.d.ts +3 -3
- package/dist/cache/implementations/derivables/cache/cache.d.ts +18 -13
- package/dist/cache/implementations/derivables/cache/cache.js +10 -3
- package/dist/cache/implementations/derivables/cache/cache.js.map +1 -1
- package/dist/cache/implementations/derivables/cache/is-database-cache-adapter.js.map +1 -1
- package/dist/collection/contracts/_module-exports.d.ts +1 -1
- package/dist/collection/contracts/_module-exports.js +1 -1
- package/dist/collection/contracts/_module-exports.js.map +1 -1
- package/dist/collection/contracts/_shared/_module.d.ts +11 -0
- package/dist/collection/contracts/_shared/_module.js +12 -0
- package/dist/collection/contracts/_shared/_module.js.map +1 -0
- package/dist/collection/contracts/_shared/compartor.type.d.ts +9 -0
- package/dist/collection/contracts/_shared/compartor.type.js +5 -0
- package/dist/collection/contracts/_shared/compartor.type.js.map +1 -0
- package/dist/collection/contracts/_shared/cross-join-result.type.d.ts +11 -0
- package/dist/collection/contracts/_shared/cross-join-result.type.js +5 -0
- package/dist/collection/contracts/_shared/cross-join-result.type.js.map +1 -0
- package/dist/collection/contracts/_shared/ensure-map.type.d.ts +8 -0
- package/dist/collection/contracts/_shared/ensure-map.type.js +5 -0
- package/dist/collection/contracts/_shared/ensure-map.type.js.map +1 -0
- package/dist/collection/contracts/_shared/ensure-record.type.d.ts +8 -0
- package/dist/collection/contracts/_shared/ensure-record.type.js +5 -0
- package/dist/collection/contracts/_shared/ensure-record.type.js.map +1 -0
- package/dist/collection/contracts/_shared/foreach.type.d.ts +22 -0
- package/dist/collection/contracts/_shared/foreach.type.js +5 -0
- package/dist/collection/contracts/_shared/foreach.type.js.map +1 -0
- package/dist/collection/contracts/_shared/map.type.d.ts +22 -0
- package/dist/collection/contracts/{_shared.js → _shared/map.type.js} +1 -1
- package/dist/collection/contracts/_shared/map.type.js.map +1 -0
- package/dist/collection/contracts/_shared/modifier.type.d.ts +18 -0
- package/dist/collection/contracts/_shared/modifier.type.js +5 -0
- package/dist/collection/contracts/_shared/modifier.type.js.map +1 -0
- package/dist/collection/contracts/_shared/predicate.type.d.ts +49 -0
- package/dist/collection/contracts/_shared/predicate.type.js +5 -0
- package/dist/collection/contracts/_shared/predicate.type.js.map +1 -0
- package/dist/collection/contracts/_shared/reduce.type.d.ts +24 -0
- package/dist/collection/contracts/_shared/reduce.type.js +5 -0
- package/dist/collection/contracts/_shared/reduce.type.js.map +1 -0
- package/dist/collection/contracts/_shared/tap.type.d.ts +16 -0
- package/dist/collection/contracts/_shared/tap.type.js +5 -0
- package/dist/collection/contracts/_shared/tap.type.js.map +1 -0
- package/dist/collection/contracts/_shared/transform.type.d.ts +16 -0
- package/dist/collection/contracts/_shared/transform.type.js +5 -0
- package/dist/collection/contracts/_shared/transform.type.js.map +1 -0
- package/dist/collection/contracts/async-collection.contract.d.ts +3 -3
- package/dist/collection/contracts/collection.contract.d.ts +31 -31
- package/dist/collection/contracts/collection.errors.d.ts +1 -1
- package/dist/collection/contracts/collection.errors.js +1 -1
- package/dist/collection/implementations/async-iterable-collection/_shared/async-chunk-while-iterable.js +2 -2
- package/dist/collection/implementations/async-iterable-collection/_shared/async-chunk-while-iterable.js.map +1 -1
- package/dist/collection/implementations/async-iterable-collection/_shared/async-count-by-iterable.js +2 -1
- package/dist/collection/implementations/async-iterable-collection/_shared/async-count-by-iterable.js.map +1 -1
- package/dist/collection/implementations/async-iterable-collection/_shared/async-filter-iterable.js +2 -1
- package/dist/collection/implementations/async-iterable-collection/_shared/async-filter-iterable.js.map +1 -1
- package/dist/collection/implementations/async-iterable-collection/_shared/async-flat-map-iterable.js +2 -1
- package/dist/collection/implementations/async-iterable-collection/_shared/async-flat-map-iterable.js.map +1 -1
- package/dist/collection/implementations/async-iterable-collection/_shared/async-group-by-iterable.js +2 -2
- package/dist/collection/implementations/async-iterable-collection/_shared/async-group-by-iterable.js.map +1 -1
- package/dist/collection/implementations/async-iterable-collection/_shared/async-insert-after-iterable.js +2 -2
- package/dist/collection/implementations/async-iterable-collection/_shared/async-insert-after-iterable.js.map +1 -1
- package/dist/collection/implementations/async-iterable-collection/_shared/async-insert-before-iterable.js +2 -2
- package/dist/collection/implementations/async-iterable-collection/_shared/async-insert-before-iterable.js.map +1 -1
- package/dist/collection/implementations/async-iterable-collection/_shared/async-map-iterable.js +2 -1
- package/dist/collection/implementations/async-iterable-collection/_shared/async-map-iterable.js.map +1 -1
- package/dist/collection/implementations/async-iterable-collection/_shared/async-partion-iterable.js +2 -2
- package/dist/collection/implementations/async-iterable-collection/_shared/async-partion-iterable.js.map +1 -1
- package/dist/collection/implementations/async-iterable-collection/_shared/async-skip-until-iterable.js +2 -1
- package/dist/collection/implementations/async-iterable-collection/_shared/async-skip-until-iterable.js.map +1 -1
- package/dist/collection/implementations/async-iterable-collection/_shared/async-sort-iterable.js +6 -1
- package/dist/collection/implementations/async-iterable-collection/_shared/async-sort-iterable.js.map +1 -1
- package/dist/collection/implementations/async-iterable-collection/_shared/async-take-until-iterable.js +2 -1
- package/dist/collection/implementations/async-iterable-collection/_shared/async-take-until-iterable.js.map +1 -1
- package/dist/collection/implementations/async-iterable-collection/_shared/async-tap-iterable.js +2 -1
- package/dist/collection/implementations/async-iterable-collection/_shared/async-tap-iterable.js.map +1 -1
- package/dist/collection/implementations/async-iterable-collection/_shared/async-unique-iterable.js +2 -1
- package/dist/collection/implementations/async-iterable-collection/_shared/async-unique-iterable.js.map +1 -1
- package/dist/collection/implementations/async-iterable-collection/_shared/async-update-iterable.js +3 -2
- package/dist/collection/implementations/async-iterable-collection/_shared/async-update-iterable.js.map +1 -1
- package/dist/collection/implementations/async-iterable-collection/_shared/async-when-iterable.js +2 -1
- package/dist/collection/implementations/async-iterable-collection/_shared/async-when-iterable.js.map +1 -1
- package/dist/collection/implementations/async-iterable-collection/async-iterable-collection.d.ts +3 -3
- package/dist/collection/implementations/async-iterable-collection/async-iterable-collection.js +25 -24
- package/dist/collection/implementations/async-iterable-collection/async-iterable-collection.js.map +1 -1
- package/dist/collection/implementations/iterable-collection/_shared/chunk-while-iterable.d.ts +2 -2
- package/dist/collection/implementations/iterable-collection/_shared/chunk-while-iterable.js +2 -1
- package/dist/collection/implementations/iterable-collection/_shared/chunk-while-iterable.js.map +1 -1
- package/dist/collection/implementations/iterable-collection/_shared/count-by-iterable.js +2 -1
- package/dist/collection/implementations/iterable-collection/_shared/count-by-iterable.js.map +1 -1
- package/dist/collection/implementations/iterable-collection/_shared/filter-iterable.d.ts +2 -2
- package/dist/collection/implementations/iterable-collection/_shared/filter-iterable.js +2 -1
- package/dist/collection/implementations/iterable-collection/_shared/filter-iterable.js.map +1 -1
- package/dist/collection/implementations/iterable-collection/_shared/flat-map-iterable.js +2 -1
- package/dist/collection/implementations/iterable-collection/_shared/flat-map-iterable.js.map +1 -1
- package/dist/collection/implementations/iterable-collection/_shared/group-by-iterable.js +2 -1
- package/dist/collection/implementations/iterable-collection/_shared/group-by-iterable.js.map +1 -1
- package/dist/collection/implementations/iterable-collection/_shared/insert-after-iterable.d.ts +2 -2
- package/dist/collection/implementations/iterable-collection/_shared/insert-after-iterable.js +3 -1
- package/dist/collection/implementations/iterable-collection/_shared/insert-after-iterable.js.map +1 -1
- package/dist/collection/implementations/iterable-collection/_shared/insert-before-iterable.d.ts +2 -2
- package/dist/collection/implementations/iterable-collection/_shared/insert-before-iterable.js +3 -1
- package/dist/collection/implementations/iterable-collection/_shared/insert-before-iterable.js.map +1 -1
- package/dist/collection/implementations/iterable-collection/_shared/map-iterable.js +2 -1
- package/dist/collection/implementations/iterable-collection/_shared/map-iterable.js.map +1 -1
- package/dist/collection/implementations/iterable-collection/_shared/partion-iterable.d.ts +2 -2
- package/dist/collection/implementations/iterable-collection/_shared/partion-iterable.js +2 -1
- package/dist/collection/implementations/iterable-collection/_shared/partion-iterable.js.map +1 -1
- package/dist/collection/implementations/iterable-collection/_shared/skip-until-iterable.d.ts +2 -2
- package/dist/collection/implementations/iterable-collection/_shared/skip-until-iterable.js +2 -1
- package/dist/collection/implementations/iterable-collection/_shared/skip-until-iterable.js.map +1 -1
- package/dist/collection/implementations/iterable-collection/_shared/sort-iterable.js +6 -1
- package/dist/collection/implementations/iterable-collection/_shared/sort-iterable.js.map +1 -1
- package/dist/collection/implementations/iterable-collection/_shared/take-until-iterable.d.ts +2 -2
- package/dist/collection/implementations/iterable-collection/_shared/take-until-iterable.js +2 -1
- package/dist/collection/implementations/iterable-collection/_shared/take-until-iterable.js.map +1 -1
- package/dist/collection/implementations/iterable-collection/_shared/tap-iterable.js +2 -1
- package/dist/collection/implementations/iterable-collection/_shared/tap-iterable.js.map +1 -1
- package/dist/collection/implementations/iterable-collection/_shared/unique-iterable.js +2 -1
- package/dist/collection/implementations/iterable-collection/_shared/unique-iterable.js.map +1 -1
- package/dist/collection/implementations/iterable-collection/_shared/update-iterable.d.ts +2 -2
- package/dist/collection/implementations/iterable-collection/_shared/update-iterable.js +3 -2
- package/dist/collection/implementations/iterable-collection/_shared/update-iterable.js.map +1 -1
- package/dist/collection/implementations/iterable-collection/_shared/when-iterable.js +2 -1
- package/dist/collection/implementations/iterable-collection/_shared/when-iterable.js.map +1 -1
- package/dist/collection/implementations/iterable-collection/iterable-collection.d.ts +31 -31
- package/dist/collection/implementations/iterable-collection/iterable-collection.js +23 -22
- package/dist/collection/implementations/iterable-collection/iterable-collection.js.map +1 -1
- package/dist/collection/implementations/list-collection/list-collection.d.ts +31 -31
- package/dist/collection/implementations/list-collection/list-collection.js +44 -38
- package/dist/collection/implementations/list-collection/list-collection.js.map +1 -1
- package/dist/event-bus/contracts/event-bus-adapter.contract.d.ts +10 -4
- package/dist/event-bus/contracts/event-bus.contract.d.ts +26 -8
- package/dist/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter.d.ts +3 -4
- package/dist/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter.js +0 -1
- package/dist/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter.js.map +1 -1
- package/dist/event-bus/implementations/adapters/no-op-event-bus-adapter/no-op-event-bus-adapter.d.ts +3 -4
- package/dist/event-bus/implementations/adapters/no-op-event-bus-adapter/no-op-event-bus-adapter.js.map +1 -1
- package/dist/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter.d.ts +3 -4
- package/dist/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter.js +0 -1
- package/dist/event-bus/implementations/adapters/redis-pub-sub-event-bus-adapter/redis-pub-sub-event-bus-adapter.js.map +1 -1
- package/dist/event-bus/implementations/derivables/event-bus/event-bus.d.ts +11 -10
- package/dist/event-bus/implementations/derivables/event-bus/event-bus.js +30 -6
- package/dist/event-bus/implementations/derivables/event-bus/event-bus.js.map +1 -1
- package/dist/event-bus/implementations/derivables/event-bus/listener-store.d.ts +4 -4
- package/dist/event-bus/implementations/derivables/event-bus/listener-store.js +10 -8
- package/dist/event-bus/implementations/derivables/event-bus/listener-store.js.map +1 -1
- package/dist/event-bus/implementations/test-utilities/event-bus.test-suite.js +453 -4
- package/dist/event-bus/implementations/test-utilities/event-bus.test-suite.js.map +1 -1
- package/dist/lock/contracts/lock-provider-factory.contract.js +1 -1
- package/dist/lock/contracts/lock-provider-factory.contract.js.map +1 -1
- package/dist/lock/contracts/lock.contract.d.ts +5 -5
- package/dist/lock/contracts/lock.events.d.ts +1 -1
- package/dist/lock/implementations/derivables/lock-provider/lock-provider.d.ts +16 -11
- package/dist/lock/implementations/derivables/lock-provider/lock-provider.js +10 -3
- 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 +1 -1
- package/dist/lock/implementations/derivables/lock-provider/lock.d.ts +18 -13
- package/dist/lock/implementations/derivables/lock-provider/lock.js +12 -17
- package/dist/lock/implementations/derivables/lock-provider/lock.js.map +1 -1
- package/dist/utilities/_module-exports.d.ts +2 -2
- package/dist/utilities/_module-exports.js +2 -2
- package/dist/utilities/_module-exports.js.map +1 -1
- package/dist/utilities/classes/_module.d.ts +0 -1
- package/dist/utilities/classes/_module.js +0 -1
- package/dist/utilities/classes/_module.js.map +1 -1
- package/dist/utilities/classes/key-prefixer/key-prefixer.contract.d.ts +1 -1
- package/dist/utilities/classes/key-prefixer/key-prefixer.d.ts +1 -1
- package/dist/utilities/classes/key-prefixer/key-prefixer.js +1 -1
- package/dist/utilities/classes/key-prefixer/key-prefixer.js.map +1 -1
- package/dist/utilities/functions/_module-exports.d.ts +7 -0
- package/dist/utilities/functions/_module-exports.js +8 -0
- package/dist/utilities/functions/_module-exports.js.map +1 -0
- package/dist/utilities/functions/factory.d.ts +44 -0
- package/dist/utilities/functions/factory.js +80 -0
- package/dist/utilities/functions/factory.js.map +1 -0
- package/dist/utilities/functions/get-constructor-name.d.ts +7 -0
- package/dist/utilities/functions/get-constructor-name.js +10 -0
- package/dist/utilities/functions/get-constructor-name.js.map +1 -0
- package/dist/utilities/functions/invokable.d.ts +20 -0
- package/dist/utilities/functions/invokable.js +33 -0
- package/dist/utilities/functions/invokable.js.map +1 -0
- package/dist/utilities/functions/is-nullable.d.ts +7 -0
- package/dist/utilities/functions/is-nullable.js +10 -0
- package/dist/utilities/functions/is-nullable.js.map +1 -0
- package/dist/utilities/functions/lazy.d.ts +20 -0
- package/dist/utilities/functions/lazy.js +39 -0
- package/dist/utilities/functions/lazy.js.map +1 -0
- package/dist/utilities/functions/object.d.ts +15 -0
- package/dist/utilities/functions/object.js +33 -0
- package/dist/utilities/functions/object.js.map +1 -0
- package/dist/utilities/functions/resolve-one-or-more.d.ts +12 -0
- package/dist/utilities/functions/resolve-one-or-more.js +25 -0
- package/dist/utilities/functions/resolve-one-or-more.js.map +1 -0
- package/dist/utilities/types/_module.d.ts +10 -0
- package/dist/utilities/types/_module.js +11 -0
- package/dist/utilities/types/_module.js.map +1 -0
- package/dist/utilities/types/async-iterable-value.type.d.ts +8 -0
- package/dist/utilities/types/async-iterable-value.type.js +5 -0
- package/dist/utilities/types/async-iterable-value.type.js.map +1 -0
- package/dist/utilities/types/at-least-one.type.d.ts +8 -0
- package/dist/utilities/types/at-least-one.type.js +5 -0
- package/dist/utilities/types/at-least-one.type.js.map +1 -0
- package/dist/utilities/types/factory.type.d.ts +49 -0
- package/dist/utilities/types/factory.type.js +5 -0
- package/dist/utilities/types/factory.type.js.map +1 -0
- package/dist/utilities/types/invokable.type.d.ts +20 -0
- package/dist/utilities/types/invokable.type.js +5 -0
- package/dist/utilities/types/invokable.type.js.map +1 -0
- package/dist/utilities/types/items.type.d.ts +8 -0
- package/dist/utilities/types/items.type.js +5 -0
- package/dist/utilities/types/items.type.js.map +1 -0
- package/dist/utilities/types/lazy.type.d.ts +31 -0
- package/dist/utilities/{types.js → types/lazy.type.js} +1 -1
- package/dist/utilities/types/lazy.type.js.map +1 -0
- package/dist/utilities/types/none-func.type.d.ts +8 -0
- package/dist/utilities/types/none-func.type.js +5 -0
- package/dist/utilities/types/none-func.type.js.map +1 -0
- package/dist/utilities/types/one-or-more.type.d.ts +8 -0
- package/dist/utilities/types/one-or-more.type.js +5 -0
- package/dist/utilities/types/one-or-more.type.js.map +1 -0
- package/dist/utilities/types/promiseable.type.d.ts +8 -0
- package/dist/utilities/types/promiseable.type.js +5 -0
- package/dist/utilities/types/promiseable.type.js.map +1 -0
- package/dist/utilities/types/result.type.d.ts +8 -0
- package/dist/utilities/types/result.type.js +5 -0
- package/dist/utilities/types/result.type.js.map +1 -0
- package/package.json +85 -25
- package/dist/collection/contracts/_shared.d.ts +0 -141
- package/dist/collection/contracts/_shared.js.map +0 -1
- package/dist/utilities/classes/pipeline/_module.d.ts +0 -1
- package/dist/utilities/classes/pipeline/_module.js +0 -2
- package/dist/utilities/classes/pipeline/_module.js.map +0 -1
- package/dist/utilities/classes/pipeline/pipeline.d.ts +0 -46
- package/dist/utilities/classes/pipeline/pipeline.js +0 -76
- package/dist/utilities/classes/pipeline/pipeline.js.map +0 -1
- package/dist/utilities/functions.d.ts +0 -57
- package/dist/utilities/functions.js +0 -123
- package/dist/utilities/functions.js.map +0 -1
- package/dist/utilities/types.d.ts +0 -104
- package/dist/utilities/types.js.map +0 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Collection
|
|
3
|
+
*/
|
|
4
|
+
import type { Invokable, Promisable } from "../../../utilities/_module-exports.js";
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* IMPORT_PATH: ```"@daiso-tech/core/collection/contracts"```
|
|
8
|
+
*/
|
|
9
|
+
export type Modifier<TInput, TOutput> = Invokable<[
|
|
10
|
+
collection: TInput
|
|
11
|
+
], TOutput>;
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* IMPORT_PATH: ```"@daiso-tech/core/collection/contracts"```
|
|
15
|
+
*/
|
|
16
|
+
export type AsyncModifier<TInput, TOutput> = Invokable<[
|
|
17
|
+
collection: TInput
|
|
18
|
+
], Promisable<TOutput>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modifier.type.js","sourceRoot":"","sources":["../../../../src/collection/contracts/_shared/modifier.type.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Collection
|
|
3
|
+
*/
|
|
4
|
+
import type { Invokable, Promisable } from "../../../utilities/_module-exports.js";
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* IMPORT_PATH: ```"@daiso-tech/core/collection/contracts"```
|
|
8
|
+
*/
|
|
9
|
+
export type PredicateFn<TInput, TCollection> = Invokable<[
|
|
10
|
+
item: TInput,
|
|
11
|
+
index: number,
|
|
12
|
+
collection: TCollection
|
|
13
|
+
], boolean>;
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
16
|
+
* IMPORT_PATH: ```"@daiso-tech/core/collection/contracts"```
|
|
17
|
+
*/
|
|
18
|
+
export type PredicateGuardFn<TInput, TCollection, TOutput extends TInput = TInput> = (item: TInput, index: number, collection: TCollection) => item is TOutput;
|
|
19
|
+
/**
|
|
20
|
+
*
|
|
21
|
+
* IMPORT_PATH: ```"@daiso-tech/core/collection/contracts"```
|
|
22
|
+
*/
|
|
23
|
+
export type PredicateGuardInvokableObject<TInput, TCollection, TOutput extends TInput = TInput> = {
|
|
24
|
+
invoke(item: TInput, index: number, collection: TCollection): item is TOutput;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
*
|
|
28
|
+
* IMPORT_PATH: ```"@daiso-tech/core/collection/contracts"```
|
|
29
|
+
*/
|
|
30
|
+
export type PredicateGuardInvokable<TInput, TCollection, TOutput extends TInput = TInput> = PredicateGuardFn<TInput, TCollection, TOutput> | PredicateGuardInvokableObject<TInput, TCollection, TOutput>;
|
|
31
|
+
/**
|
|
32
|
+
*
|
|
33
|
+
* IMPORT_PATH: ```"@daiso-tech/core/collection/contracts"```
|
|
34
|
+
*/
|
|
35
|
+
export type PredicateInvokable<TInput, TCollection, TOutput extends TInput = TInput> = PredicateFn<TInput, TCollection> | PredicateGuardInvokable<TInput, TCollection, TOutput>;
|
|
36
|
+
/**
|
|
37
|
+
*
|
|
38
|
+
* IMPORT_PATH: ```"@daiso-tech/core/collection/contracts"```
|
|
39
|
+
*/
|
|
40
|
+
export type AsyncPredicateInvokable<TInput, TCollection> = Invokable<[
|
|
41
|
+
item: TInput,
|
|
42
|
+
index: number,
|
|
43
|
+
collection: TCollection
|
|
44
|
+
], Promisable<boolean>>;
|
|
45
|
+
/**
|
|
46
|
+
*
|
|
47
|
+
* IMPORT_PATH: ```"@daiso-tech/core/collection/contracts"```
|
|
48
|
+
*/
|
|
49
|
+
export type AsyncPredicate<TInput, TCollection, TOutput extends TInput = TInput> = AsyncPredicateInvokable<TInput, TCollection> | PredicateGuardInvokable<TInput, TCollection, TOutput>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"predicate.type.js","sourceRoot":"","sources":["../../../../src/collection/contracts/_shared/predicate.type.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Collection
|
|
3
|
+
*/
|
|
4
|
+
import type { Invokable, Promisable } from "../../../utilities/_module-exports.js";
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* IMPORT_PATH: ```"@daiso-tech/core/collection/contracts"```
|
|
8
|
+
*/
|
|
9
|
+
export type Reduce<TInput, TCollection, TOutput> = Invokable<[
|
|
10
|
+
output: TOutput,
|
|
11
|
+
item: TInput,
|
|
12
|
+
index: number,
|
|
13
|
+
collection: TCollection
|
|
14
|
+
], TOutput>;
|
|
15
|
+
/**
|
|
16
|
+
*
|
|
17
|
+
* IMPORT_PATH: ```"@daiso-tech/core/collection/contracts"```
|
|
18
|
+
*/
|
|
19
|
+
export type AsyncReduce<TInput, TCollection, TOutput> = Invokable<[
|
|
20
|
+
output: TOutput,
|
|
21
|
+
item: TInput,
|
|
22
|
+
index: number,
|
|
23
|
+
collection: TCollection
|
|
24
|
+
], Promisable<TOutput>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reduce.type.js","sourceRoot":"","sources":["../../../../src/collection/contracts/_shared/reduce.type.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Collection
|
|
3
|
+
*/
|
|
4
|
+
import type { Invokable, Promisable } from "../../../utilities/_module-exports.js";
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* IMPORT_PATH: ```"@daiso-tech/core/collection/contracts"```
|
|
8
|
+
*/
|
|
9
|
+
export type Tap<TCollection> = Invokable<[collection: TCollection], void>;
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
* IMPORT_PATH: ```"@daiso-tech/core/collection/contracts"```
|
|
13
|
+
*/
|
|
14
|
+
export type AsyncTap<TCollection> = Invokable<[
|
|
15
|
+
collection: TCollection
|
|
16
|
+
], Promisable<void>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tap.type.js","sourceRoot":"","sources":["../../../../src/collection/contracts/_shared/tap.type.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Collection
|
|
3
|
+
*/
|
|
4
|
+
import type { Invokable, Promisable } from "../../../utilities/_module-exports.js";
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* IMPORT_PATH: ```"@daiso-tech/core/collection/contracts"```
|
|
8
|
+
*/
|
|
9
|
+
export type Transform<TInput, TOutput> = Invokable<[value: TInput], TOutput>;
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
* IMPORT_PATH: ```"@daiso-tech/core/collection/contracts"```
|
|
13
|
+
*/
|
|
14
|
+
export type AsyncTransform<TInput, TOutput> = Invokable<[
|
|
15
|
+
value: TInput
|
|
16
|
+
], Promisable<TOutput>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transform.type.js","sourceRoot":"","sources":["../../../../src/collection/contracts/_shared/transform.type.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module Collection
|
|
3
3
|
*/
|
|
4
|
-
import type { AsyncReduce, CrossJoinResult, AsyncPredicate, AsyncForEach, AsyncMap, AsyncModifier,
|
|
4
|
+
import type { AsyncReduce, CrossJoinResult, AsyncPredicate, AsyncForEach, AsyncMap, AsyncModifier, Tap, AsyncTransform, Comparator, EnsureRecord, EnsureMap } from "../../collection/contracts/_shared/_module.js";
|
|
5
5
|
import type { TimeSpan, AsyncLazyable, AsyncIterableValue } from "../../utilities/_module-exports.js";
|
|
6
6
|
import type { LazyPromise } from "../../async/_module-exports.js";
|
|
7
7
|
/**
|
|
@@ -690,7 +690,7 @@ export type IAsyncCollection<TInput = unknown> = AsyncIterable<TInput> & {
|
|
|
690
690
|
* }
|
|
691
691
|
* ```
|
|
692
692
|
*/
|
|
693
|
-
tap(callback:
|
|
693
|
+
tap(callback: Tap<IAsyncCollection<TInput>>): IAsyncCollection<TInput>;
|
|
694
694
|
/**
|
|
695
695
|
* The <i>chunk</i> method breaks the collection into multiple, smaller collections of size <i>chunkSize</i>.
|
|
696
696
|
* If <i>chunkSize</i> is not divisible with total number of items then the last chunk will contain the remaining items.
|
|
@@ -2177,7 +2177,7 @@ export type IAsyncCollection<TInput = unknown> = AsyncIterable<TInput> & {
|
|
|
2177
2177
|
*/
|
|
2178
2178
|
toRecord(): LazyPromise<EnsureRecord<TInput>>;
|
|
2179
2179
|
/**
|
|
2180
|
-
* The <i>toMap</i> method converts the collection to a new <i>{@link
|
|
2180
|
+
* The <i>toMap</i> method converts the collection to a new <i>{@link AsyncMap}</i>.
|
|
2181
2181
|
* An error will be thrown if item is not a tuple of size 2.
|
|
2182
2182
|
* @throws {TypeCollectionError} {@link TypeCollectionError}
|
|
2183
2183
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module Collection
|
|
3
3
|
*/
|
|
4
|
-
import type { Comparator,
|
|
4
|
+
import type { Comparator, PredicateInvokable, ForEach, Map, Modifier, Tap, Transform, Reduce, CrossJoinResult, EnsureMap, EnsureRecord } from "../../collection/contracts/_shared/_module.js";
|
|
5
5
|
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;
|
|
@@ -46,7 +46,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
46
46
|
* }
|
|
47
47
|
* ```
|
|
48
48
|
*/
|
|
49
|
-
filter<TOutput extends TInput>(predicateFn:
|
|
49
|
+
filter<TOutput extends TInput>(predicateFn: PredicateInvokable<TInput, ICollection<TInput>, TOutput>): ICollection<TOutput>;
|
|
50
50
|
/**
|
|
51
51
|
* The <i>reject</i> method filters the collection using <i>predicateFn</i>, keeping only those items that not pass <i>predicateFn</i>.
|
|
52
52
|
* @example
|
|
@@ -63,7 +63,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
63
63
|
* }
|
|
64
64
|
* ```
|
|
65
65
|
*/
|
|
66
|
-
reject<TOutput extends TInput>(predicateFn:
|
|
66
|
+
reject<TOutput extends TInput>(predicateFn: PredicateInvokable<TInput, ICollection<TInput>, TOutput>): ICollection<Exclude<TInput, TOutput>>;
|
|
67
67
|
/**
|
|
68
68
|
* The <i>map</i> method iterates through the collection and passes each item to <i>mapFn</i>.
|
|
69
69
|
* The <i>mapFn</i> is free to modify the item and return it, thus forming a new collection of modified items.
|
|
@@ -201,7 +201,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
201
201
|
* }
|
|
202
202
|
* ```
|
|
203
203
|
*/
|
|
204
|
-
change<TFilterOutput extends TInput, TMapOutput>(predicateFn:
|
|
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
206
|
* The <i>set</i> method changes a item by i>index</i> using <i>value</i>.
|
|
207
207
|
* @example
|
|
@@ -400,7 +400,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
400
400
|
* }
|
|
401
401
|
* ```
|
|
402
402
|
*/
|
|
403
|
-
percentage(predicateFn:
|
|
403
|
+
percentage(predicateFn: PredicateInvokable<TInput, ICollection<TInput>>): number;
|
|
404
404
|
/**
|
|
405
405
|
* The <i>some</i> method determines whether at least one item in the collection matches <i>predicateFn</i>.
|
|
406
406
|
* @example
|
|
@@ -416,7 +416,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
416
416
|
* }
|
|
417
417
|
* ```
|
|
418
418
|
*/
|
|
419
|
-
some<TOutput extends TInput>(predicateFn:
|
|
419
|
+
some<TOutput extends TInput>(predicateFn: PredicateInvokable<TInput, ICollection<TInput>, TOutput>): boolean;
|
|
420
420
|
/**
|
|
421
421
|
* The <i>every</i> method determines whether all items in the collection matches <i>predicateFn</i>.
|
|
422
422
|
* @example
|
|
@@ -432,7 +432,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
432
432
|
* }
|
|
433
433
|
* ```
|
|
434
434
|
*/
|
|
435
|
-
every<TOutput extends TInput>(predicateFn:
|
|
435
|
+
every<TOutput extends TInput>(predicateFn: PredicateInvokable<TInput, ICollection<TInput>, TOutput>): boolean;
|
|
436
436
|
/**
|
|
437
437
|
* The <i>take</i> method takes the first <i>limit</i> items.
|
|
438
438
|
* @example
|
|
@@ -480,7 +480,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
480
480
|
* }
|
|
481
481
|
* ```
|
|
482
482
|
*/
|
|
483
|
-
takeUntil(predicateFn:
|
|
483
|
+
takeUntil(predicateFn: PredicateInvokable<TInput, ICollection<TInput>>): ICollection<TInput>;
|
|
484
484
|
/**
|
|
485
485
|
* The <i>takeWhile</i> method takes items until <i>predicateFn</i> returns false.
|
|
486
486
|
* @example
|
|
@@ -497,7 +497,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
497
497
|
* }
|
|
498
498
|
* ```
|
|
499
499
|
*/
|
|
500
|
-
takeWhile(predicateFn:
|
|
500
|
+
takeWhile(predicateFn: PredicateInvokable<TInput, ICollection<TInput>>): ICollection<TInput>;
|
|
501
501
|
/**
|
|
502
502
|
* The <i>skip</i> method skips the first <i>offset</i> items.
|
|
503
503
|
* @example
|
|
@@ -531,7 +531,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
531
531
|
* }
|
|
532
532
|
* ```
|
|
533
533
|
*/
|
|
534
|
-
skipUntil(predicateFn:
|
|
534
|
+
skipUntil(predicateFn: PredicateInvokable<TInput, ICollection<TInput>>): ICollection<TInput>;
|
|
535
535
|
/**
|
|
536
536
|
* The <i>skipWhile</i> method skips items until <i>predicateFn</i> returns false.
|
|
537
537
|
* @example
|
|
@@ -548,7 +548,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
548
548
|
* }
|
|
549
549
|
* ```
|
|
550
550
|
*/
|
|
551
|
-
skipWhile(predicateFn:
|
|
551
|
+
skipWhile(predicateFn: PredicateInvokable<TInput, ICollection<TInput>>): ICollection<TInput>;
|
|
552
552
|
/**
|
|
553
553
|
* The <i>when</i> method will execute <i>callback</i> when <i>condition</i> evaluates to true.
|
|
554
554
|
* @example
|
|
@@ -730,7 +730,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
730
730
|
* }
|
|
731
731
|
* ```
|
|
732
732
|
*/
|
|
733
|
-
chunkWhile(predicateFn:
|
|
733
|
+
chunkWhile(predicateFn: PredicateInvokable<TInput, ICollection<TInput>>): ICollection<ICollection<TInput>>;
|
|
734
734
|
/**
|
|
735
735
|
* The <i>split</i> method breaks a collection evenly into <i>chunkAmount</i> of chunks.
|
|
736
736
|
* @example
|
|
@@ -794,7 +794,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
794
794
|
* }
|
|
795
795
|
* ```
|
|
796
796
|
*/
|
|
797
|
-
partition(predicateFn:
|
|
797
|
+
partition(predicateFn: PredicateInvokable<TInput, ICollection<TInput>>): ICollection<ICollection<TInput>>;
|
|
798
798
|
/**
|
|
799
799
|
* The <i>sliding</i> method returns a new collection of chunks representing a "sliding window" view of the items in the collection.
|
|
800
800
|
* @example
|
|
@@ -1261,7 +1261,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1261
1261
|
* }
|
|
1262
1262
|
* ```
|
|
1263
1263
|
*/
|
|
1264
|
-
insertBefore<TExtended = TInput>(predicateFn:
|
|
1264
|
+
insertBefore<TExtended = TInput>(predicateFn: PredicateInvokable<TInput, ICollection<TInput>>, iterable: Iterable<TInput | TExtended>): ICollection<TInput | TExtended>;
|
|
1265
1265
|
/**
|
|
1266
1266
|
* The <i>insertAfter</i> method adds <i>iterable</i> after the first item that matches <i>predicateFn</i>.
|
|
1267
1267
|
* @example
|
|
@@ -1278,7 +1278,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1278
1278
|
* }
|
|
1279
1279
|
* ```
|
|
1280
1280
|
*/
|
|
1281
|
-
insertAfter<TExtended = TInput>(predicateFn:
|
|
1281
|
+
insertAfter<TExtended = TInput>(predicateFn: PredicateInvokable<TInput, ICollection<TInput>>, iterable: Iterable<TInput | TExtended>): ICollection<TInput | TExtended>;
|
|
1282
1282
|
/**
|
|
1283
1283
|
* The <i>crossJoin</i> method cross joins the collection's values among <i>iterables</i>, returning a Cartesian product with all possible permutations.
|
|
1284
1284
|
* @example
|
|
@@ -1476,7 +1476,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1476
1476
|
* ```
|
|
1477
1477
|
* // 3
|
|
1478
1478
|
*/
|
|
1479
|
-
first<TOutput extends TInput>(predicateFn?:
|
|
1479
|
+
first<TOutput extends TInput>(predicateFn?: PredicateInvokable<TInput, ICollection<TInput>, TOutput>): TOutput | null;
|
|
1480
1480
|
/**
|
|
1481
1481
|
* The <i>firstOr</i> method returns the first item in the collection that passes <i> predicateFn </i>
|
|
1482
1482
|
* By default it will get the first item. If the collection is empty or no items passes <i> predicateFn </i> than <i> defaultValue </i>.
|
|
@@ -1529,7 +1529,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1529
1529
|
* }
|
|
1530
1530
|
* ```
|
|
1531
1531
|
*/
|
|
1532
|
-
firstOr<TOutput extends TInput, TExtended = TInput>(defaultValue: Lazyable<TExtended>, predicateFn?:
|
|
1532
|
+
firstOr<TOutput extends TInput, TExtended = TInput>(defaultValue: Lazyable<TExtended>, predicateFn?: PredicateInvokable<TInput, ICollection<TInput>, TOutput>): TOutput | TExtended;
|
|
1533
1533
|
/**
|
|
1534
1534
|
* The <i>firstOrFail</i> method returns the first item in the collection that passes <i> predicateFn </i>.
|
|
1535
1535
|
* By default it will get the first item. If the collection is empty or no items passes <i> predicateFn </i> than error is thrown.
|
|
@@ -1571,7 +1571,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1571
1571
|
* }
|
|
1572
1572
|
* ```
|
|
1573
1573
|
*/
|
|
1574
|
-
firstOrFail<TOutput extends TInput>(predicateFn?:
|
|
1574
|
+
firstOrFail<TOutput extends TInput>(predicateFn?: PredicateInvokable<TInput, ICollection<TInput>, TOutput>): TOutput;
|
|
1575
1575
|
/**
|
|
1576
1576
|
* The <i>last</i> method returns the last item in the collection that passes <i> predicateFn </i>.
|
|
1577
1577
|
* By default it will get the last item. If the collection is empty or no items passes <i> predicateFn </i> than null i returned.
|
|
@@ -1612,7 +1612,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1612
1612
|
* }
|
|
1613
1613
|
* ```
|
|
1614
1614
|
*/
|
|
1615
|
-
last<TOutput extends TInput>(predicateFn?:
|
|
1615
|
+
last<TOutput extends TInput>(predicateFn?: PredicateInvokable<TInput, ICollection<TInput>, TOutput>): TOutput | null;
|
|
1616
1616
|
/**
|
|
1617
1617
|
* The <i>lastOr</i> method returns the last item in the collection that passes <i> predicateFn </i>.
|
|
1618
1618
|
* By default it will get the last item. If the collection is empty or no items passes <i> predicateFn </i> than <i> defaultValue </i>.
|
|
@@ -1665,7 +1665,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1665
1665
|
* }
|
|
1666
1666
|
* ```
|
|
1667
1667
|
*/
|
|
1668
|
-
lastOr<TOutput extends TInput, TExtended = TInput>(defaultValue: Lazyable<TExtended>, predicateFn?:
|
|
1668
|
+
lastOr<TOutput extends TInput, TExtended = TInput>(defaultValue: Lazyable<TExtended>, predicateFn?: PredicateInvokable<TInput, ICollection<TInput>, TOutput>): TOutput | TExtended;
|
|
1669
1669
|
/**
|
|
1670
1670
|
* The <i>lastOrFail</i> method returns the last item in the collection that passes <i> predicateFn </i>.
|
|
1671
1671
|
* By default it will get the last item. If the collection is empty or no items passes <i> predicateFn </i> than error is thrown.
|
|
@@ -1707,7 +1707,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1707
1707
|
* }
|
|
1708
1708
|
* ```
|
|
1709
1709
|
*/
|
|
1710
|
-
lastOrFail<TOutput extends TInput>(predicateFn?:
|
|
1710
|
+
lastOrFail<TOutput extends TInput>(predicateFn?: PredicateInvokable<TInput, ICollection<TInput>, TOutput>): TOutput;
|
|
1711
1711
|
/**
|
|
1712
1712
|
* The <i>before</i> method returns the item that comes before the first item that matches <i>predicateFn</i>.
|
|
1713
1713
|
* If the <i>predicateFn</i> does not match or matches the first item then null is returned.
|
|
@@ -1736,7 +1736,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1736
1736
|
* }
|
|
1737
1737
|
* ```
|
|
1738
1738
|
*/
|
|
1739
|
-
before(predicateFn:
|
|
1739
|
+
before(predicateFn: PredicateInvokable<TInput, ICollection<TInput>>): TInput | null;
|
|
1740
1740
|
/**
|
|
1741
1741
|
* The <i>beforeOr</i> method returns the item that comes before the first item that matches <i>predicateFn</i>.
|
|
1742
1742
|
* If the collection is empty or the <i>predicateFn</i> does not match or matches the first item then <i>defaultValue</i> is returned.
|
|
@@ -1777,7 +1777,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1777
1777
|
* }
|
|
1778
1778
|
* ```
|
|
1779
1779
|
*/
|
|
1780
|
-
beforeOr<TExtended = TInput>(defaultValue: Lazyable<TExtended>, predicateFn:
|
|
1780
|
+
beforeOr<TExtended = TInput>(defaultValue: Lazyable<TExtended>, predicateFn: PredicateInvokable<TInput, ICollection<TInput>>): TInput | TExtended;
|
|
1781
1781
|
/**
|
|
1782
1782
|
* The <i>beforeOrFail</i> method returns the item that comes before the first item that matches <i>predicateFn</i>.
|
|
1783
1783
|
* If the collection is empty or the <i>predicateFn</i> does not match or matches the first item then an error is thrown.
|
|
@@ -1807,7 +1807,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1807
1807
|
* }
|
|
1808
1808
|
* ```
|
|
1809
1809
|
*/
|
|
1810
|
-
beforeOrFail(predicateFn:
|
|
1810
|
+
beforeOrFail(predicateFn: PredicateInvokable<TInput, ICollection<TInput>>): TInput;
|
|
1811
1811
|
/**
|
|
1812
1812
|
* The <i>after</i> method returns the item that comes after the first item that matches <i>predicateFn</i>.
|
|
1813
1813
|
* If the collection is empty or the <i>predicateFn</i> does not match or matches the last item then null is returned.
|
|
@@ -1836,7 +1836,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1836
1836
|
* }
|
|
1837
1837
|
* ```
|
|
1838
1838
|
*/
|
|
1839
|
-
after(predicateFn:
|
|
1839
|
+
after(predicateFn: PredicateInvokable<TInput, ICollection<TInput>>): TInput | null;
|
|
1840
1840
|
/**
|
|
1841
1841
|
* The <i>afterOr</i> method returns the item that comes after the first item that matches <i>predicateFn</i>.
|
|
1842
1842
|
* If the collection is empty or the <i>predicateFn</i> does not match or matches the last item then <i>defaultValue</i> is returned.
|
|
@@ -1877,7 +1877,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1877
1877
|
* }
|
|
1878
1878
|
* ```
|
|
1879
1879
|
*/
|
|
1880
|
-
afterOr<TExtended = TInput>(defaultValue: Lazyable<TExtended>, predicateFn:
|
|
1880
|
+
afterOr<TExtended = TInput>(defaultValue: Lazyable<TExtended>, predicateFn: PredicateInvokable<TInput, ICollection<TInput>>): TInput | TExtended;
|
|
1881
1881
|
/**
|
|
1882
1882
|
* The <i>afterOrFail</i> method returns the item that comes after the first item that matches <i>predicateFn</i>.
|
|
1883
1883
|
* If the collection is empty or the <i>predicateFn</i> does not match or matches the last item then an error is thrown.
|
|
@@ -1907,7 +1907,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1907
1907
|
* }
|
|
1908
1908
|
* ```
|
|
1909
1909
|
*/
|
|
1910
|
-
afterOrFail(predicateFn:
|
|
1910
|
+
afterOrFail(predicateFn: PredicateInvokable<TInput, ICollection<TInput>>): TInput;
|
|
1911
1911
|
/**
|
|
1912
1912
|
* 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.
|
|
1913
1913
|
* If no items matches or multiple items are found an error will be thrown.
|
|
@@ -1950,7 +1950,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1950
1950
|
* }
|
|
1951
1951
|
* ```
|
|
1952
1952
|
*/
|
|
1953
|
-
sole<TOutput extends TInput>(predicateFn:
|
|
1953
|
+
sole<TOutput extends TInput>(predicateFn: PredicateInvokable<TInput, ICollection<TInput>, TOutput>): TOutput;
|
|
1954
1954
|
/**
|
|
1955
1955
|
* The <i>nth</i> method creates a new collection consisting of every n-th item.
|
|
1956
1956
|
* @example
|
|
@@ -1983,7 +1983,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1983
1983
|
* }
|
|
1984
1984
|
* ```
|
|
1985
1985
|
*/
|
|
1986
|
-
count(predicateFn:
|
|
1986
|
+
count(predicateFn: PredicateInvokable<TInput, ICollection<TInput>>): number;
|
|
1987
1987
|
/**
|
|
1988
1988
|
* The <i>size</i> returns the size of the collection.
|
|
1989
1989
|
*/
|
|
@@ -2011,7 +2011,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
2011
2011
|
* }
|
|
2012
2012
|
* ```
|
|
2013
2013
|
*/
|
|
2014
|
-
searchFirst(predicateFn:
|
|
2014
|
+
searchFirst(predicateFn: PredicateInvokable<TInput, ICollection<TInput>>): number;
|
|
2015
2015
|
/**
|
|
2016
2016
|
* The <i>searchLast</i> return the index of the last item that matches <i>predicateFn</i>.
|
|
2017
2017
|
* @example
|
|
@@ -2027,7 +2027,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
2027
2027
|
* }
|
|
2028
2028
|
* ```
|
|
2029
2029
|
*/
|
|
2030
|
-
searchLast(predicateFn:
|
|
2030
|
+
searchLast(predicateFn: PredicateInvokable<TInput, ICollection<TInput>>): number;
|
|
2031
2031
|
/**
|
|
2032
2032
|
* The <i>forEach</i> method iterates through all items in the collection.
|
|
2033
2033
|
*/
|
|
@@ -59,7 +59,7 @@ export declare class EmptyCollectionError extends CollectionError {
|
|
|
59
59
|
constructor(message: string, cause?: unknown);
|
|
60
60
|
}
|
|
61
61
|
/**
|
|
62
|
-
* The <i>registerCollectionErrorsToSerde</i> function registers all <i>ICollection</i>
|
|
62
|
+
* The <i>registerCollectionErrorsToSerde</i> function registers all <i>ICollection</i> related errors with <i>IFlexibleSerde</i>, ensuring they will properly be serialized and deserialized.
|
|
63
63
|
*
|
|
64
64
|
* IMPORT_PATH: ```"@daiso-tech/core/collection/contracts"```
|
|
65
65
|
* @group Errors
|
|
@@ -94,7 +94,7 @@ export class EmptyCollectionError extends CollectionError {
|
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
/**
|
|
97
|
-
* The <i>registerCollectionErrorsToSerde</i> function registers all <i>ICollection</i>
|
|
97
|
+
* The <i>registerCollectionErrorsToSerde</i> function registers all <i>ICollection</i> related errors with <i>IFlexibleSerde</i>, ensuring they will properly be serialized and deserialized.
|
|
98
98
|
*
|
|
99
99
|
* IMPORT_PATH: ```"@daiso-tech/core/collection/contracts"```
|
|
100
100
|
* @group Errors
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @module Collection
|
|
3
3
|
*/
|
|
4
4
|
import {} from "../../../../collection/contracts/_module-exports.js";
|
|
5
|
-
import {} from "../../../../utilities/_module-exports.js";
|
|
5
|
+
import { resolveInvokable, } from "../../../../utilities/_module-exports.js";
|
|
6
6
|
/**
|
|
7
7
|
* @internal
|
|
8
8
|
*/
|
|
@@ -21,7 +21,7 @@ export class AsyncChunkWhileIterable {
|
|
|
21
21
|
if (index === 0) {
|
|
22
22
|
array.push(item);
|
|
23
23
|
}
|
|
24
|
-
else if (await this.predicateFn(item, index, this.makeCollection(array))) {
|
|
24
|
+
else if (await resolveInvokable(this.predicateFn)(item, index, this.makeCollection(array))) {
|
|
25
25
|
array.push(item);
|
|
26
26
|
}
|
|
27
27
|
else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"async-chunk-while-iterable.js","sourceRoot":"","sources":["../../../../../src/collection/implementations/async-iterable-collection/_shared/async-chunk-while-iterable.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAGN,MAAM,2CAA2C,CAAC;AACnD,OAAO,
|
|
1
|
+
{"version":3,"file":"async-chunk-while-iterable.js","sourceRoot":"","sources":["../../../../../src/collection/implementations/async-iterable-collection/_shared/async-chunk-while-iterable.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAGN,MAAM,2CAA2C,CAAC;AACnD,OAAO,EACH,gBAAgB,GAEnB,MAAM,gCAAgC,CAAC;AAExC;;GAEG;AACH,MAAM,OAAO,uBAAuB;IAIpB;IACA;IAEA;IAJZ,YACY,UAAoC,EACpC,WAA6D,EAE7D,cAEqB;QALrB,eAAU,GAAV,UAAU,CAA0B;QACpC,gBAAW,GAAX,WAAW,CAAkD;QAE7D,mBAAc,GAAd,cAAc,CAEO;IAC9B,CAAC;IAEJ,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC;QACzB,MAAM,KAAK,GAAa,EAAE,CAAC;QAC3B,IAAI,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC;YAC1D,IAAI,KAAK,KAAK,CAAC,EAAE,CAAC;gBACd,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACrB,CAAC;iBAAM,IACH,MAAM,gBAAgB,CAAC,IAAI,CAAC,WAAW,CAAC,CACpC,IAAI,EACJ,KAAK,EACL,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,CAC7B,EACH,CAAC;gBACC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACrB,CAAC;iBAAM,CAAC;gBACJ,MAAM,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;gBACjC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;gBACjB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACrB,CAAC;QACL,CAAC;QACD,MAAM,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IACrC,CAAC;CACJ"}
|
package/dist/collection/implementations/async-iterable-collection/_shared/async-count-by-iterable.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* @module Collection
|
|
3
3
|
*/
|
|
4
4
|
import {} from "../../../../collection/contracts/_module-exports.js";
|
|
5
|
+
import { resolveInvokable } from "../../../../utilities/_module-exports.js";
|
|
5
6
|
/**
|
|
6
7
|
* @internal
|
|
7
8
|
*/
|
|
@@ -15,7 +16,7 @@ export class AsyncCountByIterable {
|
|
|
15
16
|
async *[Symbol.asyncIterator]() {
|
|
16
17
|
const map = new Map();
|
|
17
18
|
for await (const [index, item] of this.collection.entries()) {
|
|
18
|
-
const key = await this.callback(item, index, this.collection);
|
|
19
|
+
const key = await resolveInvokable(this.callback)(item, index, this.collection);
|
|
19
20
|
if (!map.has(key)) {
|
|
20
21
|
map.set(key, 0);
|
|
21
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"async-count-by-iterable.js","sourceRoot":"","sources":["../../../../../src/collection/implementations/async-iterable-collection/_shared/async-count-by-iterable.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAGN,MAAM,2CAA2C,CAAC;
|
|
1
|
+
{"version":3,"file":"async-count-by-iterable.js","sourceRoot":"","sources":["../../../../../src/collection/implementations/async-iterable-collection/_shared/async-count-by-iterable.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAGN,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAElE;;GAEG;AACH,MAAM,OAAO,oBAAoB;IAIjB;IACA;IAFZ,YACY,UAAoC,EACpC,WAIJ,CAAC,IAAI,EAAE,EAAE,CAAC,IAA0B;QALhC,eAAU,GAAV,UAAU,CAA0B;QACpC,aAAQ,GAAR,QAAQ,CAIwB;IACzC,CAAC;IAEJ,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC;QACzB,MAAM,GAAG,GAAG,IAAI,GAAG,EAAmB,CAAC;QACvC,IAAI,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC;YAC1D,MAAM,GAAG,GAAG,MAAM,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAC7C,IAAI,EACJ,KAAK,EACL,IAAI,CAAC,UAAU,CAClB,CAAC;YACF,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;gBAChB,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;YACpB,CAAC;YACD,MAAM,OAAO,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAC7B,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;gBACxB,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,GAAG,CAAC,CAAC,CAAC;YAC9B,CAAC;QACL,CAAC;QACD,KAAK,CAAC,CAAC,GAAG,CAAC;IACf,CAAC;CACJ"}
|
package/dist/collection/implementations/async-iterable-collection/_shared/async-filter-iterable.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* @module Collection
|
|
3
3
|
*/
|
|
4
4
|
import {} from "../../../../collection/contracts/_module-exports.js";
|
|
5
|
+
import { resolveInvokable } from "../../../../utilities/_module-exports.js";
|
|
5
6
|
/**
|
|
6
7
|
* @internal
|
|
7
8
|
*/
|
|
@@ -14,7 +15,7 @@ export class AsyncFilterIterable {
|
|
|
14
15
|
}
|
|
15
16
|
async *[Symbol.asyncIterator]() {
|
|
16
17
|
for await (const [index, item] of this.collection.entries()) {
|
|
17
|
-
if (await this.predicateFn(item, index, this.collection)) {
|
|
18
|
+
if (await resolveInvokable(this.predicateFn)(item, index, this.collection)) {
|
|
18
19
|
yield item;
|
|
19
20
|
}
|
|
20
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"async-filter-iterable.js","sourceRoot":"","sources":["../../../../../src/collection/implementations/async-iterable-collection/_shared/async-filter-iterable.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAGN,MAAM,2CAA2C,CAAC;
|
|
1
|
+
{"version":3,"file":"async-filter-iterable.js","sourceRoot":"","sources":["../../../../../src/collection/implementations/async-iterable-collection/_shared/async-filter-iterable.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAGN,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAElE;;GAEG;AACH,MAAM,OAAO,mBAAmB;IAIhB;IACA;IAFZ,YACY,UAAoC,EACpC,WAIP;QALO,eAAU,GAAV,UAAU,CAA0B;QACpC,gBAAW,GAAX,WAAW,CAIlB;IACF,CAAC;IAEJ,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC;QACzB,IAAI,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC;YAC1D,IACI,MAAM,gBAAgB,CAAC,IAAI,CAAC,WAAW,CAAC,CACpC,IAAI,EACJ,KAAK,EACL,IAAI,CAAC,UAAU,CAClB,EACH,CAAC;gBACC,MAAM,IAAe,CAAC;YAC1B,CAAC;QACL,CAAC;IACL,CAAC;CACJ"}
|
package/dist/collection/implementations/async-iterable-collection/_shared/async-flat-map-iterable.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* @module Collection
|
|
3
3
|
*/
|
|
4
4
|
import {} from "../../../../collection/contracts/_module-exports.js";
|
|
5
|
+
import { resolveInvokable } from "../../../../utilities/_module-exports.js";
|
|
5
6
|
/**
|
|
6
7
|
* @internal
|
|
7
8
|
*/
|
|
@@ -14,7 +15,7 @@ export class AsyncFlatMapIterable {
|
|
|
14
15
|
}
|
|
15
16
|
async *[Symbol.asyncIterator]() {
|
|
16
17
|
for await (const [index, item] of this.collection.entries()) {
|
|
17
|
-
yield* await this.mapFn(item, index, this.collection);
|
|
18
|
+
yield* await resolveInvokable(this.mapFn)(item, index, this.collection);
|
|
18
19
|
}
|
|
19
20
|
}
|
|
20
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"async-flat-map-iterable.js","sourceRoot":"","sources":["../../../../../src/collection/implementations/async-iterable-collection/_shared/async-flat-map-iterable.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAGN,MAAM,2CAA2C,CAAC;
|
|
1
|
+
{"version":3,"file":"async-flat-map-iterable.js","sourceRoot":"","sources":["../../../../../src/collection/implementations/async-iterable-collection/_shared/async-flat-map-iterable.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAGN,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAElE;;GAEG;AACH,MAAM,OAAO,oBAAoB;IAIjB;IACA;IAFZ,YACY,UAAoC,EACpC,KAIP;QALO,eAAU,GAAV,UAAU,CAA0B;QACpC,UAAK,GAAL,KAAK,CAIZ;IACF,CAAC;IAEJ,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC;QACzB,IAAI,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC;YAC1D,KAAK,CAAC,CAAC,MAAM,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,CACrC,IAAI,EACJ,KAAK,EACL,IAAI,CAAC,UAAU,CAClB,CAAC;QACN,CAAC;IACL,CAAC;CACJ"}
|
package/dist/collection/implementations/async-iterable-collection/_shared/async-group-by-iterable.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @module Collection
|
|
3
3
|
*/
|
|
4
4
|
import {} from "../../../../collection/contracts/_module-exports.js";
|
|
5
|
-
import {} from "../../../../utilities/_module-exports.js";
|
|
5
|
+
import { resolveInvokable, } from "../../../../utilities/_module-exports.js";
|
|
6
6
|
/**
|
|
7
7
|
* @internal
|
|
8
8
|
*/
|
|
@@ -18,7 +18,7 @@ export class AsyncGroupByIterable {
|
|
|
18
18
|
async *[Symbol.asyncIterator]() {
|
|
19
19
|
const map = new Map();
|
|
20
20
|
for await (const [index, item] of this.collection.entries()) {
|
|
21
|
-
const key = await this.selectFn(item, index, this.collection);
|
|
21
|
+
const key = await resolveInvokable(this.selectFn)(item, index, this.collection);
|
|
22
22
|
let array = map.get(key);
|
|
23
23
|
if (array === undefined) {
|
|
24
24
|
array = [];
|