semantic-typescript 0.5.3 → 0.7.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/asynchronous/collector.d.ts +235 -0
- package/dist/asynchronous/collector.js +811 -0
- package/dist/asynchronous/semantic.d.ts +257 -0
- package/dist/asynchronous/semantic.js +1863 -0
- package/dist/factory.d.ts +79 -37
- package/dist/factory.js +534 -277
- package/dist/guard.d.ts +24 -14
- package/dist/guard.js +73 -19
- package/dist/hook.d.ts +11 -6
- package/dist/hook.js +22 -5
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/main.js +6 -4
- package/dist/optional.d.ts +2 -2
- package/dist/symbol.d.ts +19 -10
- package/dist/symbol.js +19 -10
- package/dist/synchronous/collector.d.ts +236 -0
- package/dist/{collector.js → synchronous/collector.js} +217 -193
- package/dist/{semantic.d.ts → synchronous/semantic.d.ts} +125 -130
- package/dist/{semantic.js → synchronous/semantic.js} +465 -574
- package/dist/utility.d.ts +7 -1
- package/dist/utility.js +1 -0
- package/package.json +3 -2
- package/readme.cn.md +213 -753
- package/readme.de.md +171 -441
- package/readme.es.md +171 -436
- package/readme.fr.md +170 -443
- package/readme.jp.md +177 -439
- package/readme.kr.md +177 -433
- package/readme.md +213 -1066
- package/readme.ru.md +174 -420
- package/readme.tw.md +175 -441
- package/dist/collector.d.ts +0 -236
- package/dist/map.d.ts +0 -76
- package/dist/map.js +0 -245
- package/dist/node.d.ts +0 -182
- package/dist/node.js +0 -918
- package/dist/set.d.ts +0 -19
- package/dist/set.js +0 -65
- package/dist/tree.d.ts +0 -82
- package/dist/tree.js +0 -257
|
@@ -1,65 +1,66 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
protected
|
|
7
|
-
|
|
8
|
-
constructor(generator:
|
|
9
|
-
concat(other:
|
|
10
|
-
concat(other: Iterable<E>):
|
|
11
|
-
distinct():
|
|
12
|
-
distinct<K>(keyExtractor: Functional<E, K>):
|
|
13
|
-
distinct<K>(keyExtractor: BiFunctional<E, bigint, K>):
|
|
14
|
-
dropWhile(predicate: Predicate<E>):
|
|
15
|
-
dropWhile(predicate: BiPredicate<E, bigint>):
|
|
16
|
-
filter(predicate: Predicate<E>):
|
|
17
|
-
filter(predicate: BiPredicate<E, bigint>):
|
|
18
|
-
flat(mapper: Functional<E, Iterable<E>>):
|
|
19
|
-
flat(mapper: BiFunctional<E, bigint, Iterable<E>>):
|
|
20
|
-
flat(mapper: Functional<E,
|
|
21
|
-
flat(mapper: BiFunctional<E, bigint,
|
|
22
|
-
flatMap<R>(mapper: Functional<E, Iterable<R>>):
|
|
23
|
-
flatMap<R>(mapper: BiFunctional<E, bigint, Iterable<R>>):
|
|
24
|
-
flatMap<R>(mapper: Functional<E,
|
|
25
|
-
flatMap<R>(mapper: BiFunctional<E, bigint,
|
|
26
|
-
limit(
|
|
27
|
-
limit(
|
|
28
|
-
map<R>(mapper: Functional<E, R>):
|
|
29
|
-
map<R>(mapper: BiFunctional<E, bigint, R>):
|
|
30
|
-
peek(consumer: Consumer<E>):
|
|
31
|
-
peek(consumer: BiConsumer<E, bigint>):
|
|
32
|
-
redirect(redirector: BiFunctional<E, bigint, bigint>):
|
|
33
|
-
reverse():
|
|
34
|
-
shuffle():
|
|
35
|
-
shuffle(mapper: BiFunctional<E, bigint, bigint>):
|
|
36
|
-
skip(
|
|
37
|
-
skip(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
sub(start: bigint, end: bigint):
|
|
41
|
-
takeWhile(predicate: Predicate<E>):
|
|
42
|
-
takeWhile(predicate: BiPredicate<E, bigint>):
|
|
43
|
-
toCollectable():
|
|
44
|
-
toCollectable<C extends
|
|
45
|
-
toBigintStatistics():
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
translate(offset:
|
|
52
|
-
translate(
|
|
53
|
-
translate(translator: BiFunctional<E, bigint, bigint>): Semantic<E>;
|
|
1
|
+
import { type BiConsumer, type BiFunctional, type BiPredicate, type Comparator, type Consumer, type Functional, type Indexed, type Predicate, type Supplier, type SynchronousGenerator, type TriFunctional, type TriPredicate } from "../utility";
|
|
2
|
+
import { SynchronousCollector } from "./collector";
|
|
3
|
+
import type { Optional } from "../optional";
|
|
4
|
+
export declare class SynchronousSemantic<E> {
|
|
5
|
+
protected generator: SynchronousGenerator<E>;
|
|
6
|
+
protected readonly SynchronousSemantic: Symbol;
|
|
7
|
+
[Symbol.toStringTag]: string;
|
|
8
|
+
constructor(generator: SynchronousGenerator<E>);
|
|
9
|
+
concat(other: SynchronousSemantic<E>): SynchronousSemantic<E>;
|
|
10
|
+
concat(other: Iterable<E>): SynchronousSemantic<E>;
|
|
11
|
+
distinct(): SynchronousSemantic<E>;
|
|
12
|
+
distinct<K>(keyExtractor: Functional<E, K>): SynchronousSemantic<E>;
|
|
13
|
+
distinct<K>(keyExtractor: BiFunctional<E, bigint, K>): SynchronousSemantic<E>;
|
|
14
|
+
dropWhile(predicate: Predicate<E>): SynchronousSemantic<E>;
|
|
15
|
+
dropWhile(predicate: BiPredicate<E, bigint>): SynchronousSemantic<E>;
|
|
16
|
+
filter(predicate: Predicate<E>): SynchronousSemantic<E>;
|
|
17
|
+
filter(predicate: BiPredicate<E, bigint>): SynchronousSemantic<E>;
|
|
18
|
+
flat(mapper: Functional<E, Iterable<E>>): SynchronousSemantic<E>;
|
|
19
|
+
flat(mapper: BiFunctional<E, bigint, Iterable<E>>): SynchronousSemantic<E>;
|
|
20
|
+
flat(mapper: Functional<E, SynchronousSemantic<E>>): SynchronousSemantic<E>;
|
|
21
|
+
flat(mapper: BiFunctional<E, bigint, SynchronousSemantic<E>>): SynchronousSemantic<E>;
|
|
22
|
+
flatMap<R>(mapper: Functional<E, Iterable<R>>): SynchronousSemantic<R>;
|
|
23
|
+
flatMap<R>(mapper: BiFunctional<E, bigint, Iterable<R>>): SynchronousSemantic<R>;
|
|
24
|
+
flatMap<R>(mapper: Functional<E, SynchronousSemantic<R>>): SynchronousSemantic<R>;
|
|
25
|
+
flatMap<R>(mapper: BiFunctional<E, bigint, SynchronousSemantic<R>>): SynchronousSemantic<R>;
|
|
26
|
+
limit(count: number): SynchronousSemantic<E>;
|
|
27
|
+
limit(count: bigint): SynchronousSemantic<E>;
|
|
28
|
+
map<R>(mapper: Functional<E, R>): SynchronousSemantic<R>;
|
|
29
|
+
map<R>(mapper: BiFunctional<E, bigint, R>): SynchronousSemantic<R>;
|
|
30
|
+
peek(consumer: Consumer<E>): SynchronousSemantic<E>;
|
|
31
|
+
peek(consumer: BiConsumer<E, bigint>): SynchronousSemantic<E>;
|
|
32
|
+
redirect(redirector: BiFunctional<E, bigint, bigint>): SynchronousSemantic<E>;
|
|
33
|
+
reverse(): SynchronousSemantic<E>;
|
|
34
|
+
shuffle(): SynchronousSemantic<E>;
|
|
35
|
+
shuffle(mapper: BiFunctional<E, bigint, bigint>): SynchronousSemantic<E>;
|
|
36
|
+
skip(count: number): SynchronousSemantic<E>;
|
|
37
|
+
skip(count: bigint): SynchronousSemantic<E>;
|
|
38
|
+
source(): SynchronousGenerator<E>;
|
|
39
|
+
sub(start: number, end: number): SynchronousSemantic<E>;
|
|
40
|
+
sub(start: bigint, end: bigint): SynchronousSemantic<E>;
|
|
41
|
+
takeWhile(predicate: Predicate<E>): SynchronousSemantic<E>;
|
|
42
|
+
takeWhile(predicate: BiPredicate<E, bigint>): SynchronousSemantic<E>;
|
|
43
|
+
toCollectable(): SynchronousCollectable<E>;
|
|
44
|
+
toCollectable<C extends SynchronousCollectable<E>>(mapper: Functional<SynchronousGenerator<E>, C>): C;
|
|
45
|
+
toBigintStatistics(): SynchronousBigIntStatistics<E>;
|
|
46
|
+
toNumericStatistics(): SynchronousNumericStatistics<E>;
|
|
47
|
+
toOrdered(): SynchronousOrderedCollectable<E>;
|
|
48
|
+
toUnordered(): SynchronousUnorderedCollectable<E>;
|
|
49
|
+
toWindow(): SynchronousWindowCollectable<E>;
|
|
50
|
+
translate(offset: number): SynchronousSemantic<E>;
|
|
51
|
+
translate(offset: bigint): SynchronousSemantic<E>;
|
|
52
|
+
translate(translator: BiFunctional<E, bigint, bigint>): SynchronousSemantic<E>;
|
|
54
53
|
}
|
|
55
|
-
export declare abstract class
|
|
56
|
-
protected readonly
|
|
54
|
+
export declare abstract class SynchronousCollectable<E> implements Iterable<E> {
|
|
55
|
+
protected readonly SynchronousCollectable: symbol;
|
|
56
|
+
[Symbol.toStringTag]: string;
|
|
57
57
|
constructor();
|
|
58
|
-
|
|
59
|
-
abstract [Symbol.asyncIterator](): globalThis.AsyncGenerator<E, void, undefined>;
|
|
58
|
+
[Symbol.iterator](): globalThis.Generator<E, void, undefined>;
|
|
60
59
|
anyMatch(predicate: Predicate<E>): boolean;
|
|
60
|
+
anyMatch(predicate: BiPredicate<E, bigint>): boolean;
|
|
61
61
|
allMatch(predicate: Predicate<E>): boolean;
|
|
62
|
-
|
|
62
|
+
allMatch(predicate: BiPredicate<E, bigint>): boolean;
|
|
63
|
+
collect<A, R>(collector: SynchronousCollector<E, A, R>): R;
|
|
63
64
|
collect<A, R>(identity: Supplier<A>, accumulator: BiFunctional<A, E, A>, finisher: Functional<A, R>): R;
|
|
64
65
|
collect<A, R>(identity: Supplier<A>, accumulator: TriFunctional<A, E, bigint, A>, finisher: Functional<A, R>): R;
|
|
65
66
|
collect<A, R>(identity: Supplier<A>, interruptor: Predicate<E>, accumulator: BiFunctional<A, E, A>, finisher: Functional<A, R>): R;
|
|
@@ -105,14 +106,14 @@ export declare abstract class Collectable<E> implements Iterable<E>, AsyncIterab
|
|
|
105
106
|
partition(count: bigint): Array<Array<E>>;
|
|
106
107
|
partitionBy(classifier: Functional<E, bigint>): Array<Array<E>>;
|
|
107
108
|
partitionBy(classifier: BiFunctional<E, bigint, bigint>): Array<Array<E>>;
|
|
108
|
-
reduce(accumulator: BiFunctional<E, E, E>):
|
|
109
|
-
reduce(accumulator: TriFunctional<E, E, bigint, E>):
|
|
109
|
+
reduce(accumulator: BiFunctional<E, E, E>): E;
|
|
110
|
+
reduce(accumulator: TriFunctional<E, E, bigint, E>): E;
|
|
110
111
|
reduce(identity: E, accumulator: BiFunctional<E, E, E>): E;
|
|
111
112
|
reduce(identity: E, accumulator: TriFunctional<E, E, bigint, E>): E;
|
|
112
113
|
reduce<R>(identity: R, accumulator: BiFunctional<R, E, R>, finisher: Functional<R, R>): R;
|
|
113
114
|
reduce<R>(identity: R, accumulator: TriFunctional<R, E, bigint, R>, finisher: Functional<R, R>): R;
|
|
114
|
-
semantic():
|
|
115
|
-
abstract source():
|
|
115
|
+
semantic(): SynchronousSemantic<E>;
|
|
116
|
+
abstract source(): SynchronousGenerator<E>;
|
|
116
117
|
toArray(): Array<E>;
|
|
117
118
|
toMap<K, E>(keyExtractor: Functional<E, K>): Map<K, E>;
|
|
118
119
|
toMap<K, V>(keyExtractor: Functional<E, K>, valueExtractor: Functional<E, V>): Map<K, V>;
|
|
@@ -122,39 +123,33 @@ export declare abstract class Collectable<E> implements Iterable<E>, AsyncIterab
|
|
|
122
123
|
write<S = string>(stream: WritableStream<S>, accumulator: BiFunctional<WritableStream<S>, E, WritableStream<S>>): Promise<WritableStream<S>>;
|
|
123
124
|
write<S = string>(stream: WritableStream<S>, accumulator: TriFunctional<WritableStream<S>, E, bigint, WritableStream<S>>): Promise<WritableStream<S>>;
|
|
124
125
|
}
|
|
125
|
-
export declare class
|
|
126
|
-
protected readonly AsyncCollectable: symbol;
|
|
127
|
-
protected generator: Generator<E>;
|
|
128
|
-
constructor(generator: Generator<E>);
|
|
129
|
-
source(): Generator<E>;
|
|
130
|
-
[Symbol.iterator](): globalThis.Generator<E, void, undefined>;
|
|
131
|
-
[Symbol.asyncIterator](): globalThis.AsyncGenerator<E, void, undefined>;
|
|
132
|
-
}
|
|
133
|
-
export declare class UnorderedCollectable<E> extends Collectable<E> {
|
|
134
|
-
protected readonly UnorderedCollectable: symbol;
|
|
135
|
-
protected buffer: Map<bigint, E>;
|
|
136
|
-
constructor(generator: Generator<E>);
|
|
137
|
-
source(): Generator<E>;
|
|
138
|
-
[Symbol.iterator](): globalThis.Generator<E, void, undefined>;
|
|
139
|
-
[Symbol.asyncIterator](): globalThis.AsyncGenerator<E, void, undefined>;
|
|
140
|
-
}
|
|
141
|
-
export declare class OrderedCollectable<E> extends Collectable<E> {
|
|
126
|
+
export declare class SynchronousOrderedCollectable<E> extends SynchronousCollectable<E> {
|
|
142
127
|
protected readonly OrderedCollectable: symbol;
|
|
143
128
|
protected buffer: Array<Indexed<E>>;
|
|
144
|
-
|
|
145
|
-
constructor(generator:
|
|
129
|
+
[Symbol.toStringTag]: string;
|
|
130
|
+
constructor(generator: SynchronousGenerator<E>);
|
|
131
|
+
constructor(generator: SynchronousGenerator<E>, comparator: Comparator<E>);
|
|
146
132
|
[Symbol.iterator](): globalThis.Generator<E, void, undefined>;
|
|
147
|
-
|
|
148
|
-
|
|
133
|
+
allMatch(predicate: Predicate<E>): boolean;
|
|
134
|
+
allMatch(predicate: BiPredicate<E, bigint>): boolean;
|
|
135
|
+
source(): SynchronousGenerator<E>;
|
|
149
136
|
isEmpty(): boolean;
|
|
137
|
+
count(): bigint;
|
|
150
138
|
}
|
|
151
|
-
export declare
|
|
152
|
-
protected readonly
|
|
153
|
-
|
|
154
|
-
|
|
139
|
+
export declare class SynchronousUnorderedCollectable<E> extends SynchronousCollectable<E> {
|
|
140
|
+
protected readonly SynchronousUnorderedCollectable: symbol;
|
|
141
|
+
[Symbol.toStringTag]: string;
|
|
142
|
+
protected buffer: Map<bigint, E>;
|
|
143
|
+
constructor(generator: SynchronousGenerator<E>);
|
|
144
|
+
[Symbol.iterator](): globalThis.Generator<E, void, undefined>;
|
|
145
|
+
source(): SynchronousGenerator<E>;
|
|
146
|
+
}
|
|
147
|
+
export declare abstract class SynchronousStatistics<E, D extends number | bigint> extends SynchronousOrderedCollectable<E> {
|
|
148
|
+
protected readonly SynchronousStatistics: symbol;
|
|
149
|
+
[Symbol.toStringTag]: string;
|
|
150
|
+
constructor(generator: SynchronousGenerator<E>);
|
|
151
|
+
constructor(generator: SynchronousGenerator<E>, comparator: Comparator<E>);
|
|
155
152
|
[Symbol.iterator](): globalThis.Generator<E, void, undefined>;
|
|
156
|
-
[Symbol.asyncIterator](): globalThis.AsyncGenerator<E, void, undefined>;
|
|
157
|
-
count(): bigint;
|
|
158
153
|
abstract average(): D;
|
|
159
154
|
abstract average(mapper: Functional<E, D>): D;
|
|
160
155
|
abstract range(): D;
|
|
@@ -181,43 +176,12 @@ export declare abstract class Statistics<E, D extends number | bigint> extends O
|
|
|
181
176
|
abstract kurtosis(): D;
|
|
182
177
|
abstract kurtosis(mapper: Functional<E, D>): D;
|
|
183
178
|
}
|
|
184
|
-
export declare class
|
|
185
|
-
protected readonly NumericStatistics: symbol;
|
|
186
|
-
constructor(generator: Generator<E>);
|
|
187
|
-
constructor(generator: Generator<E>, comparator: Comparator<E>);
|
|
188
|
-
[Symbol.iterator](): globalThis.Generator<E, void, undefined>;
|
|
189
|
-
[Symbol.asyncIterator](): globalThis.AsyncGenerator<E, void, undefined>;
|
|
190
|
-
average(): number;
|
|
191
|
-
average(mapper: Functional<E, number>): number;
|
|
192
|
-
range(): number;
|
|
193
|
-
range(mapper: Functional<E, number>): number;
|
|
194
|
-
variance(): number;
|
|
195
|
-
variance(mapper: Functional<E, number>): number;
|
|
196
|
-
standardDeviation(): number;
|
|
197
|
-
standardDeviation(mapper: Functional<E, number>): number;
|
|
198
|
-
mean(): number;
|
|
199
|
-
mean(mapper: Functional<E, number>): number;
|
|
200
|
-
median(): number;
|
|
201
|
-
median(mapper: Functional<E, number>): number;
|
|
202
|
-
mode(): number;
|
|
203
|
-
mode(mapper: Functional<E, number>): number;
|
|
204
|
-
summate(): number;
|
|
205
|
-
summate(mapper: Functional<E, number>): number;
|
|
206
|
-
quantile(quantile: number): number;
|
|
207
|
-
quantile(quantile: number, mapper: Functional<E, number>): number;
|
|
208
|
-
interquartileRange(): number;
|
|
209
|
-
interquartileRange(mapper: Functional<E, number>): number;
|
|
210
|
-
skewness(): number;
|
|
211
|
-
skewness(mapper: Functional<E, number>): number;
|
|
212
|
-
kurtosis(): number;
|
|
213
|
-
kurtosis(mapper: Functional<E, number>): number;
|
|
214
|
-
}
|
|
215
|
-
export declare class BigIntStatistics<E> extends Statistics<E, bigint> {
|
|
179
|
+
export declare class SynchronousBigIntStatistics<E> extends SynchronousStatistics<E, bigint> {
|
|
216
180
|
protected readonly BigIntStatistics: symbol;
|
|
217
|
-
|
|
218
|
-
constructor(generator:
|
|
181
|
+
[Symbol.toStringTag]: string;
|
|
182
|
+
constructor(generator: SynchronousGenerator<E>);
|
|
183
|
+
constructor(generator: SynchronousGenerator<E>, comparator: Comparator<E>);
|
|
219
184
|
[Symbol.iterator](): globalThis.Generator<E, void, undefined>;
|
|
220
|
-
[Symbol.asyncIterator](): globalThis.AsyncGenerator<E, void, undefined>;
|
|
221
185
|
average(): bigint;
|
|
222
186
|
average(mapper: Functional<E, bigint>): bigint;
|
|
223
187
|
range(): bigint;
|
|
@@ -243,12 +207,43 @@ export declare class BigIntStatistics<E> extends Statistics<E, bigint> {
|
|
|
243
207
|
kurtosis(): bigint;
|
|
244
208
|
kurtosis(mapper: Functional<E, bigint>): bigint;
|
|
245
209
|
}
|
|
246
|
-
export declare class
|
|
210
|
+
export declare class SynchronousNumericStatistics<E> extends SynchronousStatistics<E, number> {
|
|
211
|
+
protected readonly SynchronousNumericStatistics: symbol;
|
|
212
|
+
[Symbol.toStringTag]: string;
|
|
213
|
+
constructor(generator: SynchronousGenerator<E>);
|
|
214
|
+
constructor(generator: SynchronousGenerator<E>, comparator: Comparator<E>);
|
|
215
|
+
[Symbol.iterator](): globalThis.Generator<E, void, undefined>;
|
|
216
|
+
average(): number;
|
|
217
|
+
average(mapper: Functional<E, number>): number;
|
|
218
|
+
range(): number;
|
|
219
|
+
range(mapper: Functional<E, number>): number;
|
|
220
|
+
variance(): number;
|
|
221
|
+
variance(mapper: Functional<E, number>): number;
|
|
222
|
+
standardDeviation(): number;
|
|
223
|
+
standardDeviation(mapper: Functional<E, number>): number;
|
|
224
|
+
mean(): number;
|
|
225
|
+
mean(mapper: Functional<E, number>): number;
|
|
226
|
+
median(): number;
|
|
227
|
+
median(mapper: Functional<E, number>): number;
|
|
228
|
+
mode(): number;
|
|
229
|
+
mode(mapper: Functional<E, number>): number;
|
|
230
|
+
summate(): number;
|
|
231
|
+
summate(mapper: Functional<E, number>): number;
|
|
232
|
+
quantile(quantile: number): number;
|
|
233
|
+
quantile(quantile: number, mapper: Functional<E, number>): number;
|
|
234
|
+
interquartileRange(): number;
|
|
235
|
+
interquartileRange(mapper: Functional<E, number>): number;
|
|
236
|
+
skewness(): number;
|
|
237
|
+
skewness(mapper: Functional<E, number>): number;
|
|
238
|
+
kurtosis(): number;
|
|
239
|
+
kurtosis(mapper: Functional<E, number>): number;
|
|
240
|
+
}
|
|
241
|
+
export declare class SynchronousWindowCollectable<E> extends SynchronousOrderedCollectable<E> {
|
|
247
242
|
protected readonly WindowCollectable: symbol;
|
|
248
|
-
|
|
249
|
-
constructor(generator:
|
|
243
|
+
[Symbol.toStringTag]: string;
|
|
244
|
+
constructor(generator: SynchronousGenerator<E>);
|
|
245
|
+
constructor(generator: SynchronousGenerator<E>, comparator: Comparator<E>);
|
|
250
246
|
[Symbol.iterator](): globalThis.Generator<E, void, undefined>;
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
tumble(size: bigint): Semantic<Semantic<E>>;
|
|
247
|
+
slide(size: bigint, step?: bigint): SynchronousSemantic<SynchronousSemantic<E>>;
|
|
248
|
+
tumble(size: bigint): SynchronousSemantic<SynchronousSemantic<E>>;
|
|
254
249
|
}
|