@daiso-tech/core 0.35.3 → 0.36.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/fallback/fallback.middleware.d.ts +2 -2
- package/dist/async/middlewares/fallback/fallback.middleware.js +2 -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 +9 -9
- 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.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/contracts/cache.events.d.ts +2 -2
- package/dist/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter.d.ts +14 -0
- package/dist/cache/implementations/adapters/libsql-cache-adapter/libsql-cache-adapter.js.map +1 -1
- package/dist/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter.d.ts +3 -0
- package/dist/cache/implementations/adapters/mongodb-cache-adapter/mongodb-cache-adapter.js.map +1 -1
- package/dist/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.d.ts +11 -0
- package/dist/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.js.map +1 -1
- package/dist/cache/implementations/derivables/cache/cache.d.ts +12 -8
- package/dist/cache/implementations/derivables/cache/cache.js +25 -34
- package/dist/cache/implementations/derivables/cache/cache.js.map +1 -1
- package/dist/cache/implementations/derivables/cache-factory/cache-factory.d.ts +6 -41
- package/dist/cache/implementations/derivables/cache-factory/cache-factory.js +10 -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 +11 -12
- package/dist/cache/implementations/test-utilities/cache.test-suite.js.map +1 -1
- package/dist/collection/contracts/async-collection.contract.d.ts +121 -121
- package/dist/collection/contracts/collection.contract.d.ts +120 -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/async-iterable-collection.d.ts +13 -13
- package/dist/collection/implementations/async-iterable-collection/async-iterable-collection.js +15 -15
- package/dist/collection/implementations/async-iterable-collection/async-iterable-collection.js.map +1 -1
- package/dist/collection/implementations/iterable-collection/iterable-collection.d.ts +12 -12
- package/dist/collection/implementations/iterable-collection/iterable-collection.js +12 -12
- package/dist/collection/implementations/iterable-collection/iterable-collection.js.map +1 -1
- package/dist/collection/implementations/list-collection/list-collection.d.ts +12 -12
- package/dist/collection/implementations/list-collection/list-collection.js +12 -12
- package/dist/collection/implementations/list-collection/list-collection.js.map +1 -1
- package/dist/event-bus/contracts/event-bus-factory.contract.d.ts +1 -1
- 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 +13 -6
- package/dist/event-bus/implementations/derivables/event-bus/event-bus.js +21 -19
- 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 +5 -36
- package/dist/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.js +4 -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/kysely-lock-adapter/kysely-lock-adapter.d.ts +3 -3
- package/dist/lock/implementations/adapters/kysely-lock-adapter/kysely-lock-adapter.js +2 -2
- package/dist/lock/implementations/adapters/kysely-lock-adapter/kysely-lock-adapter.js.map +1 -1
- package/dist/lock/implementations/adapters/libsql-lock-adapter/libsql-lock-adapter.d.ts +3 -3
- package/dist/lock/implementations/adapters/libsql-lock-adapter/libsql-lock-adapter.js +2 -2
- package/dist/lock/implementations/adapters/libsql-lock-adapter/libsql-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/adapters/sqlite-lock-adapter/sqlite-lock-adapter.d.ts +4 -4
- package/dist/lock/implementations/adapters/sqlite-lock-adapter/sqlite-lock-adapter.js +3 -3
- package/dist/lock/implementations/adapters/sqlite-lock-adapter/sqlite-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/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 +1 -1
- package/dist/utilities/functions/_module-exports.js +1 -1
- package/dist/utilities/functions/_module-exports.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/types/factory.type.d.ts +13 -18
- package/dist/utilities/types/result.type.d.ts +11 -1
- package/package.json +3 -2
- 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
|
@@ -27,14 +27,14 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
27
27
|
*/
|
|
28
28
|
keys(): ICollection<number>;
|
|
29
29
|
/**
|
|
30
|
-
* The `
|
|
30
|
+
* The `copy` method returns a copy of the collection.
|
|
31
31
|
*/
|
|
32
|
-
|
|
32
|
+
copy(): ICollection<TInput>;
|
|
33
33
|
/**
|
|
34
34
|
* The `filter` method filters the collection using `predicateFn`, keeping only those items that pass `predicateFn`.
|
|
35
35
|
* @example
|
|
36
36
|
* ```ts
|
|
37
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
37
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
38
38
|
*
|
|
39
39
|
* // Assume the inputed collection is empty.
|
|
40
40
|
* function main(collection: ICollection<number>): void {
|
|
@@ -51,7 +51,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
51
51
|
* The `reject` method filters the collection using `predicateFn`, keeping only those items that not pass `predicateFn`.
|
|
52
52
|
* @example
|
|
53
53
|
* ```ts
|
|
54
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
54
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
55
55
|
*
|
|
56
56
|
* // Assume the inputed collection is empty.
|
|
57
57
|
* function main(collection: ICollection<number>): void {
|
|
@@ -69,7 +69,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
69
69
|
* The `mapFn` is free to modify the item and return it, thus forming a new collection of modified items.
|
|
70
70
|
* @example
|
|
71
71
|
* ```ts
|
|
72
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
72
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
73
73
|
*
|
|
74
74
|
* // Assume the inputed collection is empty.
|
|
75
75
|
* function main(collection: ICollection<number>): void {
|
|
@@ -87,7 +87,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
87
87
|
* The final result of running the reducer across all items of the array is a single value.
|
|
88
88
|
* @example
|
|
89
89
|
* ```ts
|
|
90
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
90
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
91
91
|
*
|
|
92
92
|
* // Assume the inputed collection is empty.
|
|
93
93
|
* function main(collection: ICollection<number>): void {
|
|
@@ -99,7 +99,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
99
99
|
* ```
|
|
100
100
|
* @example
|
|
101
101
|
* ```ts
|
|
102
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
102
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
103
103
|
*
|
|
104
104
|
* // Assume the inputed collection is empty.
|
|
105
105
|
* function main(collection: ICollection<string>): void {
|
|
@@ -125,7 +125,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
125
125
|
* @throws {TypeCollectionError}
|
|
126
126
|
* @example
|
|
127
127
|
* ```ts
|
|
128
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
128
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
129
129
|
*
|
|
130
130
|
* // Assume the inputed collection is empty.
|
|
131
131
|
* function main(collection: ICollection<number>): void {
|
|
@@ -137,7 +137,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
137
137
|
* }
|
|
138
138
|
* ```
|
|
139
139
|
* ```ts
|
|
140
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
140
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
141
141
|
*
|
|
142
142
|
* // Assume the inputed collection is empty.
|
|
143
143
|
* function main(collection: ICollection<number>): void {
|
|
@@ -154,7 +154,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
154
154
|
* The `collapse` method collapses a collection of iterables into a single, flat collection.
|
|
155
155
|
* @example
|
|
156
156
|
* ```ts
|
|
157
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
157
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
158
158
|
*
|
|
159
159
|
* // Assume the inputed collection is empty.
|
|
160
160
|
* function main(collection: ICollection<number[]>): void {
|
|
@@ -172,7 +172,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
172
172
|
* It is identical to a `map` method followed by a `collapse` method.
|
|
173
173
|
* @example
|
|
174
174
|
* ```ts
|
|
175
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
175
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
176
176
|
*
|
|
177
177
|
* // Assume the inputed collection is empty.
|
|
178
178
|
* function main(collection: ICollection<string[]>): void {
|
|
@@ -189,7 +189,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
189
189
|
* The `change` method changes only the items that passes `predicateFn` using `mapFn`.
|
|
190
190
|
* @example
|
|
191
191
|
* ```ts
|
|
192
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
192
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
193
193
|
*
|
|
194
194
|
* // Assume the inputed collection is empty.
|
|
195
195
|
* function main(collection: ICollection<number>): void {
|
|
@@ -206,7 +206,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
206
206
|
* The `set` method changes a item by i>index` using `value`.
|
|
207
207
|
* @example
|
|
208
208
|
* ```ts
|
|
209
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
209
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
210
210
|
*
|
|
211
211
|
* // Assume the inputed collection is empty.
|
|
212
212
|
* function main(collection: ICollection<number>): void {
|
|
@@ -219,7 +219,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
219
219
|
* ```
|
|
220
220
|
* @example
|
|
221
221
|
* ```ts
|
|
222
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
222
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
223
223
|
*
|
|
224
224
|
* // Assume the inputed collection is empty.
|
|
225
225
|
* function main(collection: ICollection<number>): void {
|
|
@@ -236,7 +236,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
236
236
|
* The `get` method returns the item by index. If the item is not found null will returned.
|
|
237
237
|
* @example
|
|
238
238
|
* ```ts
|
|
239
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
239
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
240
240
|
*
|
|
241
241
|
* // Assume the inputed collection is empty.
|
|
242
242
|
* function main(collection: ICollection<number>): void {
|
|
@@ -256,7 +256,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
256
256
|
* @throws {ItemNotFoundCollectionError} {@link ItemNotFoundCollectionError}
|
|
257
257
|
* @example
|
|
258
258
|
* ```ts
|
|
259
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
259
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
260
260
|
*
|
|
261
261
|
* // Assume the inputed collection is empty.
|
|
262
262
|
* function main(collection: ICollection<number>): void {
|
|
@@ -275,7 +275,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
275
275
|
* The `page` method returns a new collection containing the items that would be present on ` page ` with custom ` pageSize `.
|
|
276
276
|
* @example
|
|
277
277
|
* ```ts
|
|
278
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
278
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
279
279
|
*
|
|
280
280
|
* // Assume the inputed collection is empty.
|
|
281
281
|
* function main(collection: ICollection<number>): void {
|
|
@@ -295,7 +295,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
295
295
|
* @throws {EmptyCollectionError} {@link EmptyCollectionError}
|
|
296
296
|
* @example
|
|
297
297
|
* ```ts
|
|
298
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
298
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
299
299
|
*
|
|
300
300
|
* // Assume the inputed collection is empty.
|
|
301
301
|
* function main(collection: ICollection<number>): void {
|
|
@@ -314,7 +314,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
314
314
|
* @throws {EmptyCollectionError} {@link EmptyCollectionError}
|
|
315
315
|
* @example
|
|
316
316
|
* ```ts
|
|
317
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
317
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
318
318
|
*
|
|
319
319
|
* // Assume the inputed collection is empty.
|
|
320
320
|
* function main(collection: ICollection<number>): void {
|
|
@@ -333,7 +333,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
333
333
|
* @throws {EmptyCollectionError} {@link EmptyCollectionError}
|
|
334
334
|
* @example
|
|
335
335
|
* ```ts
|
|
336
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
336
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
337
337
|
*
|
|
338
338
|
* // Assume the inputed collection is empty.
|
|
339
339
|
* function main(collection: ICollection<number>): void {
|
|
@@ -352,7 +352,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
352
352
|
* @throws {EmptyCollectionError} {@link EmptyCollectionError}
|
|
353
353
|
* @example
|
|
354
354
|
* ```ts
|
|
355
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
355
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
356
356
|
*
|
|
357
357
|
* // Assume the inputed collection is empty.
|
|
358
358
|
* function main(collection: ICollection<number>): void {
|
|
@@ -371,7 +371,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
371
371
|
* @throws {EmptyCollectionError} {@link EmptyCollectionError}
|
|
372
372
|
* @example
|
|
373
373
|
* ```ts
|
|
374
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
374
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
375
375
|
*
|
|
376
376
|
* // Assume the inputed collection is empty.
|
|
377
377
|
* function main(collection: ICollection<number>): void {
|
|
@@ -389,7 +389,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
389
389
|
* @throws {EmptyCollectionError} {@link EmptyCollectionError}
|
|
390
390
|
* @example
|
|
391
391
|
* ```ts
|
|
392
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
392
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
393
393
|
*
|
|
394
394
|
* // Assume the inputed collection is empty.
|
|
395
395
|
* function main(collection: ICollection<number>): void {
|
|
@@ -405,7 +405,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
405
405
|
* The `some` method determines whether at least one item in the collection matches `predicateFn`.
|
|
406
406
|
* @example
|
|
407
407
|
* ```ts
|
|
408
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
408
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
409
409
|
*
|
|
410
410
|
* // Assume the inputed collection is empty.
|
|
411
411
|
* function main(collection: ICollection<number>): void {
|
|
@@ -421,7 +421,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
421
421
|
* The `every` method determines whether all items in the collection matches `predicateFn`.
|
|
422
422
|
* @example
|
|
423
423
|
* ```ts
|
|
424
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
424
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
425
425
|
*
|
|
426
426
|
* // Assume the inputed collection is empty.
|
|
427
427
|
* function main(collection: ICollection<number>): void {
|
|
@@ -437,7 +437,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
437
437
|
* The `take` method takes the first `limit` items.
|
|
438
438
|
* @example
|
|
439
439
|
* ```ts
|
|
440
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
440
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
441
441
|
*
|
|
442
442
|
* // Assume the inputed collection is empty.
|
|
443
443
|
* function main(collection: ICollection<number>): void {
|
|
@@ -451,7 +451,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
451
451
|
*
|
|
452
452
|
* @example
|
|
453
453
|
* ```ts
|
|
454
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
454
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
455
455
|
*
|
|
456
456
|
* // Assume the inputed collection is empty.
|
|
457
457
|
* function main(collection: ICollection<number>): void {
|
|
@@ -468,7 +468,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
468
468
|
* The `takeUntil` method takes items until `predicateFn` returns true.
|
|
469
469
|
* @example
|
|
470
470
|
* ```ts
|
|
471
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
471
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
472
472
|
*
|
|
473
473
|
* // Assume the inputed collection is empty.
|
|
474
474
|
* function main(collection: ICollection<number>): void {
|
|
@@ -485,7 +485,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
485
485
|
* The `takeWhile` method takes items until `predicateFn` returns false.
|
|
486
486
|
* @example
|
|
487
487
|
* ```ts
|
|
488
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
488
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
489
489
|
*
|
|
490
490
|
* // Assume the inputed collection is empty.
|
|
491
491
|
* function main(collection: ICollection<number>): void {
|
|
@@ -502,7 +502,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
502
502
|
* The `skip` method skips the first `offset` items.
|
|
503
503
|
* @example
|
|
504
504
|
* ```ts
|
|
505
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
505
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
506
506
|
*
|
|
507
507
|
* // Assume the inputed collection is empty.
|
|
508
508
|
* function main(collection: ICollection<number>): void {
|
|
@@ -519,7 +519,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
519
519
|
* The `skipUntil` method skips items until `predicateFn` returns true.
|
|
520
520
|
* @example
|
|
521
521
|
* ```ts
|
|
522
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
522
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
523
523
|
*
|
|
524
524
|
* // Assume the inputed collection is empty.
|
|
525
525
|
* function main(collection: ICollection<number>): void {
|
|
@@ -536,7 +536,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
536
536
|
* The `skipWhile` method skips items until `predicateFn` returns false.
|
|
537
537
|
* @example
|
|
538
538
|
* ```ts
|
|
539
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
539
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
540
540
|
*
|
|
541
541
|
* // Assume the inputed collection is empty.
|
|
542
542
|
* function main(collection: ICollection<number>): void {
|
|
@@ -553,7 +553,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
553
553
|
* The `when` method will execute `callback` when `condition` evaluates to true.
|
|
554
554
|
* @example
|
|
555
555
|
* ```ts
|
|
556
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
556
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
557
557
|
*
|
|
558
558
|
* // Assume the inputed collection is empty.
|
|
559
559
|
* function main(collection: ICollection<number>): void {
|
|
@@ -571,7 +571,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
571
571
|
* The `whenEmpty` method will execute `callback` when the collection is empty.
|
|
572
572
|
* @example
|
|
573
573
|
* ```ts
|
|
574
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
574
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
575
575
|
*
|
|
576
576
|
* // Assume the inputed collection is empty.
|
|
577
577
|
* function main(collection: ICollection<number>): void {
|
|
@@ -584,7 +584,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
584
584
|
* ```
|
|
585
585
|
* @example
|
|
586
586
|
* ```ts
|
|
587
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
587
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
588
588
|
*
|
|
589
589
|
* // Assume the inputed collection is empty.
|
|
590
590
|
* function main(collection: ICollection<number>): void {
|
|
@@ -601,7 +601,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
601
601
|
* The `whenNot` method will execute `callback` when `condition` evaluates to false.
|
|
602
602
|
* @example
|
|
603
603
|
* ```ts
|
|
604
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
604
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
605
605
|
*
|
|
606
606
|
* // Assume the inputed collection is empty.
|
|
607
607
|
* function main(collection: ICollection<number>): void {
|
|
@@ -618,7 +618,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
618
618
|
* The `whenNotEmpty` method will execute `callback` when the collection is not empty.
|
|
619
619
|
* @example
|
|
620
620
|
* ```ts
|
|
621
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
621
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
622
622
|
*
|
|
623
623
|
* // Assume the inputed collection is empty.
|
|
624
624
|
* function main(collection: ICollection<number>): void {
|
|
@@ -630,7 +630,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
630
630
|
* ```
|
|
631
631
|
* @example
|
|
632
632
|
* ```ts
|
|
633
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
633
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
634
634
|
*
|
|
635
635
|
* // Assume the inputed collection is empty.
|
|
636
636
|
* function main(collection: ICollection<number>): void {
|
|
@@ -648,7 +648,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
648
648
|
* This method is useful when you want compose multiple smaller functions.
|
|
649
649
|
* @example
|
|
650
650
|
* ```ts
|
|
651
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
651
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
652
652
|
*
|
|
653
653
|
* // Assume the inputed collection is empty.
|
|
654
654
|
* function main(collection: ICollection<number>): void {
|
|
@@ -677,7 +677,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
677
677
|
* The `tap` method passes a copy of the original collection to `callback`, allowing you to do something with the items while not affecting the original collection.
|
|
678
678
|
* @example
|
|
679
679
|
* ```ts
|
|
680
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
680
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
681
681
|
*
|
|
682
682
|
* // Assume the inputed collection is empty.
|
|
683
683
|
* function main(collection: ICollection<number>): void {
|
|
@@ -698,7 +698,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
698
698
|
* If `chunkSize` is not divisible with total number of items then the last chunk will contain the remaining items.
|
|
699
699
|
* @example
|
|
700
700
|
* ```ts
|
|
701
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
701
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
702
702
|
*
|
|
703
703
|
* // Assume the inputed collection is empty.
|
|
704
704
|
* function main(collection: ICollection<number>): void {
|
|
@@ -715,7 +715,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
715
715
|
* The chunk variable passed to the `predicateFn` may be used to inspect the previous item.
|
|
716
716
|
* @example
|
|
717
717
|
* ```ts
|
|
718
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
718
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
719
719
|
*
|
|
720
720
|
* // Assume the inputed collection is empty.
|
|
721
721
|
* function main(collection: ICollection<string>): void {
|
|
@@ -735,7 +735,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
735
735
|
* The `split` method breaks a collection evenly into `chunkAmount` of chunks.
|
|
736
736
|
* @example
|
|
737
737
|
* ```ts
|
|
738
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
738
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
739
739
|
*
|
|
740
740
|
* // Assume the inputed collection is empty.
|
|
741
741
|
* function main(collection: ICollection<number>): void {
|
|
@@ -749,7 +749,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
749
749
|
* ```
|
|
750
750
|
* @example
|
|
751
751
|
* ```ts
|
|
752
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
752
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
753
753
|
*
|
|
754
754
|
* // Assume the inputed collection is empty.
|
|
755
755
|
* function main(collection: ICollection<number>): void {
|
|
@@ -763,7 +763,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
763
763
|
* ```
|
|
764
764
|
* @example
|
|
765
765
|
* ```ts
|
|
766
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
766
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
767
767
|
*
|
|
768
768
|
* // Assume the inputed collection is empty.
|
|
769
769
|
* function main(collection: ICollection<number>): void {
|
|
@@ -781,7 +781,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
781
781
|
* The `partition` method is used to separate items that pass `predicateFn` from those that do not.
|
|
782
782
|
* @example
|
|
783
783
|
* ```ts
|
|
784
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
784
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
785
785
|
*
|
|
786
786
|
* // Assume the inputed collection is empty.
|
|
787
787
|
* function main(collection: ICollection<number>): void {
|
|
@@ -799,7 +799,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
799
799
|
* The `sliding` method returns a new collection of chunks representing a "sliding window" view of the items in the collection.
|
|
800
800
|
* @example
|
|
801
801
|
* ```ts
|
|
802
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
802
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
803
803
|
*
|
|
804
804
|
* // Assume the inputed collection is empty.
|
|
805
805
|
* function main(collection: ICollection<number>): void {
|
|
@@ -818,7 +818,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
818
818
|
* By default the equality check occurs on the item.
|
|
819
819
|
* @example
|
|
820
820
|
* ```ts
|
|
821
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
821
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
822
822
|
*
|
|
823
823
|
* // Assume the inputed collection is empty.
|
|
824
824
|
* function main(collection: ICollection<string>): void {
|
|
@@ -845,7 +845,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
845
845
|
* ```
|
|
846
846
|
* @example
|
|
847
847
|
* ```ts
|
|
848
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
848
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
849
849
|
*
|
|
850
850
|
* // Assume the inputed collection is empty.
|
|
851
851
|
* function main(collection: ICollection<string>): void {
|
|
@@ -873,7 +873,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
873
873
|
* By default the equality check occurs on the item.
|
|
874
874
|
* @example
|
|
875
875
|
* ```ts
|
|
876
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
876
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
877
877
|
*
|
|
878
878
|
* // Assume the inputed collection is empty.
|
|
879
879
|
* function main(collection: ICollection<string>): void {
|
|
@@ -891,7 +891,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
891
891
|
* ```
|
|
892
892
|
* @example
|
|
893
893
|
* ```ts
|
|
894
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
894
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
895
895
|
*
|
|
896
896
|
* // Assume the inputed collection is empty.
|
|
897
897
|
* function main(collection: ICollection<string>): void {
|
|
@@ -912,7 +912,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
912
912
|
* By default the equality check occurs on the item.
|
|
913
913
|
* @example
|
|
914
914
|
* ```ts
|
|
915
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
915
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
916
916
|
*
|
|
917
917
|
* // Assume the inputed collection is empty.
|
|
918
918
|
* function main(collection: ICollection<number>): void {
|
|
@@ -925,7 +925,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
925
925
|
* ```
|
|
926
926
|
* @example
|
|
927
927
|
* ```ts
|
|
928
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
928
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
929
929
|
*
|
|
930
930
|
* type Phone = {
|
|
931
931
|
* name: string;
|
|
@@ -958,7 +958,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
958
958
|
* By default the equality check occurs on the item.
|
|
959
959
|
* @example
|
|
960
960
|
* ```ts
|
|
961
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
961
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
962
962
|
*
|
|
963
963
|
* // Assume the inputed collection is empty.
|
|
964
964
|
* function main(collection: ICollection<number>): void {
|
|
@@ -971,7 +971,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
971
971
|
* ```
|
|
972
972
|
* @example
|
|
973
973
|
* ```ts
|
|
974
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
974
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
975
975
|
*
|
|
976
976
|
* type Phone = {
|
|
977
977
|
* name: string;
|
|
@@ -1009,7 +1009,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1009
1009
|
* The `repeat` method will repeat the original collection `amount` times.
|
|
1010
1010
|
* @example
|
|
1011
1011
|
* ```ts
|
|
1012
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1012
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1013
1013
|
*
|
|
1014
1014
|
* // Assume the inputed collection is empty.
|
|
1015
1015
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1027,7 +1027,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1027
1027
|
* The padding is applied from the start of this collection.
|
|
1028
1028
|
* @example
|
|
1029
1029
|
* ```ts
|
|
1030
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1030
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1031
1031
|
*
|
|
1032
1032
|
* // Assume the inputed collection is empty.
|
|
1033
1033
|
* function main(collection: ICollection<string>): void {
|
|
@@ -1075,7 +1075,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1075
1075
|
* The padding is applied from the end of this collection.
|
|
1076
1076
|
* @example
|
|
1077
1077
|
* ```ts
|
|
1078
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1078
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1079
1079
|
*
|
|
1080
1080
|
* // Assume the inputed collection is empty.
|
|
1081
1081
|
* function main(collection: ICollection<string>): void {
|
|
@@ -1088,7 +1088,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1088
1088
|
* ```
|
|
1089
1089
|
* @example
|
|
1090
1090
|
* ```ts
|
|
1091
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1091
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1092
1092
|
*
|
|
1093
1093
|
* // Assume the inputed collection is empty.
|
|
1094
1094
|
* function main(collection: ICollection<string>): void {
|
|
@@ -1101,7 +1101,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1101
1101
|
* ```
|
|
1102
1102
|
* @example
|
|
1103
1103
|
* ```ts
|
|
1104
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1104
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1105
1105
|
*
|
|
1106
1106
|
* // Assume the inputed collection is empty.
|
|
1107
1107
|
* function main(collection: ICollection<string>): void {
|
|
@@ -1115,7 +1115,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1115
1115
|
* ```
|
|
1116
1116
|
* @example
|
|
1117
1117
|
* ```ts
|
|
1118
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1118
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1119
1119
|
*
|
|
1120
1120
|
* // Assume the inputed collection is empty.
|
|
1121
1121
|
* function main(collection: ICollection<string>): void {
|
|
@@ -1133,7 +1133,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1133
1133
|
* where `start` and `end` (end not included) represent the index of items in the collection.
|
|
1134
1134
|
* @example
|
|
1135
1135
|
* ```ts
|
|
1136
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1136
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1137
1137
|
*
|
|
1138
1138
|
* // Assume the inputed collection is empty.
|
|
1139
1139
|
* function main(collection: ICollection<string>): void {
|
|
@@ -1146,7 +1146,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1146
1146
|
* ```
|
|
1147
1147
|
* @example
|
|
1148
1148
|
* ```ts
|
|
1149
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1149
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1150
1150
|
*
|
|
1151
1151
|
* // Assume the inputed collection is empty.
|
|
1152
1152
|
* function main(collection: ICollection<string>): void {
|
|
@@ -1159,7 +1159,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1159
1159
|
* ```
|
|
1160
1160
|
* @example
|
|
1161
1161
|
* ```ts
|
|
1162
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1162
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1163
1163
|
*
|
|
1164
1164
|
* // Assume the inputed collection is empty.
|
|
1165
1165
|
* function main(collection: ICollection<string>): void {
|
|
@@ -1172,7 +1172,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1172
1172
|
* ```
|
|
1173
1173
|
* @example
|
|
1174
1174
|
* ```ts
|
|
1175
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1175
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1176
1176
|
*
|
|
1177
1177
|
* // Assume the inputed collection is empty.
|
|
1178
1178
|
* function main(collection: ICollection<string>): void {
|
|
@@ -1185,7 +1185,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1185
1185
|
* ```
|
|
1186
1186
|
* @example
|
|
1187
1187
|
* ```ts
|
|
1188
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1188
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1189
1189
|
*
|
|
1190
1190
|
* // Assume the inputed collection is empty.
|
|
1191
1191
|
* function main(collection: ICollection<string>): void {
|
|
@@ -1198,7 +1198,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1198
1198
|
* ```
|
|
1199
1199
|
* @example
|
|
1200
1200
|
* ```ts
|
|
1201
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1201
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1202
1202
|
*
|
|
1203
1203
|
* // Assume the inputed collection is empty.
|
|
1204
1204
|
* function main(collection: ICollection<string>): void {
|
|
@@ -1215,7 +1215,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1215
1215
|
* The `prepend` method adds `iterable` to the beginning of the collection.
|
|
1216
1216
|
* @example
|
|
1217
1217
|
* ```ts
|
|
1218
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1218
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1219
1219
|
*
|
|
1220
1220
|
* // Assume the inputed collection is empty.
|
|
1221
1221
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1232,7 +1232,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1232
1232
|
* The `append` method adds `iterable` to the end of the collection.
|
|
1233
1233
|
* @example
|
|
1234
1234
|
* ```ts
|
|
1235
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1235
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1236
1236
|
*
|
|
1237
1237
|
* // Assume the inputed collection is empty.
|
|
1238
1238
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1249,7 +1249,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1249
1249
|
* The `insertBefore` method adds `iterable` before the first item that matches `predicateFn`.
|
|
1250
1250
|
* @example
|
|
1251
1251
|
* ```ts
|
|
1252
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1252
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1253
1253
|
*
|
|
1254
1254
|
* // Assume the inputed collection is empty.
|
|
1255
1255
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1266,7 +1266,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1266
1266
|
* The `insertAfter` method adds `iterable` after the first item that matches `predicateFn`.
|
|
1267
1267
|
* @example
|
|
1268
1268
|
* ```ts
|
|
1269
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1269
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1270
1270
|
*
|
|
1271
1271
|
* // Assume the inputed collection is empty.
|
|
1272
1272
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1283,7 +1283,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1283
1283
|
* The `crossJoin` method cross joins the collection's values among `iterables`, returning a Cartesian product with all possible permutations.
|
|
1284
1284
|
* @example
|
|
1285
1285
|
* ```ts
|
|
1286
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1286
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1287
1287
|
*
|
|
1288
1288
|
* // Assume the inputed collection is empty.
|
|
1289
1289
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1301,7 +1301,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1301
1301
|
* ```
|
|
1302
1302
|
* @example
|
|
1303
1303
|
* ```ts
|
|
1304
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1304
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1305
1305
|
*
|
|
1306
1306
|
* // Assume the inputed collection is empty.
|
|
1307
1307
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1329,7 +1329,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1329
1329
|
* The returned collection has size of the shortest collection.
|
|
1330
1330
|
* @example
|
|
1331
1331
|
* ```ts
|
|
1332
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1332
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1333
1333
|
*
|
|
1334
1334
|
* // Assume the inputed collection is empty.
|
|
1335
1335
|
* function main(collection: ICollection<string>): void {
|
|
@@ -1342,7 +1342,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1342
1342
|
* ```
|
|
1343
1343
|
* @example
|
|
1344
1344
|
* ```ts
|
|
1345
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1345
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1346
1346
|
*
|
|
1347
1347
|
* // Assume the inputed collection is empty.
|
|
1348
1348
|
* function main(collection: ICollection<string>): void {
|
|
@@ -1355,7 +1355,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1355
1355
|
* ```
|
|
1356
1356
|
* @example
|
|
1357
1357
|
* ```ts
|
|
1358
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1358
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1359
1359
|
*
|
|
1360
1360
|
* // Assume the inputed collection is empty.
|
|
1361
1361
|
* function main(collection: ICollection<string>): void {
|
|
@@ -1372,7 +1372,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1372
1372
|
* The `sort` method sorts the collection. You can provide a `comparator` function.
|
|
1373
1373
|
* @example
|
|
1374
1374
|
* ```ts
|
|
1375
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1375
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1376
1376
|
*
|
|
1377
1377
|
* // Assume the inputed collection is empty.
|
|
1378
1378
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1385,7 +1385,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1385
1385
|
* ```
|
|
1386
1386
|
* @example
|
|
1387
1387
|
* ```ts
|
|
1388
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1388
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1389
1389
|
*
|
|
1390
1390
|
* type Person = {
|
|
1391
1391
|
* name: string;
|
|
@@ -1418,7 +1418,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1418
1418
|
* The reversing of the collection will be applied in chunks that are the size of ` chunkSize `.
|
|
1419
1419
|
* @example
|
|
1420
1420
|
* ```ts
|
|
1421
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1421
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1422
1422
|
*
|
|
1423
1423
|
* // Assume the inputed collection is empty.
|
|
1424
1424
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1440,7 +1440,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1440
1440
|
* By default it will get the first item. If the collection is empty or no items passes ` predicateFn ` than null i returned.
|
|
1441
1441
|
* @example
|
|
1442
1442
|
* ```ts
|
|
1443
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1443
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1444
1444
|
*
|
|
1445
1445
|
* // Assume the inputed collection is empty.
|
|
1446
1446
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1452,7 +1452,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1452
1452
|
* ```
|
|
1453
1453
|
* @example
|
|
1454
1454
|
* ```ts
|
|
1455
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1455
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1456
1456
|
*
|
|
1457
1457
|
* // Assume the inputed collection is empty.
|
|
1458
1458
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1464,7 +1464,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1464
1464
|
* ```
|
|
1465
1465
|
* @example
|
|
1466
1466
|
* ```ts
|
|
1467
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1467
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1468
1468
|
*
|
|
1469
1469
|
* // Assume the inputed collection is empty.
|
|
1470
1470
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1482,7 +1482,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1482
1482
|
* By default it will get the first item. If the collection is empty or no items passes ` predicateFn ` than ` defaultValue `.
|
|
1483
1483
|
* @example
|
|
1484
1484
|
* ```ts
|
|
1485
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1485
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1486
1486
|
*
|
|
1487
1487
|
* // Assume the inputed collection is empty.
|
|
1488
1488
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1494,7 +1494,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1494
1494
|
* ```
|
|
1495
1495
|
* @example
|
|
1496
1496
|
* ```ts
|
|
1497
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1497
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1498
1498
|
*
|
|
1499
1499
|
* // Assume the inputed collection is empty.
|
|
1500
1500
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1506,7 +1506,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1506
1506
|
* ```
|
|
1507
1507
|
* @example
|
|
1508
1508
|
* ```ts
|
|
1509
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1509
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1510
1510
|
*
|
|
1511
1511
|
* // Assume the inputed collection is empty.
|
|
1512
1512
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1518,7 +1518,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1518
1518
|
* ```
|
|
1519
1519
|
* @example
|
|
1520
1520
|
* ```ts
|
|
1521
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1521
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1522
1522
|
*
|
|
1523
1523
|
* // Assume the inputed collection is empty.
|
|
1524
1524
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1536,7 +1536,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1536
1536
|
* @throws {ItemNotFoundCollectionError} {@link ItemNotFoundCollectionError}
|
|
1537
1537
|
* @example
|
|
1538
1538
|
* ```ts
|
|
1539
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1539
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1540
1540
|
*
|
|
1541
1541
|
* // Assume the inputed collection is empty.
|
|
1542
1542
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1548,7 +1548,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1548
1548
|
* ```
|
|
1549
1549
|
* @example
|
|
1550
1550
|
* ```ts
|
|
1551
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1551
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1552
1552
|
*
|
|
1553
1553
|
* // Assume the inputed collection is empty.
|
|
1554
1554
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1560,7 +1560,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1560
1560
|
* ```
|
|
1561
1561
|
* @example
|
|
1562
1562
|
* ```ts
|
|
1563
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1563
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1564
1564
|
*
|
|
1565
1565
|
* // Assume the inputed collection is empty.
|
|
1566
1566
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1577,7 +1577,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1577
1577
|
* By default it will get the last item. If the collection is empty or no items passes ` predicateFn ` than null i returned.
|
|
1578
1578
|
* @example
|
|
1579
1579
|
* ```ts
|
|
1580
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1580
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1581
1581
|
*
|
|
1582
1582
|
* // Assume the inputed collection is empty.
|
|
1583
1583
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1589,7 +1589,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1589
1589
|
* ```
|
|
1590
1590
|
* @example
|
|
1591
1591
|
* ```ts
|
|
1592
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1592
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1593
1593
|
*
|
|
1594
1594
|
* // Assume the inputed collection is empty.
|
|
1595
1595
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1601,7 +1601,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1601
1601
|
* ```
|
|
1602
1602
|
* @example
|
|
1603
1603
|
* ```ts
|
|
1604
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1604
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1605
1605
|
*
|
|
1606
1606
|
* // Assume the inputed collection is empty.
|
|
1607
1607
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1618,7 +1618,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1618
1618
|
* By default it will get the last item. If the collection is empty or no items passes ` predicateFn ` than ` defaultValue `.
|
|
1619
1619
|
* @example
|
|
1620
1620
|
* ```ts
|
|
1621
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1621
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1622
1622
|
*
|
|
1623
1623
|
* // Assume the inputed collection is empty.
|
|
1624
1624
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1630,7 +1630,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1630
1630
|
* ```
|
|
1631
1631
|
* @example
|
|
1632
1632
|
* ```ts
|
|
1633
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1633
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1634
1634
|
*
|
|
1635
1635
|
* // Assume the inputed collection is empty.
|
|
1636
1636
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1642,7 +1642,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1642
1642
|
* ```
|
|
1643
1643
|
* @example
|
|
1644
1644
|
* ```ts
|
|
1645
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1645
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1646
1646
|
*
|
|
1647
1647
|
* // Assume the inputed collection is empty.
|
|
1648
1648
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1654,7 +1654,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1654
1654
|
* ```
|
|
1655
1655
|
* @example
|
|
1656
1656
|
* ```ts
|
|
1657
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1657
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1658
1658
|
*
|
|
1659
1659
|
* // Assume the inputed collection is empty.
|
|
1660
1660
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1672,7 +1672,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1672
1672
|
* @throws {ItemNotFoundCollectionError} {@link ItemNotFoundCollectionError}
|
|
1673
1673
|
* @example
|
|
1674
1674
|
* ```ts
|
|
1675
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1675
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1676
1676
|
*
|
|
1677
1677
|
* // Assume the inputed collection is empty.
|
|
1678
1678
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1684,7 +1684,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1684
1684
|
* ```
|
|
1685
1685
|
* @example
|
|
1686
1686
|
* ```ts
|
|
1687
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1687
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1688
1688
|
*
|
|
1689
1689
|
* // Assume the inputed collection is empty.
|
|
1690
1690
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1696,7 +1696,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1696
1696
|
* ```
|
|
1697
1697
|
* @example
|
|
1698
1698
|
* ```ts
|
|
1699
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1699
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1700
1700
|
*
|
|
1701
1701
|
* // Assume the inputed collection is empty.
|
|
1702
1702
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1713,7 +1713,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1713
1713
|
* If the `predicateFn` does not match or matches the first item then null is returned.
|
|
1714
1714
|
* @example
|
|
1715
1715
|
* ```ts
|
|
1716
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1716
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1717
1717
|
*
|
|
1718
1718
|
* // Assume the inputed collection is empty.
|
|
1719
1719
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1725,7 +1725,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1725
1725
|
* ```
|
|
1726
1726
|
* @example
|
|
1727
1727
|
* ```ts
|
|
1728
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1728
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1729
1729
|
*
|
|
1730
1730
|
* // Assume the inputed collection is empty.
|
|
1731
1731
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1742,7 +1742,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1742
1742
|
* If the collection is empty or the `predicateFn` does not match or matches the first item then `defaultValue` is returned.
|
|
1743
1743
|
* @example
|
|
1744
1744
|
* ```ts
|
|
1745
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1745
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1746
1746
|
*
|
|
1747
1747
|
* // Assume the inputed collection is empty.
|
|
1748
1748
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1754,7 +1754,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1754
1754
|
* ```
|
|
1755
1755
|
* @example
|
|
1756
1756
|
* ```ts
|
|
1757
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1757
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1758
1758
|
*
|
|
1759
1759
|
* // Assume the inputed collection is empty.
|
|
1760
1760
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1766,7 +1766,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1766
1766
|
* ```
|
|
1767
1767
|
* @example
|
|
1768
1768
|
* ```ts
|
|
1769
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1769
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1770
1770
|
*
|
|
1771
1771
|
* // Assume the inputed collection is empty.
|
|
1772
1772
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1784,7 +1784,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1784
1784
|
* @throws {ItemNotFoundCollectionError} {@link ItemNotFoundCollectionError}
|
|
1785
1785
|
* @example
|
|
1786
1786
|
* ```ts
|
|
1787
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1787
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1788
1788
|
*
|
|
1789
1789
|
* // Assume the inputed collection is empty.
|
|
1790
1790
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1796,7 +1796,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1796
1796
|
* ```
|
|
1797
1797
|
* @example
|
|
1798
1798
|
* ```ts
|
|
1799
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1799
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1800
1800
|
*
|
|
1801
1801
|
* // Assume the inputed collection is empty.
|
|
1802
1802
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1813,7 +1813,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1813
1813
|
* If the collection is empty or the `predicateFn` does not match or matches the last item then null is returned.
|
|
1814
1814
|
* @example
|
|
1815
1815
|
* ```ts
|
|
1816
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1816
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1817
1817
|
*
|
|
1818
1818
|
* // Assume the inputed collection is empty.
|
|
1819
1819
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1825,7 +1825,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1825
1825
|
* ```
|
|
1826
1826
|
* @example
|
|
1827
1827
|
* ```ts
|
|
1828
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1828
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1829
1829
|
*
|
|
1830
1830
|
* // Assume the inputed collection is empty.
|
|
1831
1831
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1842,7 +1842,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1842
1842
|
* If the collection is empty or the `predicateFn` does not match or matches the last item then `defaultValue` is returned.
|
|
1843
1843
|
* @example
|
|
1844
1844
|
* ```ts
|
|
1845
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1845
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1846
1846
|
*
|
|
1847
1847
|
* // Assume the inputed collection is empty.
|
|
1848
1848
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1854,7 +1854,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1854
1854
|
* ```
|
|
1855
1855
|
* @example
|
|
1856
1856
|
* ```ts
|
|
1857
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1857
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1858
1858
|
*
|
|
1859
1859
|
* // Assume the inputed collection is empty.
|
|
1860
1860
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1866,7 +1866,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1866
1866
|
* ```
|
|
1867
1867
|
* @example
|
|
1868
1868
|
* ```ts
|
|
1869
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1869
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1870
1870
|
*
|
|
1871
1871
|
* // Assume the inputed collection is empty.
|
|
1872
1872
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1884,7 +1884,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1884
1884
|
* @throws {ItemNotFoundCollectionError} {@link ItemNotFoundCollectionError}
|
|
1885
1885
|
* @example
|
|
1886
1886
|
* ```ts
|
|
1887
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1887
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1888
1888
|
*
|
|
1889
1889
|
* // Assume the inputed collection is empty.
|
|
1890
1890
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1896,7 +1896,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1896
1896
|
* ```
|
|
1897
1897
|
* @example
|
|
1898
1898
|
* ```ts
|
|
1899
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1899
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1900
1900
|
*
|
|
1901
1901
|
* // Assume the inputed collection is empty.
|
|
1902
1902
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1915,7 +1915,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1915
1915
|
* @throws {MultipleItemsFoundCollectionError} {@link MultipleItemsFoundCollectionError}
|
|
1916
1916
|
* @example
|
|
1917
1917
|
* ```ts
|
|
1918
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1918
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1919
1919
|
*
|
|
1920
1920
|
* // Assume the inputed collection is empty.
|
|
1921
1921
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1927,7 +1927,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1927
1927
|
* ```
|
|
1928
1928
|
* @example
|
|
1929
1929
|
* ```ts
|
|
1930
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1930
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1931
1931
|
*
|
|
1932
1932
|
* // Assume the inputed collection is empty.
|
|
1933
1933
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1939,7 +1939,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1939
1939
|
* ```
|
|
1940
1940
|
* @example
|
|
1941
1941
|
* ```ts
|
|
1942
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1942
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1943
1943
|
*
|
|
1944
1944
|
* // Assume the inputed collection is empty.
|
|
1945
1945
|
* function main(collection: ICollection<number>): void {
|
|
@@ -1955,7 +1955,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1955
1955
|
* The `nth` method creates a new collection consisting of every n-th item.
|
|
1956
1956
|
* @example
|
|
1957
1957
|
* ```ts
|
|
1958
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1958
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1959
1959
|
*
|
|
1960
1960
|
* // Assume the inputed collection is empty.
|
|
1961
1961
|
* function main(collection: ICollection<string>): void {
|
|
@@ -1972,7 +1972,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
1972
1972
|
* The `count` method returns the total number of items in the collection that passes `predicateFn`.
|
|
1973
1973
|
* @example
|
|
1974
1974
|
* ```ts
|
|
1975
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
1975
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
1976
1976
|
*
|
|
1977
1977
|
* // Assume the inputed collection is empty.
|
|
1978
1978
|
* function main(collection: ICollection<number>): void {
|
|
@@ -2000,7 +2000,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
2000
2000
|
* The `searchFirst` return the index of the first item that matches `predicateFn`.
|
|
2001
2001
|
* @example
|
|
2002
2002
|
* ```ts
|
|
2003
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
2003
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
2004
2004
|
*
|
|
2005
2005
|
* // Assume the inputed collection is empty.
|
|
2006
2006
|
* function main(collection: ICollection<string>): void {
|
|
@@ -2016,7 +2016,7 @@ export type ICollection<TInput = unknown> = Iterable<TInput> & ISerializable<TIn
|
|
|
2016
2016
|
* The `searchLast` return the index of the last item that matches `predicateFn`.
|
|
2017
2017
|
* @example
|
|
2018
2018
|
* ```ts
|
|
2019
|
-
* import type { ICollection } from "@daiso-tech/core";
|
|
2019
|
+
* import type { ICollection } from "@daiso-tech/core/collection/contracts";
|
|
2020
2020
|
*
|
|
2021
2021
|
* // Assume the inputed collection is empty.
|
|
2022
2022
|
* function main(collection: ICollection<string>): void {
|