semantic-typescript 0.3.0 → 0.3.7
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 +329 -177
- package/dist/collector.d.ts +93 -16
- package/dist/collector.js +297 -107
- package/dist/factory.d.ts +6 -0
- package/dist/factory.js +224 -148
- package/dist/guard.d.ts +3 -1
- package/dist/guard.js +14 -2
- package/dist/hook.d.ts +14 -2
- package/dist/hook.js +85 -4
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/semantic.d.ts +2 -6
- package/dist/semantic.js +335 -185
- package/dist/statistics.d.ts +13 -17
- package/dist/statistics.js +204 -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 +60 -0
- package/package.json +1 -1
- package/readme.md +273 -47
package/dist/collectable.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { Collector } from "./collector";
|
|
2
2
|
import { Optional } from "./optional";
|
|
3
3
|
import { Semantic } from "./semantic";
|
|
4
|
-
import type { BiConsumer, BiFunctional, Comparator, Consumer, Functional, Predicate, Supplier, TriFunctional, Generator, BiPredicate, TriPredicate } from "./utility";
|
|
5
|
-
export declare abstract class Collectable<E> {
|
|
4
|
+
import type { BiConsumer, BiFunctional, Comparator, Consumer, Functional, Predicate, Supplier, TriFunctional, Generator, BiPredicate, TriPredicate, Indexed } from "./utility";
|
|
5
|
+
export declare abstract class Collectable<E> implements Iterable<E>, AsyncIterable<E> {
|
|
6
6
|
protected readonly Collectable: symbol;
|
|
7
7
|
constructor();
|
|
8
|
+
abstract [Symbol.iterator](): globalThis.Generator<E, void, undefined>;
|
|
9
|
+
abstract [Symbol.asyncIterator](): globalThis.AsyncGenerator<E, void, undefined>;
|
|
8
10
|
anyMatch(predicate: Predicate<E>): boolean;
|
|
9
11
|
allMatch(predicate: Predicate<E>): boolean;
|
|
10
12
|
collect<A, R>(collector: Collector<E, A, R>): R;
|
|
@@ -26,6 +28,10 @@ export declare abstract class Collectable<E> {
|
|
|
26
28
|
findAny(): Optional<E>;
|
|
27
29
|
findFirst(): Optional<E>;
|
|
28
30
|
findLast(): Optional<E>;
|
|
31
|
+
findMaximum(): Optional<E>;
|
|
32
|
+
findMaximum(comparator: Comparator<E>): Optional<E>;
|
|
33
|
+
findMinimum(): Optional<E>;
|
|
34
|
+
findMinimum(comparator: Comparator<E>): Optional<E>;
|
|
29
35
|
forEach(action: Consumer<E>): void;
|
|
30
36
|
forEach(action: BiConsumer<E, bigint>): void;
|
|
31
37
|
group<K>(classifier: Functional<E, K>): Map<K, Array<E>>;
|
|
@@ -50,40 +56,29 @@ export declare abstract class Collectable<E> {
|
|
|
50
56
|
reduce<R>(identity: R, accumulator: BiFunctional<R, E, R>, finisher: Functional<R, R>): R;
|
|
51
57
|
reduce<R>(identity: R, accumulator: TriFunctional<R, E, bigint, R>, finisher: Functional<R, R>): R;
|
|
52
58
|
semantic(): Semantic<E>;
|
|
53
|
-
abstract source(): Generator<E
|
|
59
|
+
abstract source(): Generator<E>;
|
|
54
60
|
toArray(): Array<E>;
|
|
55
61
|
toMap<K, V>(keyExtractor: Functional<E, K>, valueExtractor: Functional<E, V>): Map<K, V>;
|
|
56
62
|
toSet(): Set<E>;
|
|
57
|
-
write<S = string>(stream: WritableStream<S>):
|
|
58
|
-
write<S = string>(stream: WritableStream<S>, accumulator: BiFunctional<WritableStream<S>, E, WritableStream<S>>):
|
|
59
|
-
write<S = string>(stream: WritableStream<S>, accumulator: TriFunctional<WritableStream<S>, E, bigint, WritableStream<S>>):
|
|
63
|
+
write<S = string>(stream: WritableStream<S>): Promise<WritableStream<S>>;
|
|
64
|
+
write<S = string>(stream: WritableStream<S>, accumulator: BiFunctional<WritableStream<S>, E, WritableStream<S>>): Promise<WritableStream<S>>;
|
|
65
|
+
write<S = string>(stream: WritableStream<S>, accumulator: TriFunctional<WritableStream<S>, E, bigint, WritableStream<S>>): Promise<WritableStream<S>>;
|
|
60
66
|
}
|
|
61
67
|
export declare class UnorderedCollectable<E> extends Collectable<E> {
|
|
62
68
|
protected readonly UnorderedCollectable: symbol;
|
|
63
69
|
protected generator: Generator<E>;
|
|
64
70
|
constructor(generator: Generator<E>);
|
|
65
71
|
source(): Generator<E>;
|
|
72
|
+
[Symbol.iterator](): globalThis.Generator<E, void, undefined>;
|
|
73
|
+
[Symbol.asyncIterator](): globalThis.AsyncGenerator<E, void, undefined>;
|
|
66
74
|
}
|
|
67
|
-
type Indexed<K, V> = {
|
|
68
|
-
index: K;
|
|
69
|
-
value: V;
|
|
70
|
-
};
|
|
71
75
|
export declare class OrderedCollectable<E> extends Collectable<E> {
|
|
72
76
|
protected readonly OrderedCollectable: symbol;
|
|
73
|
-
protected
|
|
74
|
-
constructor(iterable: Iterable<E>);
|
|
75
|
-
constructor(iterable: Iterable<E>, comparator: Comparator<E>);
|
|
77
|
+
protected buffer: Array<Indexed<E>>;
|
|
76
78
|
constructor(generator: Generator<E>);
|
|
77
79
|
constructor(generator: Generator<E>, comparator: Comparator<E>);
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
constructor(iterable: Iterable<E>);
|
|
83
|
-
constructor(iterable: Iterable<E>, comparator: Comparator<E>);
|
|
84
|
-
constructor(generator: Generator<E>);
|
|
85
|
-
constructor(generator: Generator<E>, comparator: Comparator<E>);
|
|
86
|
-
slide(size: bigint, step?: bigint): Semantic<Semantic<E>>;
|
|
87
|
-
tumble(size: bigint): Semantic<Semantic<E>>;
|
|
80
|
+
[Symbol.iterator](): globalThis.Generator<E, void, undefined>;
|
|
81
|
+
[Symbol.asyncIterator](): globalThis.AsyncGenerator<E, void, undefined>;
|
|
82
|
+
source(): Generator<E>;
|
|
83
|
+
isEmpty(): boolean;
|
|
88
84
|
}
|
|
89
|
-
export {};
|