@daiso-tech/core 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.changeset/README.md +8 -0
- package/.changeset/config.json +11 -0
- package/.changeset/sweet-peas-beg.md +5 -0
- package/.eslintignore +3 -0
- package/.eslintrc.json +50 -0
- package/.gitattributes +6 -0
- package/.github/workflows/main.yaml +54 -0
- package/.github/workflows/release.yaml +31 -0
- package/.prettierignore +4 -0
- package/.prettierrc.json +4 -0
- package/.vscode/settings.json +46 -0
- package/LICENSE.md +194 -0
- package/docs-api/.nojekyll +1 -0
- package/docs-api/assets/highlight.css +92 -0
- package/docs-api/assets/icons.js +18 -0
- package/docs-api/assets/icons.svg +1 -0
- package/docs-api/assets/main.js +60 -0
- package/docs-api/assets/navigation.js +1 -0
- package/docs-api/assets/search.js +1 -0
- package/docs-api/assets/style.css +1448 -0
- package/docs-api/classes/AsyncIterableCollection.html +437 -0
- package/docs-api/classes/CollectionError.html +12 -0
- package/docs-api/classes/IndexOverflowError.html +12 -0
- package/docs-api/classes/ItemNotFoundError.html +12 -0
- package/docs-api/classes/IterableCollection.html +434 -0
- package/docs-api/classes/ListCollection.html +434 -0
- package/docs-api/classes/MultipleItemsFoundError.html +12 -0
- package/docs-api/classes/UnexpectedCollectionError.html +12 -0
- package/docs-api/functions/isAsyncIterable.html +1 -0
- package/docs-api/functions/isIterable.html +1 -0
- package/docs-api/functions/range.html +4 -0
- package/docs-api/hierarchy.html +1 -0
- package/docs-api/index.html +1 -0
- package/docs-api/modules.html +60 -0
- package/docs-api/types/AsyncCollapse.html +1 -0
- package/docs-api/types/AsyncFilter.html +1 -0
- package/docs-api/types/AsyncFilter_.html +1 -0
- package/docs-api/types/AsyncFindOrSettings.html +1 -0
- package/docs-api/types/AsyncFindSettings.html +1 -0
- package/docs-api/types/AsyncForEach.html +1 -0
- package/docs-api/types/AsyncForEach_.html +1 -0
- package/docs-api/types/AsyncGroupBySettings.html +1 -0
- package/docs-api/types/AsyncIterableValue.html +1 -0
- package/docs-api/types/AsyncLazyable.html +1 -0
- package/docs-api/types/AsyncLazyable_.html +1 -0
- package/docs-api/types/AsyncMap.html +1 -0
- package/docs-api/types/AsyncMap_.html +1 -0
- package/docs-api/types/AsyncModifier.html +1 -0
- package/docs-api/types/AsyncModifier_.html +1 -0
- package/docs-api/types/AsyncReduce.html +1 -0
- package/docs-api/types/AsyncReduceSettings.html +1 -0
- package/docs-api/types/AsyncReduce_.html +1 -0
- package/docs-api/types/AsyncTap.html +1 -0
- package/docs-api/types/AsyncTap_.html +1 -0
- package/docs-api/types/AsyncTransform.html +1 -0
- package/docs-api/types/AsyncTransform_.html +1 -0
- package/docs-api/types/Collapse.html +1 -0
- package/docs-api/types/Comparator.html +1 -0
- package/docs-api/types/EnsureType.html +1 -0
- package/docs-api/types/Filter.html +1 -0
- package/docs-api/types/FilterGuard.html +1 -0
- package/docs-api/types/Filter_.html +1 -0
- package/docs-api/types/FindOrSettings.html +1 -0
- package/docs-api/types/FindSettings.html +1 -0
- package/docs-api/types/ForEach.html +1 -0
- package/docs-api/types/GroupBySettings.html +1 -0
- package/docs-api/types/IAsyncCollection.html +357 -0
- package/docs-api/types/ICollection.html +357 -0
- package/docs-api/types/JoinSettings.html +1 -0
- package/docs-api/types/Lazyable.html +1 -0
- package/docs-api/types/Map.html +1 -0
- package/docs-api/types/Modifier.html +1 -0
- package/docs-api/types/PageSettings.html +1 -0
- package/docs-api/types/RecordItem.html +1 -0
- package/docs-api/types/Reduce.html +1 -0
- package/docs-api/types/ReduceSettings.html +1 -0
- package/docs-api/types/ReverseSettings.html +1 -0
- package/docs-api/types/SliceSettings.html +1 -0
- package/docs-api/types/SlidingSettings.html +1 -0
- package/docs-api/types/Tap.html +1 -0
- package/docs-api/types/Transform.html +1 -0
- package/docs-api/types/UpdatedItem.html +1 -0
- package/package.json +47 -0
- package/src/_module.ts +2 -0
- package/src/collection/_module.ts +4 -0
- package/src/collection/_shared.ts +45 -0
- package/src/collection/async-iterable-collection/_module.ts +1 -0
- package/src/collection/async-iterable-collection/async-iterable-collection.test.ts +3195 -0
- package/src/collection/async-iterable-collection/async-iterable-collection.ts +1276 -0
- package/src/collection/async-iterable-collection/async-iterable-helpers/_module.ts +35 -0
- package/src/collection/async-iterable-collection/async-iterable-helpers/async-abort-iterable.ts +25 -0
- package/src/collection/async-iterable-collection/async-iterable-helpers/async-chunk-iterable.ts +57 -0
- package/src/collection/async-iterable-collection/async-iterable-helpers/async-chunk-whilte-iterable.ts +54 -0
- package/src/collection/async-iterable-collection/async-iterable-helpers/async-collapse-iterable.ts +40 -0
- package/src/collection/async-iterable-collection/async-iterable-helpers/async-count-by-iterable.ts +58 -0
- package/src/collection/async-iterable-collection/async-iterable-helpers/async-cross-join-iterable.ts +69 -0
- package/src/collection/async-iterable-collection/async-iterable-helpers/async-delay-iterable.ts +19 -0
- package/src/collection/async-iterable-collection/async-iterable-helpers/async-entries-iterable.ts +28 -0
- package/src/collection/async-iterable-collection/async-iterable-helpers/async-filter-iterable.ts +42 -0
- package/src/collection/async-iterable-collection/async-iterable-helpers/async-flat-map-iterable.ts +44 -0
- package/src/collection/async-iterable-collection/async-iterable-helpers/async-group-by-iterable.ts +48 -0
- package/src/collection/async-iterable-collection/async-iterable-helpers/async-insert-after-iterable.ts +57 -0
- package/src/collection/async-iterable-collection/async-iterable-helpers/async-insert-before-iterable.ts +57 -0
- package/src/collection/async-iterable-collection/async-iterable-helpers/async-map-iterable.ts +40 -0
- package/src/collection/async-iterable-collection/async-iterable-helpers/async-merge-iterable.ts +35 -0
- package/src/collection/async-iterable-collection/async-iterable-helpers/async-pad-end-iterable.ts +41 -0
- package/src/collection/async-iterable-collection/async-iterable-helpers/async-pad-start-iterable.ts +41 -0
- package/src/collection/async-iterable-collection/async-iterable-helpers/async-partion-iterable.ts +63 -0
- package/src/collection/async-iterable-collection/async-iterable-helpers/async-repeat-iterable.ts +40 -0
- package/src/collection/async-iterable-collection/async-iterable-helpers/async-reverse-iterable.ts +35 -0
- package/src/collection/async-iterable-collection/async-iterable-helpers/async-shuffle-iterable.ts +23 -0
- package/src/collection/async-iterable-collection/async-iterable-helpers/async-skip-iterable.ts +41 -0
- package/src/collection/async-iterable-collection/async-iterable-helpers/async-skip-until-iterable.ts +55 -0
- package/src/collection/async-iterable-collection/async-iterable-helpers/async-slice-iterable.ts +33 -0
- package/src/collection/async-iterable-collection/async-iterable-helpers/async-sliding-iterable.ts +54 -0
- package/src/collection/async-iterable-collection/async-iterable-helpers/async-sort-iterable.ts +18 -0
- package/src/collection/async-iterable-collection/async-iterable-helpers/async-split-iterable.ts +64 -0
- package/src/collection/async-iterable-collection/async-iterable-helpers/async-take-iterable.ts +41 -0
- package/src/collection/async-iterable-collection/async-iterable-helpers/async-take-until-iterable.ts +41 -0
- package/src/collection/async-iterable-collection/async-iterable-helpers/async-tap-iterable.ts +34 -0
- package/src/collection/async-iterable-collection/async-iterable-helpers/async-timeout-iterable.ts +20 -0
- package/src/collection/async-iterable-collection/async-iterable-helpers/async-unique-iterable.ts +49 -0
- package/src/collection/async-iterable-collection/async-iterable-helpers/async-update-iterable.ts +64 -0
- package/src/collection/async-iterable-collection/async-iterable-helpers/async-when-iterable.ts +43 -0
- package/src/collection/async-iterable-collection/async-iterable-helpers/async-zip-iterable.ts +45 -0
- package/src/collection/iterable-collection/_module.ts +1 -0
- package/src/collection/iterable-collection/iterable-collection.test.ts +2379 -0
- package/src/collection/iterable-collection/iterable-collection.ts +1317 -0
- package/src/collection/iterable-collection/iterable-helpers/_module.ts +32 -0
- package/src/collection/iterable-collection/iterable-helpers/chunk-iterable.ts +49 -0
- package/src/collection/iterable-collection/iterable-helpers/chunk-whilte-iterable.ts +51 -0
- package/src/collection/iterable-collection/iterable-helpers/collapse-iterable.ts +35 -0
- package/src/collection/iterable-collection/iterable-helpers/count-by-iterable.ts +49 -0
- package/src/collection/iterable-collection/iterable-helpers/cross-join-iterable.ts +57 -0
- package/src/collection/iterable-collection/iterable-helpers/entries-iterable.ts +42 -0
- package/src/collection/iterable-collection/iterable-helpers/filter-iterable.ts +39 -0
- package/src/collection/iterable-collection/iterable-helpers/flat-map-iterable.ts +35 -0
- package/src/collection/iterable-collection/iterable-helpers/group-by-iterable.ts +52 -0
- package/src/collection/iterable-collection/iterable-helpers/insert-after-iterable.ts +43 -0
- package/src/collection/iterable-collection/iterable-helpers/insert-before-iterable.ts +43 -0
- package/src/collection/iterable-collection/iterable-helpers/map-iterable.ts +35 -0
- package/src/collection/iterable-collection/iterable-helpers/merge-iterable.ts +31 -0
- package/src/collection/iterable-collection/iterable-helpers/pad-end-iterable.ts +52 -0
- package/src/collection/iterable-collection/iterable-helpers/pad-start-iterable.ts +52 -0
- package/src/collection/iterable-collection/iterable-helpers/partion-iterable.ts +46 -0
- package/src/collection/iterable-collection/iterable-helpers/repeat-iterable.ts +36 -0
- package/src/collection/iterable-collection/iterable-helpers/reverse-iterable.ts +46 -0
- package/src/collection/iterable-collection/iterable-helpers/shuffle-iterable.ts +36 -0
- package/src/collection/iterable-collection/iterable-helpers/skip-iterable.ts +37 -0
- package/src/collection/iterable-collection/iterable-helpers/skip-until-iterable.ts +41 -0
- package/src/collection/iterable-collection/iterable-helpers/slice-iterable.ts +47 -0
- package/src/collection/iterable-collection/iterable-helpers/sliding-iterable.ts +49 -0
- package/src/collection/iterable-collection/iterable-helpers/sort-iterable.ts +29 -0
- package/src/collection/iterable-collection/iterable-helpers/split-iterable.ts +58 -0
- package/src/collection/iterable-collection/iterable-helpers/take-iterable.ts +37 -0
- package/src/collection/iterable-collection/iterable-helpers/take-until-iterable.ts +38 -0
- package/src/collection/iterable-collection/iterable-helpers/tap-iterable.ts +31 -0
- package/src/collection/iterable-collection/iterable-helpers/unique-iterable.ts +43 -0
- package/src/collection/iterable-collection/iterable-helpers/update-iterable.ts +50 -0
- package/src/collection/iterable-collection/iterable-helpers/when-iterable.ts +37 -0
- package/src/collection/iterable-collection/iterable-helpers/zip-iterable.ts +41 -0
- package/src/collection/list-collection/_module.ts +1 -0
- package/src/collection/list-collection/list-collection.test.ts +2280 -0
- package/src/collection/list-collection/list-collection.ts +1883 -0
- package/src/contracts/_module.ts +1 -0
- package/src/contracts/collection/_module.ts +3 -0
- package/src/contracts/collection/_shared.ts +346 -0
- package/src/contracts/collection/async-collection.contract.ts +1028 -0
- package/src/contracts/collection/collection.contract.ts +978 -0
- package/src/types.ts +2 -0
- package/tsconfig.base.json +31 -0
- package/tsconfig.cjs.json +12 -0
- package/tsconfig.esm.json +12 -0
- package/tsconfig.json +10 -0
- package/tsconfig.types.json +12 -0
- package/vite.config.ts +6 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@/collection/_module";
|
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @group Collections
|
|
3
|
+
*/
|
|
4
|
+
export class CollectionError extends Error {
|
|
5
|
+
constructor(message: string, cause?: unknown) {
|
|
6
|
+
super(message, { cause });
|
|
7
|
+
this.name = CollectionError.name;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* @group Collections
|
|
12
|
+
*/
|
|
13
|
+
export class UnexpectedCollectionError extends CollectionError {
|
|
14
|
+
constructor(message: string, cause?: unknown) {
|
|
15
|
+
super(message, { cause });
|
|
16
|
+
this.name = UnexpectedCollectionError.name;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* @group Collections
|
|
21
|
+
*/
|
|
22
|
+
export class IndexOverflowError extends UnexpectedCollectionError {
|
|
23
|
+
constructor(message: string, cause?: unknown) {
|
|
24
|
+
super(message, { cause });
|
|
25
|
+
this.name = IndexOverflowError.name;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* @group Collections
|
|
30
|
+
*/
|
|
31
|
+
export class ItemNotFoundError extends CollectionError {
|
|
32
|
+
constructor(message: string, cause?: unknown) {
|
|
33
|
+
super(message, { cause });
|
|
34
|
+
this.name = ItemNotFoundError.name;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* @group Collections
|
|
39
|
+
*/
|
|
40
|
+
export class MultipleItemsFoundError extends CollectionError {
|
|
41
|
+
constructor(message: string, cause?: unknown) {
|
|
42
|
+
super(message, { cause });
|
|
43
|
+
this.name = MultipleItemsFoundError.name;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* @group Collections
|
|
49
|
+
*/
|
|
50
|
+
export type UpdatedItem<TInput, TFilterOutput, TMapOutput> =
|
|
51
|
+
| TInput
|
|
52
|
+
| TFilterOutput
|
|
53
|
+
| TMapOutput;
|
|
54
|
+
/**
|
|
55
|
+
* @group Collections
|
|
56
|
+
*/
|
|
57
|
+
export type RecordItem<TKey, TValue> = [key: TKey, value: TValue];
|
|
58
|
+
/**
|
|
59
|
+
* @group Collections
|
|
60
|
+
*/
|
|
61
|
+
export type ReverseSettings = {
|
|
62
|
+
chunkSize?: number;
|
|
63
|
+
throwOnNumberLimit?: boolean;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* @group Collections
|
|
67
|
+
*/
|
|
68
|
+
export type PageSettings = {
|
|
69
|
+
page: number;
|
|
70
|
+
pageSize: number;
|
|
71
|
+
throwOnNumberLimit?: boolean;
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* @group Collections
|
|
75
|
+
*/
|
|
76
|
+
export type JoinSettings = {
|
|
77
|
+
seperator?: string;
|
|
78
|
+
throwOnNumberLimit?: boolean;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* @group Collections
|
|
82
|
+
*/
|
|
83
|
+
export type SliceSettings = {
|
|
84
|
+
start?: number;
|
|
85
|
+
end?: number;
|
|
86
|
+
throwOnNumberLimit?: boolean;
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* @group Collections
|
|
90
|
+
*/
|
|
91
|
+
export type SlidingSettings = {
|
|
92
|
+
chunkSize: number;
|
|
93
|
+
step?: number;
|
|
94
|
+
throwOnNumberLimit?: boolean;
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* @group Collections
|
|
98
|
+
*/
|
|
99
|
+
export type Comparator<TItem> = (itemA: TItem, itemB: TItem) => number;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* @group Collections
|
|
103
|
+
* @internal
|
|
104
|
+
*/
|
|
105
|
+
export type Filter_<TInput, TCollection> = (
|
|
106
|
+
item: TInput,
|
|
107
|
+
index: number,
|
|
108
|
+
collection: TCollection,
|
|
109
|
+
) => boolean;
|
|
110
|
+
/**
|
|
111
|
+
* @group Collections
|
|
112
|
+
* @internal
|
|
113
|
+
*/
|
|
114
|
+
export type FilterGuard<
|
|
115
|
+
TInput,
|
|
116
|
+
TCollection,
|
|
117
|
+
TOutput extends TInput = TInput,
|
|
118
|
+
> = (item: TInput, index: number, collection: TCollection) => item is TOutput;
|
|
119
|
+
/**
|
|
120
|
+
* @group Collections
|
|
121
|
+
*/
|
|
122
|
+
export type Filter<TInput, TCollection, TOutput extends TInput = TInput> =
|
|
123
|
+
| Filter_<TInput, TCollection>
|
|
124
|
+
| FilterGuard<TInput, TCollection, TOutput>;
|
|
125
|
+
/**
|
|
126
|
+
* @group Collections
|
|
127
|
+
*/
|
|
128
|
+
export type Reduce<TInput, TCollection, TOutput> = (
|
|
129
|
+
output: TOutput,
|
|
130
|
+
item: TInput,
|
|
131
|
+
index: number,
|
|
132
|
+
collection: TCollection,
|
|
133
|
+
) => TOutput;
|
|
134
|
+
/**
|
|
135
|
+
* @group Collections
|
|
136
|
+
*/
|
|
137
|
+
export type ReduceSettings<TInput, TCollection, TOutput> = {
|
|
138
|
+
reduceFn: Reduce<TInput, TCollection, TOutput>;
|
|
139
|
+
initialValue?: TOutput;
|
|
140
|
+
throwOnNumberLimit?: boolean;
|
|
141
|
+
};
|
|
142
|
+
/**
|
|
143
|
+
* @group Collections
|
|
144
|
+
*/
|
|
145
|
+
export type Map<TInput, TCollection, TOutput> = (
|
|
146
|
+
item: TInput,
|
|
147
|
+
index: number,
|
|
148
|
+
collection: TCollection,
|
|
149
|
+
) => TOutput;
|
|
150
|
+
/**
|
|
151
|
+
* @group Collections
|
|
152
|
+
*/
|
|
153
|
+
export type ForEach<TInput, TCollection> = (
|
|
154
|
+
item: TInput,
|
|
155
|
+
index: number,
|
|
156
|
+
collection: TCollection,
|
|
157
|
+
) => void;
|
|
158
|
+
/**
|
|
159
|
+
* @group Collections
|
|
160
|
+
*/
|
|
161
|
+
export type Modifier<TInput, TOutput> = (collection: TInput) => TOutput;
|
|
162
|
+
/**
|
|
163
|
+
* @group Collections
|
|
164
|
+
*/
|
|
165
|
+
export type Tap<TCollection> = (collection: TCollection) => void;
|
|
166
|
+
/**
|
|
167
|
+
* @group Collections
|
|
168
|
+
*/
|
|
169
|
+
export type Transform<TInput, TOutput> = (value: TInput) => TOutput;
|
|
170
|
+
/**
|
|
171
|
+
* @group Collections
|
|
172
|
+
*/
|
|
173
|
+
export type Lazyable<TValue> = TValue | (() => TValue);
|
|
174
|
+
/**
|
|
175
|
+
* @group Collections
|
|
176
|
+
*/
|
|
177
|
+
export type FindSettings<TInput, TCollection, TOutput extends TInput> = {
|
|
178
|
+
filterFn?: Filter<TInput, TCollection, TOutput>;
|
|
179
|
+
throwOnNumberLimit?: boolean;
|
|
180
|
+
};
|
|
181
|
+
/**
|
|
182
|
+
* @group Collections
|
|
183
|
+
*/
|
|
184
|
+
export type FindOrSettings<
|
|
185
|
+
TInput,
|
|
186
|
+
TCollection,
|
|
187
|
+
TOutput extends TInput,
|
|
188
|
+
TDefault,
|
|
189
|
+
> = FindSettings<TInput, TCollection, TOutput> & {
|
|
190
|
+
defaultValue: Lazyable<TDefault>;
|
|
191
|
+
};
|
|
192
|
+
/**
|
|
193
|
+
* @group Collections
|
|
194
|
+
*/
|
|
195
|
+
export type GroupBySettings<TInput, TCollection, TOutput> = {
|
|
196
|
+
mapFn?: Map<TInput, TCollection, TOutput>;
|
|
197
|
+
throwOnNumberLimit?: boolean;
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* @group Collections
|
|
202
|
+
* @internal
|
|
203
|
+
*/
|
|
204
|
+
export type AsyncFilter_<TInput, TCollection> = (
|
|
205
|
+
item: TInput,
|
|
206
|
+
index: number,
|
|
207
|
+
collection: TCollection,
|
|
208
|
+
) => Promise<boolean>;
|
|
209
|
+
/**
|
|
210
|
+
* @group Collections
|
|
211
|
+
* @internal
|
|
212
|
+
*/
|
|
213
|
+
export type AsyncFilter<TInput, TCollection, TOutput extends TInput = TInput> =
|
|
214
|
+
| AsyncFilter_<TInput, TCollection>
|
|
215
|
+
| Filter<TInput, TCollection, TOutput>;
|
|
216
|
+
/**
|
|
217
|
+
* @group Collections
|
|
218
|
+
* @internal
|
|
219
|
+
*/
|
|
220
|
+
export type AsyncReduce_<TInput, TCollection, TOutput> = (
|
|
221
|
+
output: TOutput,
|
|
222
|
+
item: TInput,
|
|
223
|
+
index: number,
|
|
224
|
+
collection: TCollection,
|
|
225
|
+
) => Promise<TOutput>;
|
|
226
|
+
/**
|
|
227
|
+
* @group Collections
|
|
228
|
+
*/
|
|
229
|
+
export type AsyncReduce<TInput, TCollection, TOutput> =
|
|
230
|
+
| AsyncReduce_<TInput, TCollection, TOutput>
|
|
231
|
+
| Reduce<TInput, TCollection, TOutput>;
|
|
232
|
+
/**
|
|
233
|
+
* @group Collections
|
|
234
|
+
*/
|
|
235
|
+
export type AsyncReduceSettings<TInput, TCollection, TOutput> = {
|
|
236
|
+
reduceFn: AsyncReduce<TInput, TCollection, TOutput>;
|
|
237
|
+
initialValue?: TOutput;
|
|
238
|
+
throwOnNumberLimit?: boolean;
|
|
239
|
+
};
|
|
240
|
+
/**
|
|
241
|
+
* @group Collections
|
|
242
|
+
* @internal
|
|
243
|
+
*/
|
|
244
|
+
export type AsyncMap_<TInput, TCollection, TOutput> = (
|
|
245
|
+
item: TInput,
|
|
246
|
+
index: number,
|
|
247
|
+
collection: TCollection,
|
|
248
|
+
) => Promise<TOutput>;
|
|
249
|
+
/**
|
|
250
|
+
* @group Collections
|
|
251
|
+
* @internal
|
|
252
|
+
*/
|
|
253
|
+
export type AsyncMap<TInput, TCollection, TOutput> =
|
|
254
|
+
| AsyncMap_<TInput, TCollection, TOutput>
|
|
255
|
+
| Map<TInput, TCollection, TOutput>;
|
|
256
|
+
/**
|
|
257
|
+
* @group Collections
|
|
258
|
+
* @internal
|
|
259
|
+
*/
|
|
260
|
+
export type AsyncForEach_<TInput, TCollection> = (
|
|
261
|
+
item: TInput,
|
|
262
|
+
index: number,
|
|
263
|
+
collection: TCollection,
|
|
264
|
+
) => Promise<void>;
|
|
265
|
+
/**
|
|
266
|
+
* @group Collections
|
|
267
|
+
* @internal
|
|
268
|
+
*/
|
|
269
|
+
export type AsyncForEach<TInput, TCollection> =
|
|
270
|
+
| ForEach<TInput, TCollection>
|
|
271
|
+
| AsyncForEach_<TInput, TCollection>;
|
|
272
|
+
/**
|
|
273
|
+
* @group Collections
|
|
274
|
+
* @internal
|
|
275
|
+
*/
|
|
276
|
+
export type AsyncModifier_<TInput, TOutput> = (
|
|
277
|
+
collection: TInput,
|
|
278
|
+
) => Promise<TOutput>;
|
|
279
|
+
/**
|
|
280
|
+
* @group Collections
|
|
281
|
+
* @internal
|
|
282
|
+
*/
|
|
283
|
+
export type AsyncModifier<TInput, TOutput> =
|
|
284
|
+
| Modifier<TInput, TOutput>
|
|
285
|
+
| AsyncModifier_<TInput, TOutput>;
|
|
286
|
+
/**
|
|
287
|
+
* @group Collections
|
|
288
|
+
* @internal
|
|
289
|
+
*/
|
|
290
|
+
export type AsyncTap_<TCollection> = (collection: TCollection) => Promise<void>;
|
|
291
|
+
/**
|
|
292
|
+
* @group Collections
|
|
293
|
+
* @internal
|
|
294
|
+
*/
|
|
295
|
+
export type AsyncTap<TCollection> = Tap<TCollection> | AsyncTap_<TCollection>;
|
|
296
|
+
/**
|
|
297
|
+
* @group Collections
|
|
298
|
+
* @internal
|
|
299
|
+
*/
|
|
300
|
+
export type AsyncTransform_<TInput, TOutput> = (
|
|
301
|
+
value: TInput,
|
|
302
|
+
) => Promise<TOutput>;
|
|
303
|
+
/**
|
|
304
|
+
* @group Collections
|
|
305
|
+
* @internal
|
|
306
|
+
*/
|
|
307
|
+
export type AsyncTransform<TInput, TOutput> =
|
|
308
|
+
| Transform<TInput, TOutput>
|
|
309
|
+
| AsyncTransform_<TInput, TOutput>;
|
|
310
|
+
/**
|
|
311
|
+
* @group Collections
|
|
312
|
+
* @internal
|
|
313
|
+
*/
|
|
314
|
+
export type AsyncLazyable_<TValue> = TValue | (() => Promise<TValue>);
|
|
315
|
+
/**
|
|
316
|
+
* @group Collections
|
|
317
|
+
* @internal
|
|
318
|
+
*/
|
|
319
|
+
export type AsyncLazyable<TValue> = AsyncLazyable_<TValue> | Lazyable<TValue>;
|
|
320
|
+
/**
|
|
321
|
+
* @group Collections
|
|
322
|
+
* @internal
|
|
323
|
+
*/
|
|
324
|
+
export type AsyncFindSettings<TInput, TCollection, TOutput extends TInput> = {
|
|
325
|
+
filterFn?: AsyncFilter<TInput, TCollection, TOutput>;
|
|
326
|
+
throwOnNumberLimit?: boolean;
|
|
327
|
+
};
|
|
328
|
+
/**
|
|
329
|
+
* @group Collections
|
|
330
|
+
*/
|
|
331
|
+
export type AsyncFindOrSettings<
|
|
332
|
+
TInput,
|
|
333
|
+
TCollection,
|
|
334
|
+
TOutput extends TInput,
|
|
335
|
+
TDefault,
|
|
336
|
+
> = AsyncFindSettings<TInput, TCollection, TOutput> & {
|
|
337
|
+
defaultValue: AsyncLazyable<TDefault>;
|
|
338
|
+
};
|
|
339
|
+
/**
|
|
340
|
+
* @group Collections
|
|
341
|
+
*/
|
|
342
|
+
export type AsyncGroupBySettings<TInput, TCollection, TOutput> = {
|
|
343
|
+
mapFn?: AsyncMap<TInput, TCollection, TOutput>;
|
|
344
|
+
chunkSize?: number;
|
|
345
|
+
throwOnNumberLimit?: boolean;
|
|
346
|
+
};
|