@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,34 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type AsyncTap,
|
|
3
|
+
CollectionError,
|
|
4
|
+
type IAsyncCollection,
|
|
5
|
+
UnexpectedCollectionError,
|
|
6
|
+
} from "@/contracts/collection/_module";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
export class AsyncTapIterable<TInput> implements AsyncIterable<TInput> {
|
|
12
|
+
constructor(
|
|
13
|
+
private collection: IAsyncCollection<TInput>,
|
|
14
|
+
private callback: AsyncTap<IAsyncCollection<TInput>>,
|
|
15
|
+
) {}
|
|
16
|
+
|
|
17
|
+
async *[Symbol.asyncIterator](): AsyncIterator<TInput> {
|
|
18
|
+
try {
|
|
19
|
+
await this.callback(this.collection);
|
|
20
|
+
yield* this.collection;
|
|
21
|
+
} catch (error: unknown) {
|
|
22
|
+
if (
|
|
23
|
+
error instanceof CollectionError ||
|
|
24
|
+
error instanceof TypeError
|
|
25
|
+
) {
|
|
26
|
+
throw error;
|
|
27
|
+
}
|
|
28
|
+
throw new UnexpectedCollectionError(
|
|
29
|
+
`Unexpected error "${String(error)}" occured`,
|
|
30
|
+
error,
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
package/src/collection/async-iterable-collection/async-iterable-helpers/async-timeout-iterable.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type IAsyncCollection } from "@/contracts/collection/_module";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
export class AsyncTimeoutIterable<TInput> implements AsyncIterable<TInput> {
|
|
7
|
+
constructor(
|
|
8
|
+
private collection: IAsyncCollection<TInput>,
|
|
9
|
+
private timeInMs: number,
|
|
10
|
+
) {}
|
|
11
|
+
|
|
12
|
+
async *[Symbol.asyncIterator](): AsyncIterator<TInput> {
|
|
13
|
+
const abortController = new AbortController();
|
|
14
|
+
const timeout = setTimeout(() => {
|
|
15
|
+
abortController.abort();
|
|
16
|
+
}, this.timeInMs);
|
|
17
|
+
yield* this.collection.abort(abortController.signal);
|
|
18
|
+
clearTimeout(timeout);
|
|
19
|
+
}
|
|
20
|
+
}
|
package/src/collection/async-iterable-collection/async-iterable-helpers/async-unique-iterable.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type AsyncMap,
|
|
3
|
+
CollectionError,
|
|
4
|
+
type IAsyncCollection,
|
|
5
|
+
UnexpectedCollectionError,
|
|
6
|
+
} from "@/contracts/collection/_module";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
export class AsyncUniqueIterable<TInput, TOutput>
|
|
12
|
+
implements AsyncIterable<TInput>
|
|
13
|
+
{
|
|
14
|
+
constructor(
|
|
15
|
+
private collection: IAsyncCollection<TInput>,
|
|
16
|
+
private callback: AsyncMap<
|
|
17
|
+
TInput,
|
|
18
|
+
IAsyncCollection<TInput>,
|
|
19
|
+
TOutput
|
|
20
|
+
> = (item) =>
|
|
21
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-return
|
|
22
|
+
item as any,
|
|
23
|
+
private throwOnNumberLimit: boolean,
|
|
24
|
+
) {}
|
|
25
|
+
|
|
26
|
+
async *[Symbol.asyncIterator](): AsyncIterator<TInput> {
|
|
27
|
+
try {
|
|
28
|
+
const set = new Set<TOutput>([]);
|
|
29
|
+
for await (const [index, item] of this.collection.entries()) {
|
|
30
|
+
const item_ = await this.callback(item, index, this.collection);
|
|
31
|
+
if (!set.has(item_)) {
|
|
32
|
+
yield item;
|
|
33
|
+
}
|
|
34
|
+
set.add(item_);
|
|
35
|
+
}
|
|
36
|
+
} catch (error: unknown) {
|
|
37
|
+
if (
|
|
38
|
+
error instanceof CollectionError ||
|
|
39
|
+
error instanceof TypeError
|
|
40
|
+
) {
|
|
41
|
+
throw error;
|
|
42
|
+
}
|
|
43
|
+
throw new UnexpectedCollectionError(
|
|
44
|
+
`Unexpected error "${String(error)}" occured`,
|
|
45
|
+
error,
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
package/src/collection/async-iterable-collection/async-iterable-helpers/async-update-iterable.ts
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type AsyncFilter,
|
|
3
|
+
type AsyncMap,
|
|
4
|
+
CollectionError,
|
|
5
|
+
type IAsyncCollection,
|
|
6
|
+
UnexpectedCollectionError,
|
|
7
|
+
type UpdatedItem,
|
|
8
|
+
} from "@/contracts/collection/_module";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export class AsyncUpdateIterable<
|
|
14
|
+
TInput,
|
|
15
|
+
TFilterOutput extends TInput,
|
|
16
|
+
TMapOutput,
|
|
17
|
+
> implements AsyncIterable<UpdatedItem<TInput, TFilterOutput, TMapOutput>>
|
|
18
|
+
{
|
|
19
|
+
constructor(
|
|
20
|
+
private collection: IAsyncCollection<TInput>,
|
|
21
|
+
private filter: AsyncFilter<
|
|
22
|
+
TInput,
|
|
23
|
+
IAsyncCollection<TInput>,
|
|
24
|
+
TFilterOutput
|
|
25
|
+
>,
|
|
26
|
+
private map: AsyncMap<
|
|
27
|
+
TFilterOutput,
|
|
28
|
+
IAsyncCollection<TInput>,
|
|
29
|
+
TMapOutput
|
|
30
|
+
>,
|
|
31
|
+
private throwOnNumberLimit: boolean,
|
|
32
|
+
) {}
|
|
33
|
+
|
|
34
|
+
async *[Symbol.asyncIterator](): AsyncIterator<
|
|
35
|
+
UpdatedItem<TInput, TFilterOutput, TMapOutput>
|
|
36
|
+
> {
|
|
37
|
+
try {
|
|
38
|
+
for await (const [index, item] of this.collection.entries(
|
|
39
|
+
this.throwOnNumberLimit,
|
|
40
|
+
)) {
|
|
41
|
+
if (await this.filter(item, index, this.collection)) {
|
|
42
|
+
yield this.map(
|
|
43
|
+
item as TFilterOutput,
|
|
44
|
+
index,
|
|
45
|
+
this.collection,
|
|
46
|
+
);
|
|
47
|
+
} else {
|
|
48
|
+
yield item;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
} catch (error: unknown) {
|
|
52
|
+
if (
|
|
53
|
+
error instanceof CollectionError ||
|
|
54
|
+
error instanceof TypeError
|
|
55
|
+
) {
|
|
56
|
+
throw error;
|
|
57
|
+
}
|
|
58
|
+
throw new UnexpectedCollectionError(
|
|
59
|
+
`Unexpected error "${String(error)}" occured`,
|
|
60
|
+
error,
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
package/src/collection/async-iterable-collection/async-iterable-helpers/async-when-iterable.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type AsyncModifier,
|
|
3
|
+
CollectionError,
|
|
4
|
+
type IAsyncCollection,
|
|
5
|
+
UnexpectedCollectionError,
|
|
6
|
+
} from "@/contracts/collection/_module";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
export class AsyncWhenIterable<TInput, TExtended>
|
|
12
|
+
implements AsyncIterable<TInput | TExtended>
|
|
13
|
+
{
|
|
14
|
+
constructor(
|
|
15
|
+
private collection: IAsyncCollection<TInput>,
|
|
16
|
+
private condition: () => boolean | Promise<boolean>,
|
|
17
|
+
private callback: AsyncModifier<
|
|
18
|
+
IAsyncCollection<TInput>,
|
|
19
|
+
IAsyncCollection<TExtended>
|
|
20
|
+
>,
|
|
21
|
+
) {}
|
|
22
|
+
|
|
23
|
+
async *[Symbol.asyncIterator](): AsyncIterator<TInput | TExtended> {
|
|
24
|
+
try {
|
|
25
|
+
if (await this.condition()) {
|
|
26
|
+
yield* await this.callback(this.collection);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
yield* this.collection as IAsyncCollection<TInput | TExtended>;
|
|
30
|
+
} catch (error: unknown) {
|
|
31
|
+
if (
|
|
32
|
+
error instanceof CollectionError ||
|
|
33
|
+
error instanceof TypeError
|
|
34
|
+
) {
|
|
35
|
+
throw error;
|
|
36
|
+
}
|
|
37
|
+
throw new UnexpectedCollectionError(
|
|
38
|
+
`Unexpected error "${String(error)}" occured`,
|
|
39
|
+
error,
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { isIterable } from "@/collection/_shared";
|
|
2
|
+
import {
|
|
3
|
+
type AsyncIterableValue,
|
|
4
|
+
type RecordItem,
|
|
5
|
+
} from "@/contracts/collection/_module";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export class AsyncZipIterable<TInput, TExtended>
|
|
11
|
+
implements AsyncIterable<RecordItem<TInput, TExtended>>
|
|
12
|
+
{
|
|
13
|
+
constructor(
|
|
14
|
+
private iterableA: AsyncIterableValue<TInput>,
|
|
15
|
+
private iterableB: AsyncIterableValue<TExtended>,
|
|
16
|
+
) {}
|
|
17
|
+
|
|
18
|
+
async *[Symbol.asyncIterator](): AsyncIterator<
|
|
19
|
+
RecordItem<TInput, TExtended>
|
|
20
|
+
> {
|
|
21
|
+
let iteratorA: AsyncIterator<TInput> | Iterator<TInput>;
|
|
22
|
+
if (isIterable(this.iterableA)) {
|
|
23
|
+
iteratorA = this.iterableA[Symbol.iterator]();
|
|
24
|
+
} else {
|
|
25
|
+
iteratorA = this.iterableA[Symbol.asyncIterator]();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
let iteratorB: AsyncIterator<TExtended> | Iterator<TExtended>;
|
|
29
|
+
if (isIterable(this.iterableB)) {
|
|
30
|
+
iteratorB = this.iterableB[Symbol.iterator]();
|
|
31
|
+
} else {
|
|
32
|
+
iteratorB = this.iterableB[Symbol.asyncIterator]();
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
36
|
+
while (true) {
|
|
37
|
+
const itemA = await iteratorA.next(),
|
|
38
|
+
itemB = await iteratorB.next();
|
|
39
|
+
if (itemA.done || itemB.done) {
|
|
40
|
+
break;
|
|
41
|
+
}
|
|
42
|
+
yield [itemA.value, itemB.value];
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@/collection/iterable-collection/iterable-collection";
|