@byloth/core 1.5.0-rc.8 → 1.5.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/dist/core.js +127 -83
- package/dist/core.js.map +1 -1
- package/dist/core.umd.cjs +2 -2
- package/dist/core.umd.cjs.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +24 -9
- package/src/models/aggregators/aggregated-async-iterator.ts +3 -3
- package/src/models/aggregators/aggregator.ts +3 -3
- package/src/models/aggregators/async-aggregator.ts +3 -3
- package/src/models/iterators/smart-async-iterator.ts +3 -3
- package/src/models/iterators/smart-iterator.ts +3 -3
- package/src/models/iterators/types.ts +3 -3
- package/src/models/types.ts +14 -2
- package/src/utils/index.ts +1 -1
|
@@ -3,7 +3,7 @@ import type {
|
|
|
3
3
|
GeneratorFunction,
|
|
4
4
|
MaybeAsyncIteratee,
|
|
5
5
|
MaybeAsyncReducer,
|
|
6
|
-
|
|
6
|
+
MaybeAsyncIterLike,
|
|
7
7
|
MaybeAsyncTypeGuardIteratee
|
|
8
8
|
|
|
9
9
|
} from "./types.js";
|
|
@@ -21,8 +21,8 @@ export default class SmartAsyncIterator<T, R = void, N = undefined> implements A
|
|
|
21
21
|
public constructor(iterator: AsyncIterator<T, R, N>);
|
|
22
22
|
public constructor(generatorFn: GeneratorFunction<T, R, N>);
|
|
23
23
|
public constructor(generatorFn: AsyncGeneratorFunction<T, R, N>);
|
|
24
|
-
public constructor(argument:
|
|
25
|
-
public constructor(argument:
|
|
24
|
+
public constructor(argument: MaybeAsyncIterLike<T, R, N>);
|
|
25
|
+
public constructor(argument: MaybeAsyncIterLike<T, R, N>)
|
|
26
26
|
{
|
|
27
27
|
if (argument instanceof Function)
|
|
28
28
|
{
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { GeneratorFunction, Iteratee, TypeGuardIteratee, Reducer,
|
|
1
|
+
import type { GeneratorFunction, Iteratee, TypeGuardIteratee, Reducer, IterLike } from "./types.js";
|
|
2
2
|
|
|
3
3
|
export default class SmartIterator<T, R = void, N = undefined> implements Iterator<T, R, N>
|
|
4
4
|
{
|
|
@@ -10,8 +10,8 @@ export default class SmartIterator<T, R = void, N = undefined> implements Iterat
|
|
|
10
10
|
public constructor(iterable: Iterable<T>);
|
|
11
11
|
public constructor(iterator: Iterator<T, R, N>);
|
|
12
12
|
public constructor(generatorFn: GeneratorFunction<T, R, N>);
|
|
13
|
-
public constructor(argument:
|
|
14
|
-
public constructor(argument:
|
|
13
|
+
public constructor(argument: IterLike<T, R, N>);
|
|
14
|
+
public constructor(argument: IterLike<T, R, N>)
|
|
15
15
|
{
|
|
16
16
|
if (argument instanceof Function)
|
|
17
17
|
{
|
|
@@ -13,8 +13,8 @@ export type MaybeAsyncTypeGuardIteratee<T, R extends T> = (value: MaybePromise<T
|
|
|
13
13
|
export type Reducer<T, A> = (accumulator: A, value: T, index: number) => A;
|
|
14
14
|
export type MaybeAsyncReducer<T, A> = (accumulator: A, value: T, index: number) => MaybePromise<A>;
|
|
15
15
|
|
|
16
|
-
export type
|
|
17
|
-
export type
|
|
16
|
+
export type IterLike<T, R = void, N = undefined> = Iterable<T> | Iterator<T, R, N> | GeneratorFunction<T, R, N>;
|
|
17
|
+
export type AsyncIterLike<T, R = void, N = undefined> =
|
|
18
18
|
AsyncIterable<T> | AsyncIterator<T, R, N> | AsyncGeneratorFunction<T, R, N>;
|
|
19
19
|
|
|
20
|
-
export type
|
|
20
|
+
export type MaybeAsyncIterLike<T, R = void, N = undefined> = IterLike<T, R, N> | AsyncIterLike<T, R, N>;
|
package/src/models/types.ts
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
|
-
export type {
|
|
1
|
+
export type {
|
|
2
|
+
KeyIteratee,
|
|
3
|
+
MaybeAsyncKeyIteratee,
|
|
4
|
+
KeyTypeGuardIteratee,
|
|
5
|
+
MaybeAsyncKeyTypeGuardIteratee,
|
|
6
|
+
KeyReducer,
|
|
7
|
+
MaybeAsyncKeyReducer
|
|
8
|
+
|
|
9
|
+
} from "./aggregators/types.js";
|
|
10
|
+
|
|
2
11
|
export type {
|
|
3
12
|
GeneratorFunction,
|
|
4
13
|
AsyncGeneratorFunction,
|
|
@@ -7,7 +16,10 @@ export type {
|
|
|
7
16
|
TypeGuardIteratee,
|
|
8
17
|
MaybeAsyncTypeGuardIteratee,
|
|
9
18
|
Reducer,
|
|
10
|
-
MaybeAsyncReducer
|
|
19
|
+
MaybeAsyncReducer,
|
|
20
|
+
IterLike,
|
|
21
|
+
AsyncIterLike,
|
|
22
|
+
MaybeAsyncIterLike
|
|
11
23
|
|
|
12
24
|
} from "./iterators/types.js";
|
|
13
25
|
|
package/src/utils/index.ts
CHANGED
|
@@ -3,7 +3,7 @@ import Random from "./random.js";
|
|
|
3
3
|
export { delay, nextAnimationFrame } from "./async.js";
|
|
4
4
|
export { dateDifference, dateRange, dateRound, DateUnit } from "./date.js";
|
|
5
5
|
export { loadScript } from "./dom.js";
|
|
6
|
-
export { count, range, shuffle, unique, zip } from "./iterator.js";
|
|
6
|
+
export { chain, count, enumerate, range, shuffle, unique, zip } from "./iterator.js";
|
|
7
7
|
export { average, hash, sum } from "./math.js";
|
|
8
8
|
export { capitalize } from "./string.js";
|
|
9
9
|
|