@daiso-tech/core 0.35.4 → 0.37.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 +22 -54
- package/dist/async/backof-policies/_shared.d.ts +8 -2
- package/dist/async/backof-policies/_shared.js +0 -1
- package/dist/async/backof-policies/_shared.js.map +1 -1
- package/dist/async/backof-policies/constant-backoff-policy/constant-backoff-policy.d.ts +3 -3
- package/dist/async/backof-policies/constant-backoff-policy/constant-backoff-policy.js +10 -4
- package/dist/async/backof-policies/constant-backoff-policy/constant-backoff-policy.js.map +1 -1
- package/dist/async/backof-policies/exponential-backoff-policy/exponential-backoff-policy.d.ts +3 -3
- package/dist/async/backof-policies/exponential-backoff-policy/exponential-backoff-policy.js +10 -4
- package/dist/async/backof-policies/exponential-backoff-policy/exponential-backoff-policy.js.map +1 -1
- package/dist/async/backof-policies/linear-backoff-policy/linear-backoff-policy.d.ts +3 -3
- package/dist/async/backof-policies/linear-backoff-policy/linear-backoff-policy.js +10 -4
- package/dist/async/backof-policies/linear-backoff-policy/linear-backoff-policy.js.map +1 -1
- package/dist/async/backof-policies/polynomial-backoff-policy/polynomial-backoff-policy.d.ts +3 -3
- package/dist/async/backof-policies/polynomial-backoff-policy/polynomial-backoff-policy.js +10 -4
- package/dist/async/backof-policies/polynomial-backoff-policy/polynomial-backoff-policy.js.map +1 -1
- package/dist/async/middlewares/_shared.d.ts +6 -1
- package/dist/async/middlewares/_shared.js +11 -1
- package/dist/async/middlewares/_shared.js.map +1 -1
- package/dist/async/middlewares/fallback/fallback.middleware.d.ts +3 -3
- package/dist/async/middlewares/fallback/fallback.middleware.js +3 -2
- package/dist/async/middlewares/fallback/fallback.middleware.js.map +1 -1
- package/dist/async/middlewares/hedging/_shared.d.ts +7 -7
- package/dist/async/middlewares/hedging/concurrent-hedging/concurrent-hedging.middleware.js +7 -7
- package/dist/async/middlewares/hedging/concurrent-hedging/concurrent-hedging.middleware.js.map +1 -1
- package/dist/async/middlewares/hedging/sequential-hedging/sequential-hedging.middleware.js +6 -6
- package/dist/async/middlewares/hedging/sequential-hedging/sequential-hedging.middleware.js.map +1 -1
- package/dist/async/middlewares/observe/observe.middleware.d.ts +4 -4
- package/dist/async/middlewares/retry/retry.middleware.d.ts +5 -4
- package/dist/async/middlewares/retry/retry.middleware.js +10 -10
- package/dist/async/middlewares/retry/retry.middleware.js.map +1 -1
- package/dist/async/middlewares/timeout/timeout.middleware.d.ts +4 -2
- package/dist/async/middlewares/timeout/timeout.middleware.js +3 -1
- package/dist/async/middlewares/timeout/timeout.middleware.js.map +1 -1
- package/dist/async/utilities/lazy-promise/lazy-promise.d.ts +1 -1
- package/dist/async/utilities/lazy-promise/lazy-promise.js +1 -1
- package/dist/async/utilities/promise-queue/promise-queue.js.map +1 -1
- package/dist/cache/contracts/cache-factory.contract.d.ts +2 -2
- package/dist/cache/contracts/cache.errors.d.ts +3 -3
- package/dist/cache/contracts/cache.errors.js +1 -1
- package/dist/cache/contracts/cache.errors.js.map +1 -1
- package/dist/cache/implementations/adapters/_module-exports.d.ts +1 -2
- package/dist/cache/implementations/adapters/_module-exports.js +1 -2
- package/dist/cache/implementations/adapters/_module-exports.js.map +1 -1
- package/dist/cache/implementations/adapters/kysely-cache-adapter/kysely-cache-adapter.d.ts +41 -16
- package/dist/cache/implementations/adapters/kysely-cache-adapter/kysely-cache-adapter.js +102 -57
- package/dist/cache/implementations/adapters/kysely-cache-adapter/kysely-cache-adapter.js.map +1 -1
- package/dist/cache/implementations/adapters/memory-cache-adapter/memory-cache-adapter.d.ts +1 -1
- 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 -1
- package/dist/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter.js.map +1 -1
- package/dist/cache/implementations/adapters/no-op-cache-adapter/no-op-cache-adapter.d.ts +1 -1
- package/dist/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.d.ts +1 -1
- package/dist/cache/implementations/adapters/redis-cache-adapter/redis-cache-adapter.js.map +1 -1
- package/dist/cache/implementations/derivables/cache/cache.d.ts +27 -11
- package/dist/cache/implementations/derivables/cache/cache.js +38 -34
- package/dist/cache/implementations/derivables/cache/cache.js.map +1 -1
- package/dist/cache/implementations/derivables/cache-factory/cache-factory.d.ts +15 -47
- package/dist/cache/implementations/derivables/cache-factory/cache-factory.js +19 -45
- package/dist/cache/implementations/derivables/cache-factory/cache-factory.js.map +1 -1
- package/dist/cache/implementations/test-utilities/cache.test-suite.d.ts +4 -5
- package/dist/cache/implementations/test-utilities/cache.test-suite.js +4 -5
- package/dist/cache/implementations/test-utilities/cache.test-suite.js.map +1 -1
- package/dist/collection/contracts/async-collection.contract.d.ts +127 -121
- package/dist/collection/contracts/collection.contract.d.ts +126 -120
- package/dist/collection/contracts/collection.errors.d.ts +3 -3
- package/dist/collection/contracts/collection.errors.js +1 -1
- package/dist/collection/contracts/collection.errors.js.map +1 -1
- package/dist/collection/implementations/_shared.d.ts +4 -4
- package/dist/collection/implementations/_shared.js +2 -2
- package/dist/collection/implementations/_shared.js.map +1 -1
- package/dist/collection/implementations/async-iterable-collection/_shared/_module.d.ts +1 -0
- package/dist/collection/implementations/async-iterable-collection/_shared/_module.js +1 -0
- package/dist/collection/implementations/async-iterable-collection/_shared/_module.js.map +1 -1
- package/dist/collection/implementations/async-iterable-collection/_shared/async-validate-iterable.d.ts +7 -0
- package/dist/collection/implementations/async-iterable-collection/_shared/async-validate-iterable.js +17 -0
- package/dist/collection/implementations/async-iterable-collection/_shared/async-validate-iterable.js.map +1 -0
- package/dist/collection/implementations/async-iterable-collection/async-iterable-collection.d.ts +15 -13
- package/dist/collection/implementations/async-iterable-collection/async-iterable-collection.js +19 -16
- package/dist/collection/implementations/async-iterable-collection/async-iterable-collection.js.map +1 -1
- package/dist/collection/implementations/iterable-collection/_shared/_module.d.ts +1 -0
- package/dist/collection/implementations/iterable-collection/_shared/_module.js +1 -0
- package/dist/collection/implementations/iterable-collection/_shared/_module.js.map +1 -1
- package/dist/collection/implementations/iterable-collection/_shared/validate-iterable.d.ts +7 -0
- package/dist/collection/implementations/iterable-collection/_shared/validate-iterable.js +21 -0
- package/dist/collection/implementations/iterable-collection/_shared/validate-iterable.js.map +1 -0
- package/dist/collection/implementations/iterable-collection/iterable-collection.d.ts +14 -12
- package/dist/collection/implementations/iterable-collection/iterable-collection.js +16 -13
- package/dist/collection/implementations/iterable-collection/iterable-collection.js.map +1 -1
- package/dist/collection/implementations/list-collection/list-collection.d.ts +14 -12
- package/dist/collection/implementations/list-collection/list-collection.js +26 -13
- package/dist/collection/implementations/list-collection/list-collection.js.map +1 -1
- package/dist/event-bus/contracts/event-bus-factory.contract.d.ts +2 -2
- package/dist/event-bus/contracts/event-bus.contract.d.ts +2 -2
- package/dist/event-bus/contracts/event-bus.errors.d.ts +3 -3
- package/dist/event-bus/contracts/event-bus.errors.js +1 -1
- package/dist/event-bus/contracts/event-bus.errors.js.map +1 -1
- package/dist/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter.d.ts +1 -1
- package/dist/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter.js +1 -1
- package/dist/event-bus/implementations/derivables/event-bus/event-bus.d.ts +46 -9
- package/dist/event-bus/implementations/derivables/event-bus/event-bus.js +64 -22
- 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 +12 -41
- package/dist/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.js +15 -35
- package/dist/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.js.map +1 -1
- package/dist/lock/contracts/lock.errors.d.ts +2 -2
- package/dist/lock/contracts/lock.errors.js.map +1 -1
- package/dist/lock/implementations/adapters/_module-exports.d.ts +1 -2
- package/dist/lock/implementations/adapters/_module-exports.js +1 -2
- package/dist/lock/implementations/adapters/_module-exports.js.map +1 -1
- package/dist/lock/implementations/adapters/kysely-lock-adapter/kysely-lock-adapter.d.ts +40 -15
- package/dist/lock/implementations/adapters/kysely-lock-adapter/kysely-lock-adapter.js +75 -34
- package/dist/lock/implementations/adapters/kysely-lock-adapter/kysely-lock-adapter.js.map +1 -1
- package/dist/lock/implementations/adapters/mongodb-lock-adapter/mongodb-lock-adapter.d.ts +6 -3
- package/dist/lock/implementations/adapters/mongodb-lock-adapter/mongodb-lock-adapter.js +1 -1
- package/dist/lock/implementations/adapters/mongodb-lock-adapter/mongodb-lock-adapter.js.map +1 -1
- package/dist/lock/implementations/derivables/lock-provider/lock-provider.d.ts +22 -18
- package/dist/lock/implementations/derivables/lock-provider/lock-provider.js +20 -22
- 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 +3 -3
- package/dist/lock/implementations/derivables/lock-provider/lock-serde-transformer.js +12 -6
- package/dist/lock/implementations/derivables/lock-provider/lock-serde-transformer.js.map +1 -1
- package/dist/lock/implementations/derivables/lock-provider/lock.d.ts +4 -2
- package/dist/lock/implementations/derivables/lock-provider/lock.js +16 -18
- 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 +6 -50
- package/dist/lock/implementations/derivables/lock-provider-factory/lock-provider-factory.js +10 -54
- package/dist/lock/implementations/derivables/lock-provider-factory/lock-provider-factory.js.map +1 -1
- package/dist/lock/implementations/test-utilities/lock-provider.test-suite.d.ts +1 -9
- package/dist/lock/implementations/test-utilities/lock-provider.test-suite.js +1 -9
- package/dist/lock/implementations/test-utilities/lock-provider.test-suite.js.map +1 -1
- package/dist/serde/contracts/flexible-serde.contract.d.ts +9 -2
- package/dist/serde/implementations/adapters/super-json-serde-adapter/super-json-serde-adapter.js +1 -1
- package/dist/serde/implementations/adapters/super-json-serde-adapter/super-json-serde-adapter.js.map +1 -1
- 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/hooks.d.ts +2 -2
- package/dist/utilities/classes/hooks/hooks.js +2 -2
- package/dist/utilities/classes/namespace/_module.d.ts +1 -0
- package/dist/utilities/classes/namespace/_module.js +2 -0
- package/dist/utilities/classes/namespace/_module.js.map +1 -0
- package/dist/utilities/classes/{key-prefixer/key-prefixer.d.ts → namespace/namespace.d.ts} +38 -17
- package/dist/utilities/classes/{key-prefixer/key-prefixer.js → namespace/namespace.js} +51 -19
- package/dist/utilities/classes/namespace/namespace.js.map +1 -0
- package/dist/utilities/classes/time-span/time-span.d.ts +1 -2
- package/dist/utilities/classes/time-span/time-span.js +1 -4
- package/dist/utilities/classes/time-span/time-span.js.map +1 -1
- package/dist/utilities/functions/_module-exports.d.ts +2 -1
- package/dist/utilities/functions/_module-exports.js +2 -1
- package/dist/utilities/functions/_module-exports.js.map +1 -1
- package/dist/utilities/functions/lazy.d.ts +4 -0
- package/dist/utilities/functions/lazy.js +9 -3
- package/dist/utilities/functions/lazy.js.map +1 -1
- package/dist/utilities/functions/result.d.ts +11 -0
- package/dist/utilities/functions/result.js +15 -0
- package/dist/utilities/functions/result.js.map +1 -0
- package/dist/utilities/functions/validate.d.ts +8 -0
- package/dist/utilities/functions/validate.js +17 -0
- package/dist/utilities/functions/validate.js.map +1 -0
- package/dist/utilities/types/factory.type.d.ts +13 -18
- package/dist/utilities/types/result.type.d.ts +11 -1
- package/package.json +15 -11
- package/dist/cache/implementations/adapters/libsql-cache-adapter/_module.d.ts +0 -1
- package/dist/cache/implementations/adapters/libsql-cache-adapter/_module.js +0 -2
- package/dist/cache/implementations/adapters/libsql-cache-adapter/_module.js.map +0 -1
- package/dist/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter.d.ts +0 -61
- package/dist/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter.js +0 -95
- package/dist/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter.js.map +0 -1
- package/dist/cache/implementations/adapters/sqlite-cache-adapter/_module.d.ts +0 -1
- package/dist/cache/implementations/adapters/sqlite-cache-adapter/_module.js +0 -2
- package/dist/cache/implementations/adapters/sqlite-cache-adapter/_module.js.map +0 -1
- package/dist/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.d.ts +0 -59
- package/dist/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.js +0 -94
- package/dist/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.js.map +0 -1
- package/dist/lock/implementations/adapters/libsql-lock-adapter/_module.d.ts +0 -1
- package/dist/lock/implementations/adapters/libsql-lock-adapter/_module.js +0 -2
- package/dist/lock/implementations/adapters/libsql-lock-adapter/_module.js.map +0 -1
- package/dist/lock/implementations/adapters/libsql-lock-adapter/libsql-lock-adapter.d.ts +0 -60
- package/dist/lock/implementations/adapters/libsql-lock-adapter/libsql-lock-adapter.js +0 -84
- package/dist/lock/implementations/adapters/libsql-lock-adapter/libsql-lock-adapter.js.map +0 -1
- package/dist/lock/implementations/adapters/sqlite-lock-adapter/_module.d.ts +0 -1
- package/dist/lock/implementations/adapters/sqlite-lock-adapter/_module.js +0 -2
- package/dist/lock/implementations/adapters/sqlite-lock-adapter/_module.js.map +0 -1
- package/dist/lock/implementations/adapters/sqlite-lock-adapter/sqlite-lock-adapter.d.ts +0 -59
- package/dist/lock/implementations/adapters/sqlite-lock-adapter/sqlite-lock-adapter.js +0 -83
- package/dist/lock/implementations/adapters/sqlite-lock-adapter/sqlite-lock-adapter.js.map +0 -1
- package/dist/utilities/classes/key-prefixer/_module.d.ts +0 -1
- package/dist/utilities/classes/key-prefixer/_module.js +0 -2
- package/dist/utilities/classes/key-prefixer/_module.js.map +0 -1
- package/dist/utilities/classes/key-prefixer/key-prefixer.js.map +0 -1
- package/dist/utilities/functions/factory.d.ts +0 -44
- package/dist/utilities/functions/factory.js +0 -80
- package/dist/utilities/functions/factory.js.map +0 -1
|
@@ -4,6 +4,7 @@
|
|
|
4
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
|
+
import type { StandardSchemaV1 } from "@standard-schema/spec";
|
|
7
8
|
export type Collapse<TValue> = TValue extends Array<infer TItem> | Iterable<infer TItem> | ICollection<infer TItem> ? TItem : TValue;
|
|
8
9
|
/**
|
|
9
10
|
* The `ICollection` contract offers a fluent and efficient approach to working with {@link Iterable | `Iterable`} objects.
|
|
@@ -27,14 +28,14 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
27
28
|
*/
|
|
28
29
|
keys(): ICollection<number>;
|
|
29
30
|
/**
|
|
30
|
-
* The `
|
|
31
|
+
* The `copy` method returns a copy of the collection.
|
|
31
32
|
*/
|
|
32
|
-
|
|
33
|
+
copy(): ICollection<TInput>;
|
|
33
34
|
/**
|
|
34
35
|
* The `filter` method filters the collection using `predicateFn`, keeping only those items that pass `predicateFn`.
|
|
35
36
|
* @example
|
|
36
37
|
* ```ts
|
|
37
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
38
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
38
39
|
*
|
|
39
40
|
* // Assume the inputed collection is empty.
|
|
40
41
|
* function main(collection: ICollection<number>): void {
|
|
@@ -47,11 +48,16 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
47
48
|
* ```
|
|
48
49
|
*/
|
|
49
50
|
filter<TOutput extends TInput>(predicateFn: PredicateInvokable<TInput, ICollection<TInput>, TOutput>): ICollection<TOutput>;
|
|
51
|
+
/**
|
|
52
|
+
* The `validate` method filters all items that matches the `schema` and transforms them afterwards.
|
|
53
|
+
* The `schema` can be any [standard schema](https://standardschema.dev/) compliant object.
|
|
54
|
+
*/
|
|
55
|
+
validate<TOutput>(schema: StandardSchemaV1<TInput, TOutput>): ICollection<TOutput>;
|
|
50
56
|
/**
|
|
51
57
|
* The `reject` method filters the collection using `predicateFn`, keeping only those items that not pass `predicateFn`.
|
|
52
58
|
* @example
|
|
53
59
|
* ```ts
|
|
54
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
60
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
55
61
|
*
|
|
56
62
|
* // Assume the inputed collection is empty.
|
|
57
63
|
* function main(collection: ICollection<number>): void {
|
|
@@ -69,7 +75,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
69
75
|
* The `mapFn` is free to modify the item and return it, thus forming a new collection of modified items.
|
|
70
76
|
* @example
|
|
71
77
|
* ```ts
|
|
72
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
78
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
73
79
|
*
|
|
74
80
|
* // Assume the inputed collection is empty.
|
|
75
81
|
* function main(collection: ICollection<number>): void {
|
|
@@ -87,7 +93,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
87
93
|
* The final result of running the reducer across all items of the array is a single value.
|
|
88
94
|
* @example
|
|
89
95
|
* ```ts
|
|
90
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
96
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
91
97
|
*
|
|
92
98
|
* // Assume the inputed collection is empty.
|
|
93
99
|
* function main(collection: ICollection<number>): void {
|
|
@@ -99,7 +105,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
99
105
|
* ```
|
|
100
106
|
* @example
|
|
101
107
|
* ```ts
|
|
102
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
108
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
103
109
|
*
|
|
104
110
|
* // Assume the inputed collection is empty.
|
|
105
111
|
* function main(collection: ICollection<string>): void {
|
|
@@ -125,7 +131,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
125
131
|
* @throws {TypeCollectionError}
|
|
126
132
|
* @example
|
|
127
133
|
* ```ts
|
|
128
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
134
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
129
135
|
*
|
|
130
136
|
* // Assume the inputed collection is empty.
|
|
131
137
|
* function main(collection: ICollection<number>): void {
|
|
@@ -137,7 +143,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
137
143
|
* }
|
|
138
144
|
* ```
|
|
139
145
|
* ```ts
|
|
140
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
146
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
141
147
|
*
|
|
142
148
|
* // Assume the inputed collection is empty.
|
|
143
149
|
* function main(collection: ICollection<number>): void {
|
|
@@ -154,7 +160,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
154
160
|
* The `collapse` method collapses a collection of iterables into a single, flat collection.
|
|
155
161
|
* @example
|
|
156
162
|
* ```ts
|
|
157
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
163
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
158
164
|
*
|
|
159
165
|
* // Assume the inputed collection is empty.
|
|
160
166
|
* function main(collection: ICollection<number[]>): void {
|
|
@@ -172,7 +178,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
172
178
|
* It is identical to a `map` method followed by a `collapse` method.
|
|
173
179
|
* @example
|
|
174
180
|
* ```ts
|
|
175
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
181
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
176
182
|
*
|
|
177
183
|
* // Assume the inputed collection is empty.
|
|
178
184
|
* function main(collection: ICollection<string[]>): void {
|
|
@@ -189,7 +195,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
189
195
|
* The `change` method changes only the items that passes `predicateFn` using `mapFn`.
|
|
190
196
|
* @example
|
|
191
197
|
* ```ts
|
|
192
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
198
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
193
199
|
*
|
|
194
200
|
* // Assume the inputed collection is empty.
|
|
195
201
|
* function main(collection: ICollection<number>): void {
|
|
@@ -206,7 +212,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
206
212
|
* The `set` method changes a item by i>index` using `value`.
|
|
207
213
|
* @example
|
|
208
214
|
* ```ts
|
|
209
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
215
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
210
216
|
*
|
|
211
217
|
* // Assume the inputed collection is empty.
|
|
212
218
|
* function main(collection: ICollection<number>): void {
|
|
@@ -219,7 +225,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
219
225
|
* ```
|
|
220
226
|
* @example
|
|
221
227
|
* ```ts
|
|
222
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
228
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
223
229
|
*
|
|
224
230
|
* // Assume the inputed collection is empty.
|
|
225
231
|
* function main(collection: ICollection<number>): void {
|
|
@@ -236,7 +242,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
236
242
|
* The `get` method returns the item by index. If the item is not found null will returned.
|
|
237
243
|
* @example
|
|
238
244
|
* ```ts
|
|
239
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
245
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
240
246
|
*
|
|
241
247
|
* // Assume the inputed collection is empty.
|
|
242
248
|
* function main(collection: ICollection<number>): void {
|
|
@@ -256,7 +262,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
256
262
|
* @throws {ItemNotFoundCollectionError} {@link ItemNotFoundCollectionError}
|
|
257
263
|
* @example
|
|
258
264
|
* ```ts
|
|
259
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
265
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
260
266
|
*
|
|
261
267
|
* // Assume the inputed collection is empty.
|
|
262
268
|
* function main(collection: ICollection<number>): void {
|
|
@@ -275,7 +281,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
275
281
|
* The `page` method returns a new collection containing the items that would be present on ` page ` with custom ` pageSize `.
|
|
276
282
|
* @example
|
|
277
283
|
* ```ts
|
|
278
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
284
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
279
285
|
*
|
|
280
286
|
* // Assume the inputed collection is empty.
|
|
281
287
|
* function main(collection: ICollection<number>): void {
|
|
@@ -295,7 +301,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
295
301
|
* @throws {EmptyCollectionError} {@link EmptyCollectionError}
|
|
296
302
|
* @example
|
|
297
303
|
* ```ts
|
|
298
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
304
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
299
305
|
*
|
|
300
306
|
* // Assume the inputed collection is empty.
|
|
301
307
|
* function main(collection: ICollection<number>): void {
|
|
@@ -314,7 +320,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
314
320
|
* @throws {EmptyCollectionError} {@link EmptyCollectionError}
|
|
315
321
|
* @example
|
|
316
322
|
* ```ts
|
|
317
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
323
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
318
324
|
*
|
|
319
325
|
* // Assume the inputed collection is empty.
|
|
320
326
|
* function main(collection: ICollection<number>): void {
|
|
@@ -333,7 +339,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
333
339
|
* @throws {EmptyCollectionError} {@link EmptyCollectionError}
|
|
334
340
|
* @example
|
|
335
341
|
* ```ts
|
|
336
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
342
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
337
343
|
*
|
|
338
344
|
* // Assume the inputed collection is empty.
|
|
339
345
|
* function main(collection: ICollection<number>): void {
|
|
@@ -352,7 +358,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
352
358
|
* @throws {EmptyCollectionError} {@link EmptyCollectionError}
|
|
353
359
|
* @example
|
|
354
360
|
* ```ts
|
|
355
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
361
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
356
362
|
*
|
|
357
363
|
* // Assume the inputed collection is empty.
|
|
358
364
|
* function main(collection: ICollection<number>): void {
|
|
@@ -371,7 +377,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
371
377
|
* @throws {EmptyCollectionError} {@link EmptyCollectionError}
|
|
372
378
|
* @example
|
|
373
379
|
* ```ts
|
|
374
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
380
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
375
381
|
*
|
|
376
382
|
* // Assume the inputed collection is empty.
|
|
377
383
|
* function main(collection: ICollection<number>): void {
|
|
@@ -389,7 +395,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
389
395
|
* @throws {EmptyCollectionError} {@link EmptyCollectionError}
|
|
390
396
|
* @example
|
|
391
397
|
* ```ts
|
|
392
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
398
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
393
399
|
*
|
|
394
400
|
* // Assume the inputed collection is empty.
|
|
395
401
|
* function main(collection: ICollection<number>): void {
|
|
@@ -405,7 +411,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
405
411
|
* The `some` method determines whether at least one item in the collection matches `predicateFn`.
|
|
406
412
|
* @example
|
|
407
413
|
* ```ts
|
|
408
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
414
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
409
415
|
*
|
|
410
416
|
* // Assume the inputed collection is empty.
|
|
411
417
|
* function main(collection: ICollection<number>): void {
|
|
@@ -421,7 +427,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
421
427
|
* The `every` method determines whether all items in the collection matches `predicateFn`.
|
|
422
428
|
* @example
|
|
423
429
|
* ```ts
|
|
424
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
430
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
425
431
|
*
|
|
426
432
|
* // Assume the inputed collection is empty.
|
|
427
433
|
* function main(collection: ICollection<number>): void {
|
|
@@ -437,7 +443,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
437
443
|
* The `take` method takes the first `limit` items.
|
|
438
444
|
* @example
|
|
439
445
|
* ```ts
|
|
440
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
446
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
441
447
|
*
|
|
442
448
|
* // Assume the inputed collection is empty.
|
|
443
449
|
* function main(collection: ICollection<number>): void {
|
|
@@ -451,7 +457,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
451
457
|
*
|
|
452
458
|
* @example
|
|
453
459
|
* ```ts
|
|
454
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
460
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
455
461
|
*
|
|
456
462
|
* // Assume the inputed collection is empty.
|
|
457
463
|
* function main(collection: ICollection<number>): void {
|
|
@@ -468,7 +474,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
468
474
|
* The `takeUntil` method takes items until `predicateFn` returns true.
|
|
469
475
|
* @example
|
|
470
476
|
* ```ts
|
|
471
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
477
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
472
478
|
*
|
|
473
479
|
* // Assume the inputed collection is empty.
|
|
474
480
|
* function main(collection: ICollection<number>): void {
|
|
@@ -485,7 +491,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
485
491
|
* The `takeWhile` method takes items until `predicateFn` returns false.
|
|
486
492
|
* @example
|
|
487
493
|
* ```ts
|
|
488
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
494
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
489
495
|
*
|
|
490
496
|
* // Assume the inputed collection is empty.
|
|
491
497
|
* function main(collection: ICollection<number>): void {
|
|
@@ -502,7 +508,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
502
508
|
* The `skip` method skips the first `offset` items.
|
|
503
509
|
* @example
|
|
504
510
|
* ```ts
|
|
505
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
511
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
506
512
|
*
|
|
507
513
|
* // Assume the inputed collection is empty.
|
|
508
514
|
* function main(collection: ICollection<number>): void {
|
|
@@ -519,7 +525,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
519
525
|
* The `skipUntil` method skips items until `predicateFn` returns true.
|
|
520
526
|
* @example
|
|
521
527
|
* ```ts
|
|
522
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
528
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
523
529
|
*
|
|
524
530
|
* // Assume the inputed collection is empty.
|
|
525
531
|
* function main(collection: ICollection<number>): void {
|
|
@@ -536,7 +542,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
536
542
|
* The `skipWhile` method skips items until `predicateFn` returns false.
|
|
537
543
|
* @example
|
|
538
544
|
* ```ts
|
|
539
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
545
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
540
546
|
*
|
|
541
547
|
* // Assume the inputed collection is empty.
|
|
542
548
|
* function main(collection: ICollection<number>): void {
|
|
@@ -553,7 +559,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
553
559
|
* The `when` method will execute `callback` when `condition` evaluates to true.
|
|
554
560
|
* @example
|
|
555
561
|
* ```ts
|
|
556
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
562
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
557
563
|
*
|
|
558
564
|
* // Assume the inputed collection is empty.
|
|
559
565
|
* function main(collection: ICollection<number>): void {
|
|
@@ -571,7 +577,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
571
577
|
* The `whenEmpty` method will execute `callback` when the collection is empty.
|
|
572
578
|
* @example
|
|
573
579
|
* ```ts
|
|
574
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
580
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
575
581
|
*
|
|
576
582
|
* // Assume the inputed collection is empty.
|
|
577
583
|
* function main(collection: ICollection<number>): void {
|
|
@@ -584,7 +590,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
584
590
|
* ```
|
|
585
591
|
* @example
|
|
586
592
|
* ```ts
|
|
587
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
593
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
588
594
|
*
|
|
589
595
|
* // Assume the inputed collection is empty.
|
|
590
596
|
* function main(collection: ICollection<number>): void {
|
|
@@ -601,7 +607,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
601
607
|
* The `whenNot` method will execute `callback` when `condition` evaluates to false.
|
|
602
608
|
* @example
|
|
603
609
|
* ```ts
|
|
604
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
610
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
605
611
|
*
|
|
606
612
|
* // Assume the inputed collection is empty.
|
|
607
613
|
* function main(collection: ICollection<number>): void {
|
|
@@ -618,7 +624,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
618
624
|
* The `whenNotEmpty` method will execute `callback` when the collection is not empty.
|
|
619
625
|
* @example
|
|
620
626
|
* ```ts
|
|
621
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
627
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
622
628
|
*
|
|
623
629
|
* // Assume the inputed collection is empty.
|
|
624
630
|
* function main(collection: ICollection<number>): void {
|
|
@@ -630,7 +636,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
630
636
|
* ```
|
|
631
637
|
* @example
|
|
632
638
|
* ```ts
|
|
633
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
639
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
634
640
|
*
|
|
635
641
|
* // Assume the inputed collection is empty.
|
|
636
642
|
* function main(collection: ICollection<number>): void {
|
|
@@ -648,7 +654,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
648
654
|
* This method is useful when you want compose multiple smaller functions.
|
|
649
655
|
* @example
|
|
650
656
|
* ```ts
|
|
651
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
657
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
652
658
|
*
|
|
653
659
|
* // Assume the inputed collection is empty.
|
|
654
660
|
* function main(collection: ICollection<number>): void {
|
|
@@ -677,7 +683,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
677
683
|
* 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
684
|
* @example
|
|
679
685
|
* ```ts
|
|
680
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
686
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
681
687
|
*
|
|
682
688
|
* // Assume the inputed collection is empty.
|
|
683
689
|
* function main(collection: ICollection<number>): void {
|
|
@@ -698,7 +704,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
698
704
|
* If `chunkSize` is not divisible with total number of items then the last chunk will contain the remaining items.
|
|
699
705
|
* @example
|
|
700
706
|
* ```ts
|
|
701
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
707
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
702
708
|
*
|
|
703
709
|
* // Assume the inputed collection is empty.
|
|
704
710
|
* function main(collection: ICollection<number>): void {
|
|
@@ -715,7 +721,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
715
721
|
* The chunk variable passed to the `predicateFn` may be used to inspect the previous item.
|
|
716
722
|
* @example
|
|
717
723
|
* ```ts
|
|
718
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
724
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
719
725
|
*
|
|
720
726
|
* // Assume the inputed collection is empty.
|
|
721
727
|
* function main(collection: ICollection<string>): void {
|
|
@@ -735,7 +741,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
735
741
|
* The `split` method breaks a collection evenly into `chunkAmount` of chunks.
|
|
736
742
|
* @example
|
|
737
743
|
* ```ts
|
|
738
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
744
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
739
745
|
*
|
|
740
746
|
* // Assume the inputed collection is empty.
|
|
741
747
|
* function main(collection: ICollection<number>): void {
|
|
@@ -749,7 +755,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
749
755
|
* ```
|
|
750
756
|
* @example
|
|
751
757
|
* ```ts
|
|
752
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
758
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
753
759
|
*
|
|
754
760
|
* // Assume the inputed collection is empty.
|
|
755
761
|
* function main(collection: ICollection<number>): void {
|
|
@@ -763,7 +769,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
763
769
|
* ```
|
|
764
770
|
* @example
|
|
765
771
|
* ```ts
|
|
766
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
772
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
767
773
|
*
|
|
768
774
|
* // Assume the inputed collection is empty.
|
|
769
775
|
* function main(collection: ICollection<number>): void {
|
|
@@ -781,7 +787,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
781
787
|
* The `partition` method is used to separate items that pass `predicateFn` from those that do not.
|
|
782
788
|
* @example
|
|
783
789
|
* ```ts
|
|
784
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
790
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
785
791
|
*
|
|
786
792
|
* // Assume the inputed collection is empty.
|
|
787
793
|
* function main(collection: ICollection<number>): void {
|
|
@@ -799,7 +805,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
799
805
|
* The `sliding` method returns a new collection of chunks representing a "sliding window" view of the items in the collection.
|
|
800
806
|
* @example
|
|
801
807
|
* ```ts
|
|
802
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
808
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
803
809
|
*
|
|
804
810
|
* // Assume the inputed collection is empty.
|
|
805
811
|
* function main(collection: ICollection<number>): void {
|
|
@@ -818,7 +824,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
818
824
|
* By default the equality check occurs on the item.
|
|
819
825
|
* @example
|
|
820
826
|
* ```ts
|
|
821
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
827
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
822
828
|
*
|
|
823
829
|
* // Assume the inputed collection is empty.
|
|
824
830
|
* function main(collection: ICollection<string>): void {
|
|
@@ -845,7 +851,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
845
851
|
* ```
|
|
846
852
|
* @example
|
|
847
853
|
* ```ts
|
|
848
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
854
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
849
855
|
*
|
|
850
856
|
* // Assume the inputed collection is empty.
|
|
851
857
|
* function main(collection: ICollection<string>): void {
|
|
@@ -873,7 +879,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
873
879
|
* By default the equality check occurs on the item.
|
|
874
880
|
* @example
|
|
875
881
|
* ```ts
|
|
876
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
882
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
877
883
|
*
|
|
878
884
|
* // Assume the inputed collection is empty.
|
|
879
885
|
* function main(collection: ICollection<string>): void {
|
|
@@ -891,7 +897,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
891
897
|
* ```
|
|
892
898
|
* @example
|
|
893
899
|
* ```ts
|
|
894
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
900
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
895
901
|
*
|
|
896
902
|
* // Assume the inputed collection is empty.
|
|
897
903
|
* function main(collection: ICollection<string>): void {
|
|
@@ -912,7 +918,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
912
918
|
* By default the equality check occurs on the item.
|
|
913
919
|
* @example
|
|
914
920
|
* ```ts
|
|
915
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
921
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
916
922
|
*
|
|
917
923
|
* // Assume the inputed collection is empty.
|
|
918
924
|
* function main(collection: ICollection<number>): void {
|
|
@@ -925,7 +931,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
925
931
|
* ```
|
|
926
932
|
* @example
|
|
927
933
|
* ```ts
|
|
928
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
934
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
929
935
|
*
|
|
930
936
|
* type Phone = {
|
|
931
937
|
* name: string;
|
|
@@ -958,7 +964,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
958
964
|
* By default the equality check occurs on the item.
|
|
959
965
|
* @example
|
|
960
966
|
* ```ts
|
|
961
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
967
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
962
968
|
*
|
|
963
969
|
* // Assume the inputed collection is empty.
|
|
964
970
|
* function main(collection: ICollection<number>): void {
|
|
@@ -971,7 +977,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
971
977
|
* ```
|
|
972
978
|
* @example
|
|
973
979
|
* ```ts
|
|
974
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
980
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
975
981
|
*
|
|
976
982
|
* type Phone = {
|
|
977
983
|
* name: string;
|
|
@@ -1009,7 +1015,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1009
1015
|
* The `repeat` method will repeat the original collection `amount` times.
|
|
1010
1016
|
* @example
|
|
1011
1017
|
* ```ts
|
|
1012
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1018
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1013
1019
|
*
|
|
1014
1020
|
* // Assume the inputed collection is empty.
|
|
1015
1021
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1027,7 +1033,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1027
1033
|
* The padding is applied from the start of this collection.
|
|
1028
1034
|
* @example
|
|
1029
1035
|
* ```ts
|
|
1030
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1036
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1031
1037
|
*
|
|
1032
1038
|
* // Assume the inputed collection is empty.
|
|
1033
1039
|
* function main(collection: ICollection<string>): void {
|
|
@@ -1075,7 +1081,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1075
1081
|
* The padding is applied from the end of this collection.
|
|
1076
1082
|
* @example
|
|
1077
1083
|
* ```ts
|
|
1078
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1084
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1079
1085
|
*
|
|
1080
1086
|
* // Assume the inputed collection is empty.
|
|
1081
1087
|
* function main(collection: ICollection<string>): void {
|
|
@@ -1088,7 +1094,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1088
1094
|
* ```
|
|
1089
1095
|
* @example
|
|
1090
1096
|
* ```ts
|
|
1091
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1097
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1092
1098
|
*
|
|
1093
1099
|
* // Assume the inputed collection is empty.
|
|
1094
1100
|
* function main(collection: ICollection<string>): void {
|
|
@@ -1101,7 +1107,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1101
1107
|
* ```
|
|
1102
1108
|
* @example
|
|
1103
1109
|
* ```ts
|
|
1104
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1110
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1105
1111
|
*
|
|
1106
1112
|
* // Assume the inputed collection is empty.
|
|
1107
1113
|
* function main(collection: ICollection<string>): void {
|
|
@@ -1115,7 +1121,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1115
1121
|
* ```
|
|
1116
1122
|
* @example
|
|
1117
1123
|
* ```ts
|
|
1118
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1124
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1119
1125
|
*
|
|
1120
1126
|
* // Assume the inputed collection is empty.
|
|
1121
1127
|
* function main(collection: ICollection<string>): void {
|
|
@@ -1133,7 +1139,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1133
1139
|
* where `start` and `end` (end not included) represent the index of items in the collection.
|
|
1134
1140
|
* @example
|
|
1135
1141
|
* ```ts
|
|
1136
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1142
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1137
1143
|
*
|
|
1138
1144
|
* // Assume the inputed collection is empty.
|
|
1139
1145
|
* function main(collection: ICollection<string>): void {
|
|
@@ -1146,7 +1152,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1146
1152
|
* ```
|
|
1147
1153
|
* @example
|
|
1148
1154
|
* ```ts
|
|
1149
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1155
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1150
1156
|
*
|
|
1151
1157
|
* // Assume the inputed collection is empty.
|
|
1152
1158
|
* function main(collection: ICollection<string>): void {
|
|
@@ -1159,7 +1165,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1159
1165
|
* ```
|
|
1160
1166
|
* @example
|
|
1161
1167
|
* ```ts
|
|
1162
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1168
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1163
1169
|
*
|
|
1164
1170
|
* // Assume the inputed collection is empty.
|
|
1165
1171
|
* function main(collection: ICollection<string>): void {
|
|
@@ -1172,7 +1178,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1172
1178
|
* ```
|
|
1173
1179
|
* @example
|
|
1174
1180
|
* ```ts
|
|
1175
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1181
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1176
1182
|
*
|
|
1177
1183
|
* // Assume the inputed collection is empty.
|
|
1178
1184
|
* function main(collection: ICollection<string>): void {
|
|
@@ -1185,7 +1191,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1185
1191
|
* ```
|
|
1186
1192
|
* @example
|
|
1187
1193
|
* ```ts
|
|
1188
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1194
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1189
1195
|
*
|
|
1190
1196
|
* // Assume the inputed collection is empty.
|
|
1191
1197
|
* function main(collection: ICollection<string>): void {
|
|
@@ -1198,7 +1204,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1198
1204
|
* ```
|
|
1199
1205
|
* @example
|
|
1200
1206
|
* ```ts
|
|
1201
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1207
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1202
1208
|
*
|
|
1203
1209
|
* // Assume the inputed collection is empty.
|
|
1204
1210
|
* function main(collection: ICollection<string>): void {
|
|
@@ -1215,7 +1221,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1215
1221
|
* The `prepend` method adds `iterable` to the beginning of the collection.
|
|
1216
1222
|
* @example
|
|
1217
1223
|
* ```ts
|
|
1218
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1224
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1219
1225
|
*
|
|
1220
1226
|
* // Assume the inputed collection is empty.
|
|
1221
1227
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1232,7 +1238,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1232
1238
|
* The `append` method adds `iterable` to the end of the collection.
|
|
1233
1239
|
* @example
|
|
1234
1240
|
* ```ts
|
|
1235
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1241
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1236
1242
|
*
|
|
1237
1243
|
* // Assume the inputed collection is empty.
|
|
1238
1244
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1249,7 +1255,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1249
1255
|
* The `insertBefore` method adds `iterable` before the first item that matches `predicateFn`.
|
|
1250
1256
|
* @example
|
|
1251
1257
|
* ```ts
|
|
1252
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1258
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1253
1259
|
*
|
|
1254
1260
|
* // Assume the inputed collection is empty.
|
|
1255
1261
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1266,7 +1272,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1266
1272
|
* The `insertAfter` method adds `iterable` after the first item that matches `predicateFn`.
|
|
1267
1273
|
* @example
|
|
1268
1274
|
* ```ts
|
|
1269
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1275
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1270
1276
|
*
|
|
1271
1277
|
* // Assume the inputed collection is empty.
|
|
1272
1278
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1283,7 +1289,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1283
1289
|
* The `crossJoin` method cross joins the collection's values among `iterables`, returning a Cartesian product with all possible permutations.
|
|
1284
1290
|
* @example
|
|
1285
1291
|
* ```ts
|
|
1286
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1292
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1287
1293
|
*
|
|
1288
1294
|
* // Assume the inputed collection is empty.
|
|
1289
1295
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1301,7 +1307,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1301
1307
|
* ```
|
|
1302
1308
|
* @example
|
|
1303
1309
|
* ```ts
|
|
1304
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1310
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1305
1311
|
*
|
|
1306
1312
|
* // Assume the inputed collection is empty.
|
|
1307
1313
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1329,7 +1335,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1329
1335
|
* The returned collection has size of the shortest collection.
|
|
1330
1336
|
* @example
|
|
1331
1337
|
* ```ts
|
|
1332
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1338
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1333
1339
|
*
|
|
1334
1340
|
* // Assume the inputed collection is empty.
|
|
1335
1341
|
* function main(collection: ICollection<string>): void {
|
|
@@ -1342,7 +1348,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1342
1348
|
* ```
|
|
1343
1349
|
* @example
|
|
1344
1350
|
* ```ts
|
|
1345
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1351
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1346
1352
|
*
|
|
1347
1353
|
* // Assume the inputed collection is empty.
|
|
1348
1354
|
* function main(collection: ICollection<string>): void {
|
|
@@ -1355,7 +1361,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1355
1361
|
* ```
|
|
1356
1362
|
* @example
|
|
1357
1363
|
* ```ts
|
|
1358
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1364
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1359
1365
|
*
|
|
1360
1366
|
* // Assume the inputed collection is empty.
|
|
1361
1367
|
* function main(collection: ICollection<string>): void {
|
|
@@ -1372,7 +1378,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1372
1378
|
* The `sort` method sorts the collection. You can provide a `comparator` function.
|
|
1373
1379
|
* @example
|
|
1374
1380
|
* ```ts
|
|
1375
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1381
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1376
1382
|
*
|
|
1377
1383
|
* // Assume the inputed collection is empty.
|
|
1378
1384
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1385,7 +1391,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1385
1391
|
* ```
|
|
1386
1392
|
* @example
|
|
1387
1393
|
* ```ts
|
|
1388
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1394
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1389
1395
|
*
|
|
1390
1396
|
* type Person = {
|
|
1391
1397
|
* name: string;
|
|
@@ -1418,7 +1424,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1418
1424
|
* The reversing of the collection will be applied in chunks that are the size of ` chunkSize `.
|
|
1419
1425
|
* @example
|
|
1420
1426
|
* ```ts
|
|
1421
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1427
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1422
1428
|
*
|
|
1423
1429
|
* // Assume the inputed collection is empty.
|
|
1424
1430
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1440,7 +1446,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1440
1446
|
* By default it will get the first item. If the collection is empty or no items passes ` predicateFn ` than null i returned.
|
|
1441
1447
|
* @example
|
|
1442
1448
|
* ```ts
|
|
1443
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1449
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1444
1450
|
*
|
|
1445
1451
|
* // Assume the inputed collection is empty.
|
|
1446
1452
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1452,7 +1458,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1452
1458
|
* ```
|
|
1453
1459
|
* @example
|
|
1454
1460
|
* ```ts
|
|
1455
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1461
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1456
1462
|
*
|
|
1457
1463
|
* // Assume the inputed collection is empty.
|
|
1458
1464
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1464,7 +1470,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1464
1470
|
* ```
|
|
1465
1471
|
* @example
|
|
1466
1472
|
* ```ts
|
|
1467
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1473
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1468
1474
|
*
|
|
1469
1475
|
* // Assume the inputed collection is empty.
|
|
1470
1476
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1482,7 +1488,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1482
1488
|
* By default it will get the first item. If the collection is empty or no items passes ` predicateFn ` than ` defaultValue `.
|
|
1483
1489
|
* @example
|
|
1484
1490
|
* ```ts
|
|
1485
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1491
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1486
1492
|
*
|
|
1487
1493
|
* // Assume the inputed collection is empty.
|
|
1488
1494
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1494,7 +1500,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1494
1500
|
* ```
|
|
1495
1501
|
* @example
|
|
1496
1502
|
* ```ts
|
|
1497
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1503
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1498
1504
|
*
|
|
1499
1505
|
* // Assume the inputed collection is empty.
|
|
1500
1506
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1506,7 +1512,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1506
1512
|
* ```
|
|
1507
1513
|
* @example
|
|
1508
1514
|
* ```ts
|
|
1509
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1515
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1510
1516
|
*
|
|
1511
1517
|
* // Assume the inputed collection is empty.
|
|
1512
1518
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1518,7 +1524,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1518
1524
|
* ```
|
|
1519
1525
|
* @example
|
|
1520
1526
|
* ```ts
|
|
1521
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1527
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1522
1528
|
*
|
|
1523
1529
|
* // Assume the inputed collection is empty.
|
|
1524
1530
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1536,7 +1542,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1536
1542
|
* @throws {ItemNotFoundCollectionError} {@link ItemNotFoundCollectionError}
|
|
1537
1543
|
* @example
|
|
1538
1544
|
* ```ts
|
|
1539
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1545
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1540
1546
|
*
|
|
1541
1547
|
* // Assume the inputed collection is empty.
|
|
1542
1548
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1548,7 +1554,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1548
1554
|
* ```
|
|
1549
1555
|
* @example
|
|
1550
1556
|
* ```ts
|
|
1551
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1557
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1552
1558
|
*
|
|
1553
1559
|
* // Assume the inputed collection is empty.
|
|
1554
1560
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1560,7 +1566,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1560
1566
|
* ```
|
|
1561
1567
|
* @example
|
|
1562
1568
|
* ```ts
|
|
1563
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1569
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1564
1570
|
*
|
|
1565
1571
|
* // Assume the inputed collection is empty.
|
|
1566
1572
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1577,7 +1583,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1577
1583
|
* By default it will get the last item. If the collection is empty or no items passes ` predicateFn ` than null i returned.
|
|
1578
1584
|
* @example
|
|
1579
1585
|
* ```ts
|
|
1580
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1586
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1581
1587
|
*
|
|
1582
1588
|
* // Assume the inputed collection is empty.
|
|
1583
1589
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1589,7 +1595,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1589
1595
|
* ```
|
|
1590
1596
|
* @example
|
|
1591
1597
|
* ```ts
|
|
1592
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1598
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1593
1599
|
*
|
|
1594
1600
|
* // Assume the inputed collection is empty.
|
|
1595
1601
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1601,7 +1607,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1601
1607
|
* ```
|
|
1602
1608
|
* @example
|
|
1603
1609
|
* ```ts
|
|
1604
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1610
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1605
1611
|
*
|
|
1606
1612
|
* // Assume the inputed collection is empty.
|
|
1607
1613
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1618,7 +1624,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1618
1624
|
* By default it will get the last item. If the collection is empty or no items passes ` predicateFn ` than ` defaultValue `.
|
|
1619
1625
|
* @example
|
|
1620
1626
|
* ```ts
|
|
1621
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1627
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1622
1628
|
*
|
|
1623
1629
|
* // Assume the inputed collection is empty.
|
|
1624
1630
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1630,7 +1636,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1630
1636
|
* ```
|
|
1631
1637
|
* @example
|
|
1632
1638
|
* ```ts
|
|
1633
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1639
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1634
1640
|
*
|
|
1635
1641
|
* // Assume the inputed collection is empty.
|
|
1636
1642
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1642,7 +1648,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1642
1648
|
* ```
|
|
1643
1649
|
* @example
|
|
1644
1650
|
* ```ts
|
|
1645
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1651
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1646
1652
|
*
|
|
1647
1653
|
* // Assume the inputed collection is empty.
|
|
1648
1654
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1654,7 +1660,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1654
1660
|
* ```
|
|
1655
1661
|
* @example
|
|
1656
1662
|
* ```ts
|
|
1657
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1663
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1658
1664
|
*
|
|
1659
1665
|
* // Assume the inputed collection is empty.
|
|
1660
1666
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1672,7 +1678,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1672
1678
|
* @throws {ItemNotFoundCollectionError} {@link ItemNotFoundCollectionError}
|
|
1673
1679
|
* @example
|
|
1674
1680
|
* ```ts
|
|
1675
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1681
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1676
1682
|
*
|
|
1677
1683
|
* // Assume the inputed collection is empty.
|
|
1678
1684
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1684,7 +1690,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1684
1690
|
* ```
|
|
1685
1691
|
* @example
|
|
1686
1692
|
* ```ts
|
|
1687
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1693
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1688
1694
|
*
|
|
1689
1695
|
* // Assume the inputed collection is empty.
|
|
1690
1696
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1696,7 +1702,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1696
1702
|
* ```
|
|
1697
1703
|
* @example
|
|
1698
1704
|
* ```ts
|
|
1699
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1705
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1700
1706
|
*
|
|
1701
1707
|
* // Assume the inputed collection is empty.
|
|
1702
1708
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1713,7 +1719,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1713
1719
|
* If the `predicateFn` does not match or matches the first item then null is returned.
|
|
1714
1720
|
* @example
|
|
1715
1721
|
* ```ts
|
|
1716
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1722
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1717
1723
|
*
|
|
1718
1724
|
* // Assume the inputed collection is empty.
|
|
1719
1725
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1725,7 +1731,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1725
1731
|
* ```
|
|
1726
1732
|
* @example
|
|
1727
1733
|
* ```ts
|
|
1728
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1734
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1729
1735
|
*
|
|
1730
1736
|
* // Assume the inputed collection is empty.
|
|
1731
1737
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1742,7 +1748,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1742
1748
|
* If the collection is empty or the `predicateFn` does not match or matches the first item then `defaultValue` is returned.
|
|
1743
1749
|
* @example
|
|
1744
1750
|
* ```ts
|
|
1745
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1751
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1746
1752
|
*
|
|
1747
1753
|
* // Assume the inputed collection is empty.
|
|
1748
1754
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1754,7 +1760,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1754
1760
|
* ```
|
|
1755
1761
|
* @example
|
|
1756
1762
|
* ```ts
|
|
1757
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1763
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1758
1764
|
*
|
|
1759
1765
|
* // Assume the inputed collection is empty.
|
|
1760
1766
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1766,7 +1772,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1766
1772
|
* ```
|
|
1767
1773
|
* @example
|
|
1768
1774
|
* ```ts
|
|
1769
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1775
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1770
1776
|
*
|
|
1771
1777
|
* // Assume the inputed collection is empty.
|
|
1772
1778
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1784,7 +1790,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1784
1790
|
* @throws {ItemNotFoundCollectionError} {@link ItemNotFoundCollectionError}
|
|
1785
1791
|
* @example
|
|
1786
1792
|
* ```ts
|
|
1787
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1793
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1788
1794
|
*
|
|
1789
1795
|
* // Assume the inputed collection is empty.
|
|
1790
1796
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1796,7 +1802,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1796
1802
|
* ```
|
|
1797
1803
|
* @example
|
|
1798
1804
|
* ```ts
|
|
1799
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1805
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1800
1806
|
*
|
|
1801
1807
|
* // Assume the inputed collection is empty.
|
|
1802
1808
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1813,7 +1819,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1813
1819
|
* If the collection is empty or the `predicateFn` does not match or matches the last item then null is returned.
|
|
1814
1820
|
* @example
|
|
1815
1821
|
* ```ts
|
|
1816
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1822
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1817
1823
|
*
|
|
1818
1824
|
* // Assume the inputed collection is empty.
|
|
1819
1825
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1825,7 +1831,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1825
1831
|
* ```
|
|
1826
1832
|
* @example
|
|
1827
1833
|
* ```ts
|
|
1828
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1834
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1829
1835
|
*
|
|
1830
1836
|
* // Assume the inputed collection is empty.
|
|
1831
1837
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1842,7 +1848,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1842
1848
|
* If the collection is empty or the `predicateFn` does not match or matches the last item then `defaultValue` is returned.
|
|
1843
1849
|
* @example
|
|
1844
1850
|
* ```ts
|
|
1845
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1851
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1846
1852
|
*
|
|
1847
1853
|
* // Assume the inputed collection is empty.
|
|
1848
1854
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1854,7 +1860,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1854
1860
|
* ```
|
|
1855
1861
|
* @example
|
|
1856
1862
|
* ```ts
|
|
1857
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1863
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1858
1864
|
*
|
|
1859
1865
|
* // Assume the inputed collection is empty.
|
|
1860
1866
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1866,7 +1872,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1866
1872
|
* ```
|
|
1867
1873
|
* @example
|
|
1868
1874
|
* ```ts
|
|
1869
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1875
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1870
1876
|
*
|
|
1871
1877
|
* // Assume the inputed collection is empty.
|
|
1872
1878
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1884,7 +1890,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1884
1890
|
* @throws {ItemNotFoundCollectionError} {@link ItemNotFoundCollectionError}
|
|
1885
1891
|
* @example
|
|
1886
1892
|
* ```ts
|
|
1887
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1893
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1888
1894
|
*
|
|
1889
1895
|
* // Assume the inputed collection is empty.
|
|
1890
1896
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1896,7 +1902,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1896
1902
|
* ```
|
|
1897
1903
|
* @example
|
|
1898
1904
|
* ```ts
|
|
1899
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1905
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1900
1906
|
*
|
|
1901
1907
|
* // Assume the inputed collection is empty.
|
|
1902
1908
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1915,7 +1921,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1915
1921
|
* @throws {MultipleItemsFoundCollectionError} {@link MultipleItemsFoundCollectionError}
|
|
1916
1922
|
* @example
|
|
1917
1923
|
* ```ts
|
|
1918
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1924
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1919
1925
|
*
|
|
1920
1926
|
* // Assume the inputed collection is empty.
|
|
1921
1927
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1927,7 +1933,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1927
1933
|
* ```
|
|
1928
1934
|
* @example
|
|
1929
1935
|
* ```ts
|
|
1930
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1936
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1931
1937
|
*
|
|
1932
1938
|
* // Assume the inputed collection is empty.
|
|
1933
1939
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1939,7 +1945,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1939
1945
|
* ```
|
|
1940
1946
|
* @example
|
|
1941
1947
|
* ```ts
|
|
1942
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1948
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1943
1949
|
*
|
|
1944
1950
|
* // Assume the inputed collection is empty.
|
|
1945
1951
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1955,7 +1961,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1955
1961
|
* The `nth` method creates a new collection consisting of every n-th item.
|
|
1956
1962
|
* @example
|
|
1957
1963
|
* ```ts
|
|
1958
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1964
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1959
1965
|
*
|
|
1960
1966
|
* // Assume the inputed collection is empty.
|
|
1961
1967
|
* function main(collection: ICollection<string>): void {
|
|
@@ -1972,7 +1978,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1972
1978
|
* The `count` method returns the total number of items in the collection that passes `predicateFn`.
|
|
1973
1979
|
* @example
|
|
1974
1980
|
* ```ts
|
|
1975
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1981
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1976
1982
|
*
|
|
1977
1983
|
* // Assume the inputed collection is empty.
|
|
1978
1984
|
* function main(collection: ICollection<number>): void {
|
|
@@ -2000,7 +2006,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
2000
2006
|
* The `searchFirst` return the index of the first item that matches `predicateFn`.
|
|
2001
2007
|
* @example
|
|
2002
2008
|
* ```ts
|
|
2003
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
2009
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
2004
2010
|
*
|
|
2005
2011
|
* // Assume the inputed collection is empty.
|
|
2006
2012
|
* function main(collection: ICollection<string>): void {
|
|
@@ -2016,7 +2022,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
2016
2022
|
* The `searchLast` return the index of the last item that matches `predicateFn`.
|
|
2017
2023
|
* @example
|
|
2018
2024
|
* ```ts
|
|
2019
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
2025
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
2020
2026
|
*
|
|
2021
2027
|
* // Assume the inputed collection is empty.
|
|
2022
2028
|
* function main(collection: ICollection<string>): void {
|