semantic-typescript 0.3.3 → 0.3.8
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/collectable.d.ts +19 -24
- package/dist/collectable.js +373 -175
- package/dist/collector.d.ts +101 -24
- package/dist/collector.js +402 -146
- package/dist/factory.d.ts +38 -8
- package/dist/factory.js +300 -163
- package/dist/guard.d.ts +8 -3
- package/dist/guard.js +29 -5
- package/dist/hook.d.ts +13 -0
- package/dist/hook.js +114 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/optional.js +36 -3
- package/dist/semantic.d.ts +17 -10
- package/dist/semantic.js +355 -195
- package/dist/statistics.d.ts +13 -17
- package/dist/statistics.js +234 -522
- package/dist/utility.d.ts +4 -0
- package/dist/utility.js +2 -1
- package/dist/window.d.ts +12 -0
- package/dist/window.js +70 -0
- package/package.json +1 -1
- package/readme.cn.md +732 -210
- package/readme.md +426 -150
package/dist/collector.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import type { Collectable } from "./collectable";
|
|
2
2
|
import { Optional } from "./optional";
|
|
3
3
|
import type { Semantic } from "./semantic";
|
|
4
|
-
import { type BiFunctional, type BiPredicate, type Functional, type Predicate, type Supplier, type TriFunctional, type Generator, type TriPredicate, type Consumer, type BiConsumer } from "./utility";
|
|
4
|
+
import { type BiFunctional, type BiPredicate, type Functional, type Predicate, type Supplier, type TriFunctional, type Generator, type TriPredicate, type Consumer, type BiConsumer, type Comparator } from "./utility";
|
|
5
5
|
export declare class Collector<E, A, R> {
|
|
6
|
-
protected identity: Supplier<A>;
|
|
7
|
-
protected interrupt: Predicate<E> | BiPredicate<E, bigint> | TriPredicate<E, bigint, A>;
|
|
8
|
-
protected accumulator: BiFunctional<A, E, A> | TriFunctional<A, E, bigint, A>;
|
|
9
|
-
protected finisher: Functional<A, R>;
|
|
6
|
+
protected readonly identity: Supplier<A>;
|
|
7
|
+
protected readonly interrupt: Predicate<E> | BiPredicate<E, bigint> | TriPredicate<E, bigint, A>;
|
|
8
|
+
protected readonly accumulator: BiFunctional<A, E, A> | TriFunctional<A, E, bigint, A>;
|
|
9
|
+
protected readonly finisher: Functional<A, R>;
|
|
10
10
|
protected readonly Collector: symbol;
|
|
11
|
-
protected constructor(identity: Supplier<A>,
|
|
12
|
-
protected constructor(identity: Supplier<A>,
|
|
13
|
-
protected constructor(identity: Supplier<A>,
|
|
14
|
-
protected constructor(identity: Supplier<A>,
|
|
11
|
+
protected constructor(identity: Supplier<A>, interrupt: Predicate<E>, accumulator: BiFunctional<A, E, A>, finisher: Functional<A, R>);
|
|
12
|
+
protected constructor(identity: Supplier<A>, interrupt: BiPredicate<E, bigint>, accumulator: BiFunctional<A, E, A>, finisher: Functional<A, R>);
|
|
13
|
+
protected constructor(identity: Supplier<A>, interrupt: Predicate<E>, accumulator: TriFunctional<A, E, bigint, A>, finisher: Functional<A, R>);
|
|
14
|
+
protected constructor(identity: Supplier<A>, interrupt: BiPredicate<E, bigint>, accumulator: TriFunctional<A, E, bigint, A>, finisher: Functional<A, R>);
|
|
15
15
|
collect(generator: Generator<E>): R;
|
|
16
16
|
collect(iterable: Iterable<E>): R;
|
|
17
17
|
collect(semantic: Semantic<E>): R;
|
|
@@ -49,10 +49,20 @@ export interface UseError {
|
|
|
49
49
|
<E = unknown>(prefix: string, accumulator: BiFunctional<string, E, string>, suffix: string): Collector<E, string, string>;
|
|
50
50
|
<E = unknown>(prefix: string, accumulator: TriFunctional<string, E, bigint, string>, suffix: string): Collector<E, string, string>;
|
|
51
51
|
}
|
|
52
|
-
export declare let useError:
|
|
52
|
+
export declare let useError: UseError;
|
|
53
53
|
export declare let useFindFirst: <E>() => Collector<E, Optional<E>, Optional<E>>;
|
|
54
54
|
export declare let useFindAny: <E>() => Collector<E, Optional<E>, Optional<E>>;
|
|
55
55
|
export declare let useFindLast: <E>() => Collector<E, Optional<E>, Optional<E>>;
|
|
56
|
+
export interface UseFindMaximum {
|
|
57
|
+
<E>(): Collector<E, Optional<E>, Optional<E>>;
|
|
58
|
+
<E>(comparator: Comparator<E>): Collector<E, Optional<E>, Optional<E>>;
|
|
59
|
+
}
|
|
60
|
+
export declare let useFindMaximum: UseFindMaximum;
|
|
61
|
+
export interface UseFindMinimum {
|
|
62
|
+
<E>(): Collector<E, Optional<E>, Optional<E>>;
|
|
63
|
+
<E>(comparator: Comparator<E>): Collector<E, Optional<E>, Optional<E>>;
|
|
64
|
+
}
|
|
65
|
+
export declare let useFindMinimum: UseFindMinimum;
|
|
56
66
|
export interface UseForEach {
|
|
57
67
|
<E>(action: Consumer<E>): Collector<E, bigint, bigint>;
|
|
58
68
|
<E>(action: BiConsumer<E, bigint>): Collector<E, bigint, bigint>;
|
|
@@ -97,28 +107,95 @@ export interface UseWrite {
|
|
|
97
107
|
<E, S = string>(stream: WritableStream<S>, accumulator: TriFunctional<WritableStream<S>, E, bigint, WritableStream<S>>): Collector<E, Promise<WritableStream<S>>, Promise<WritableStream<S>>>;
|
|
98
108
|
}
|
|
99
109
|
export declare let useWrite: UseWrite;
|
|
100
|
-
export
|
|
110
|
+
export interface UseNumericSummate {
|
|
111
|
+
<E>(): Collector<E, number, number>;
|
|
112
|
+
<E>(mapper: Functional<E, number>): Collector<E, number, number>;
|
|
113
|
+
}
|
|
114
|
+
export declare let useNumericSummate: UseNumericSummate;
|
|
115
|
+
export interface UseBigIntSummate {
|
|
116
|
+
<E>(): Collector<E, bigint, bigint>;
|
|
117
|
+
<E>(mapper: Functional<E, bigint>): Collector<E, bigint, bigint>;
|
|
118
|
+
}
|
|
119
|
+
export declare let useBigIntSummate: UseBigIntSummate;
|
|
120
|
+
export interface UseNumericAverage {
|
|
121
|
+
<E>(): Collector<E, NumericAverageAccumulator, number>;
|
|
122
|
+
<E>(mapper: Functional<E, number>): Collector<E, NumericAverageAccumulator, number>;
|
|
123
|
+
}
|
|
124
|
+
export interface NumericAverageAccumulator {
|
|
101
125
|
summate: number;
|
|
102
126
|
count: number;
|
|
103
|
-
};
|
|
104
|
-
export interface UseNumericAverage {
|
|
105
|
-
(): Collector<number, NumericAverageInformation, number>;
|
|
106
|
-
<E>(mapper: Functional<E, number>): Collector<E, NumericAverageInformation, number>;
|
|
107
127
|
}
|
|
108
128
|
export declare let useNumericAverage: UseNumericAverage;
|
|
109
|
-
export
|
|
129
|
+
export interface UseBigIntAverage {
|
|
130
|
+
<E>(): Collector<E, BigIntAverageAccumulator, bigint>;
|
|
131
|
+
<E>(mapper: Functional<E, bigint>): Collector<E, BigIntAverageAccumulator, bigint>;
|
|
132
|
+
}
|
|
133
|
+
export interface BigIntAverageAccumulator {
|
|
110
134
|
summate: bigint;
|
|
111
135
|
count: bigint;
|
|
112
|
-
};
|
|
113
|
-
export interface UseBigIntAverage {
|
|
114
|
-
(): Collector<bigint, BigIntAverageInformation, bigint>;
|
|
115
|
-
<E>(mapper: Functional<E, bigint>): Collector<E, BigIntAverageInformation, bigint>;
|
|
116
136
|
}
|
|
117
137
|
export declare let useBigIntAverage: UseBigIntAverage;
|
|
118
138
|
export declare let useFrequency: <E>() => Collector<E, Map<E, bigint>, Map<E, bigint>>;
|
|
119
|
-
export interface
|
|
120
|
-
(): Collector<
|
|
121
|
-
<E>(mapper: Functional<E, number>): Collector<E, number, number>;
|
|
139
|
+
export interface UseNumericMode {
|
|
140
|
+
<E>(): Collector<E, Map<number, bigint>, number>;
|
|
141
|
+
<E>(mapper: Functional<E, number>): Collector<E, Map<number, bigint>, number>;
|
|
142
|
+
}
|
|
143
|
+
export declare let useNumericMode: UseNumericMode;
|
|
144
|
+
export interface UseBigIntMode {
|
|
145
|
+
<E>(): Collector<E, Map<bigint, bigint>, bigint>;
|
|
146
|
+
<E>(mapper: Functional<E, bigint>): Collector<E, Map<bigint, bigint>, bigint>;
|
|
147
|
+
}
|
|
148
|
+
export declare let useBigIntMode: UseBigIntMode;
|
|
149
|
+
export interface UseNumericVariance {
|
|
150
|
+
<E>(): Collector<E, VarianceAccumulator, number>;
|
|
151
|
+
<E>(mapper: Functional<E, number>): Collector<E, VarianceAccumulator, number>;
|
|
152
|
+
}
|
|
153
|
+
export interface VarianceAccumulator {
|
|
154
|
+
summate: number;
|
|
155
|
+
summateOfSquares: number;
|
|
156
|
+
count: number;
|
|
157
|
+
}
|
|
158
|
+
export declare let useNumericVariance: UseNumericVariance;
|
|
159
|
+
export interface UseBigIntVariance {
|
|
160
|
+
<E>(): Collector<E, BigIntVarianceAccumulator, bigint>;
|
|
161
|
+
<E>(mapper: Functional<E, bigint>): Collector<E, BigIntVarianceAccumulator, bigint>;
|
|
162
|
+
}
|
|
163
|
+
export interface BigIntVarianceAccumulator {
|
|
164
|
+
summate: bigint;
|
|
165
|
+
summateOfSquares: bigint;
|
|
166
|
+
count: bigint;
|
|
167
|
+
}
|
|
168
|
+
export declare let useBigIntVariance: UseBigIntVariance;
|
|
169
|
+
export interface UseNumericStandardDeviation {
|
|
170
|
+
<E>(): Collector<E, StandardDeviationAccumulator, number>;
|
|
171
|
+
<E>(mapper: Functional<E, number>): Collector<E, StandardDeviationAccumulator, number>;
|
|
172
|
+
}
|
|
173
|
+
export interface StandardDeviationAccumulator {
|
|
174
|
+
summate: number;
|
|
175
|
+
summateOfSquares: number;
|
|
176
|
+
count: number;
|
|
177
|
+
}
|
|
178
|
+
export declare let useNumericStandardDeviation: UseNumericStandardDeviation;
|
|
179
|
+
export interface UseBigIntStandardDeviation {
|
|
180
|
+
<E>(): Collector<E, BigIntStandardDeviationAccumulator, bigint>;
|
|
181
|
+
<E>(mapper: Functional<E, bigint>): Collector<E, BigIntStandardDeviationAccumulator, bigint>;
|
|
182
|
+
}
|
|
183
|
+
export interface BigIntStandardDeviationAccumulator {
|
|
184
|
+
summate: bigint;
|
|
185
|
+
summateOfSquares: bigint;
|
|
186
|
+
count: bigint;
|
|
187
|
+
}
|
|
188
|
+
export declare let useBigIntStandardDeviation: UseBigIntStandardDeviation;
|
|
189
|
+
export interface UseNumericMedian {
|
|
190
|
+
<E>(): Collector<E, number[], number>;
|
|
191
|
+
<E>(mapper: Functional<E, number>): Collector<E, number[], number>;
|
|
192
|
+
}
|
|
193
|
+
export declare let useNumericMedian: UseNumericMedian;
|
|
194
|
+
export interface UseBigIntMedian {
|
|
195
|
+
<E>(): Collector<E, bigint[], bigint>;
|
|
196
|
+
<E>(mapper: Functional<E, bigint>): Collector<E, bigint[], bigint>;
|
|
122
197
|
}
|
|
123
|
-
export declare let
|
|
198
|
+
export declare let useBigIntMedian: UseBigIntMedian;
|
|
199
|
+
export declare let useToGeneratorFunction: <E>() => Collector<E, Array<E>, globalThis.Generator<E, void, undefined>>;
|
|
200
|
+
export declare let useToAsyncGeneratorFunction: <E>() => Collector<E, Array<E>, globalThis.AsyncGenerator<E, void, undefined>>;
|
|
124
201
|
export {};
|