semantic-typescript 0.3.7 → 0.4.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/dist/map.js ADDED
@@ -0,0 +1,247 @@
1
+ import { isFunction, isNumber } from "./guard";
2
+ import { useHash } from "./hash";
3
+ import { useCompare } from "./hook";
4
+ import { SemanticMapSymbol } from "./symbol";
5
+ import { invalidate, validate } from "./utility";
6
+ ;
7
+ ;
8
+ export class AbstractSemanticMap {
9
+ internal = 0n;
10
+ size = 0;
11
+ SemanticMap = SemanticMapSymbol;
12
+ constructor() {
13
+ Object.defineProperty(this, "SemanticMap", {
14
+ value: SemanticMapSymbol,
15
+ enumerable: false,
16
+ writable: false,
17
+ configurable: false
18
+ });
19
+ }
20
+ compute(key, remapping) {
21
+ let value = this.get(key);
22
+ return remapping(key, value);
23
+ }
24
+ computeIfAbsent(key, remapping) {
25
+ let value = this.get(key);
26
+ if (invalidate(value)) {
27
+ return remapping();
28
+ }
29
+ return value;
30
+ }
31
+ computeIfPresent(key, remapping) {
32
+ let value = this.get(key);
33
+ if (validate(value)) {
34
+ return remapping(key, value);
35
+ }
36
+ return value;
37
+ }
38
+ forEach(consumer) {
39
+ for (let entry of this.entries()) {
40
+ consumer(entry[1], entry[0], this);
41
+ }
42
+ }
43
+ has(key) {
44
+ return this.get(key) !== undefined;
45
+ }
46
+ replace(argument1, argument2, argument3) {
47
+ if (validate(argument1) && validate(argument2) && validate(argument3)) {
48
+ let key = argument1;
49
+ let oldValue = argument2;
50
+ let newValue = argument3;
51
+ if (this.get(key) === oldValue) {
52
+ this.set(key, newValue);
53
+ return true;
54
+ }
55
+ return this.get(key);
56
+ }
57
+ if (validate(argument1) && validate(argument2) && invalidate(argument3)) {
58
+ let key = argument1;
59
+ let value = argument2;
60
+ if (this.get(key) === value) {
61
+ this.delete(key);
62
+ return true;
63
+ }
64
+ return this.get(key);
65
+ }
66
+ }
67
+ replaceAll(operator) {
68
+ for (let entry of this.entries()) {
69
+ let key = entry[0];
70
+ let value = entry[1];
71
+ let newValue = operator(key, value);
72
+ if (validate(newValue)) {
73
+ this.set(key, newValue);
74
+ }
75
+ else {
76
+ this.delete(key);
77
+ }
78
+ }
79
+ }
80
+ [Symbol.iterator]() {
81
+ return this.entries();
82
+ }
83
+ [Symbol.toStringTag] = "SemanticMap";
84
+ }
85
+ ;
86
+ Object.freeze(AbstractSemanticMap);
87
+ Object.freeze(AbstractSemanticMap.prototype);
88
+ Object.freeze(Object.getPrototypeOf(AbstractSemanticMap));
89
+ export class HashMap extends AbstractSemanticMap {
90
+ buckets = new Map();
91
+ threashold;
92
+ comparator;
93
+ capacity;
94
+ HashMap = SemanticMapSymbol;
95
+ constructor(argument1, argument2, argument3) {
96
+ super();
97
+ if (isFunction(argument1) && isNumber(argument2) && isNumber(argument3)) {
98
+ this.comparator = argument1;
99
+ this.threashold = argument2;
100
+ this.capacity = argument3;
101
+ }
102
+ else if (isFunction(argument1) && isNumber(argument2) && invalidate(argument3)) {
103
+ this.comparator = argument1;
104
+ this.threashold = argument2;
105
+ this.capacity = 16;
106
+ }
107
+ else if (isFunction(argument1) && invalidate(argument2) && invalidate(argument3)) {
108
+ this.comparator = argument1;
109
+ this.threashold = 0.75;
110
+ this.capacity = 16;
111
+ }
112
+ else {
113
+ this.comparator = useCompare;
114
+ this.threashold = 0.75;
115
+ this.capacity = 16;
116
+ }
117
+ this.buckets = new Map();
118
+ Object.defineProperty(this, "size", {
119
+ get: () => this.internal,
120
+ set: (value) => this.internal = isNumber(value) ? BigInt(value) : 0n,
121
+ enumerable: true,
122
+ configurable: false
123
+ });
124
+ Object.defineProperty(this, "HashMap", {
125
+ value: SemanticMapSymbol,
126
+ enumerable: false,
127
+ writable: false,
128
+ configurable: false
129
+ });
130
+ }
131
+ clear() {
132
+ this.buckets.clear();
133
+ this.size = 0;
134
+ }
135
+ delete(key) {
136
+ let hashCode = this.hash(key);
137
+ let bucket = this.buckets.get(hashCode) || [];
138
+ if (bucket.length > 0) {
139
+ for (let index = 0; index < bucket.length; index++) {
140
+ let entry = bucket[index];
141
+ if (this.comparator(entry.key, key) === 0) {
142
+ bucket.splice(index, 1);
143
+ this.size--;
144
+ if (bucket.length === 0) {
145
+ this.buckets.delete(hashCode);
146
+ }
147
+ return true;
148
+ }
149
+ }
150
+ }
151
+ this.buckets.delete(hashCode);
152
+ return false;
153
+ }
154
+ *entries() {
155
+ for (let bucket of this.buckets.values()) {
156
+ for (let entry of bucket) {
157
+ yield [entry.key, entry.value];
158
+ }
159
+ }
160
+ }
161
+ has(key) {
162
+ let hashCode = this.hash(key);
163
+ return validate(this.findEntry(key, hashCode));
164
+ }
165
+ hash(key) {
166
+ return useHash(key);
167
+ }
168
+ ;
169
+ findEntry(key, hash) {
170
+ let candidates = (this.buckets.get(hash) || []);
171
+ for (let candidate of candidates) {
172
+ if (this.comparator(candidate.key, key) === 0) {
173
+ return candidate;
174
+ }
175
+ }
176
+ return (void 0);
177
+ }
178
+ get(argument1, argument2) {
179
+ if (validate(argument1) && validate(argument2)) {
180
+ let key = argument1;
181
+ let defaultValue = argument2;
182
+ let hashCode = this.hash(key);
183
+ let entry = this.findEntry(key, hashCode);
184
+ if (validate(entry)) {
185
+ return entry.value;
186
+ }
187
+ return defaultValue;
188
+ }
189
+ let key = argument1;
190
+ let hashCode = this.hash(key);
191
+ let entry = this.findEntry(key, hashCode);
192
+ if (validate(entry)) {
193
+ return entry.value;
194
+ }
195
+ return (void 0);
196
+ }
197
+ *keys() {
198
+ for (let bucket of this.buckets.values()) {
199
+ for (let entry of bucket) {
200
+ yield entry.key;
201
+ }
202
+ }
203
+ }
204
+ rehash() {
205
+ let oldBuckets = this.buckets;
206
+ this.buckets = new Map();
207
+ this.size = 0;
208
+ for (let bucket of oldBuckets.values()) {
209
+ for (let entry of bucket) {
210
+ let hashCode = this.hash(entry.key);
211
+ let bucket = this.buckets.get(hashCode) || [];
212
+ bucket.push(entry);
213
+ this.size++;
214
+ }
215
+ }
216
+ }
217
+ set(key, value) {
218
+ let hashCode = this.hash(key);
219
+ let bucket = this.buckets.get(hashCode) || [];
220
+ let found = this.findEntry(key, hashCode);
221
+ if (validate(found)) {
222
+ found.value = value;
223
+ }
224
+ else {
225
+ bucket.push({
226
+ key: key,
227
+ value: value
228
+ });
229
+ this.size++;
230
+ if (this.size > this.capacity * this.threashold) {
231
+ this.rehash();
232
+ }
233
+ }
234
+ return this;
235
+ }
236
+ *values() {
237
+ for (let bucket of this.buckets.values()) {
238
+ for (let entry of bucket) {
239
+ yield entry.value;
240
+ }
241
+ }
242
+ }
243
+ }
244
+ ;
245
+ Object.freeze(HashMap);
246
+ Object.freeze(HashMap.prototype);
247
+ Object.freeze(Object.getPrototypeOf(HashMap));
package/dist/optional.js CHANGED
@@ -7,6 +7,21 @@ export class Optional {
7
7
  Optional = OptionalSymbol;
8
8
  constructor(value) {
9
9
  this.value = value;
10
+ Object.defineProperties(this, {
11
+ "Optional": {
12
+ value: OptionalSymbol,
13
+ writable: false,
14
+ enumerable: false,
15
+ configurable: false
16
+ },
17
+ "value": {
18
+ value: value,
19
+ writable: false,
20
+ enumerable: false,
21
+ configurable: false
22
+ }
23
+ });
24
+ Object.freeze(this);
10
25
  }
11
26
  filter(predicate) {
12
27
  if (this.isPresent() && isFunction(predicate) && predicate(this.value)) {
@@ -74,3 +89,6 @@ export class Optional {
74
89
  }
75
90
  }
76
91
  ;
92
+ Object.freeze(Optional);
93
+ Object.freeze(Optional.prototype);
94
+ Object.freeze(Object.getPrototypeOf(Optional));
@@ -1,7 +1,7 @@
1
1
  import { Collectable, OrderedCollectable, UnorderedCollectable } from "./collectable";
2
2
  import { BigIntStatistics, NumericStatistics } from "./statistics";
3
3
  import { type Predicate } from "./utility";
4
- import type { Generator, Functional, BiFunctional, Consumer, BiConsumer, Comparator } from "./utility";
4
+ import type { Generator, Functional, BiFunctional, Consumer, BiConsumer, Comparator, BiPredicate } from "./utility";
5
5
  import { WindowCollectable } from "./window";
6
6
  export declare class Semantic<E> {
7
7
  protected generator: Generator<E>;
@@ -10,14 +10,24 @@ export declare class Semantic<E> {
10
10
  concat(other: Semantic<E>): Semantic<E>;
11
11
  concat(other: Iterable<E>): Semantic<E>;
12
12
  distinct(): Semantic<E>;
13
- distinct(comparator: Comparator<E>): Semantic<E>;
13
+ distinct<K>(keyExtractor: Functional<E, K>): Semantic<E>;
14
+ distinct<K>(keyExtractor: BiFunctional<E, bigint, K>): Semantic<E>;
14
15
  dropWhile(predicate: Predicate<E>): Semantic<E>;
16
+ dropWhile(predicate: BiPredicate<E, bigint>): Semantic<E>;
15
17
  filter(predicate: Predicate<E>): Semantic<E>;
16
- flat(mapper: Functional<E, Iterable<E> | Semantic<E>>): Semantic<E>;
17
- flatMap<R>(mapper: Functional<E, Iterable<R> | Semantic<R>>): Semantic<R>;
18
+ filter(predicate: BiPredicate<E, bigint>): Semantic<E>;
19
+ flat(mapper: Functional<E, Iterable<E>>): Semantic<E>;
20
+ flat(mapper: BiFunctional<E, bigint, Iterable<E>>): Semantic<E>;
21
+ flat(mapper: Functional<E, Semantic<E>>): Semantic<E>;
22
+ flat(mapper: BiFunctional<E, bigint, Semantic<E>>): Semantic<E>;
23
+ flatMap<R>(mapper: Functional<E, Iterable<R>>): Semantic<R>;
24
+ flatMap<R>(mapper: BiFunctional<E, bigint, Iterable<R>>): Semantic<R>;
25
+ flatMap<R>(mapper: Functional<E, Semantic<R>>): Semantic<R>;
26
+ flatMap<R>(mapper: BiFunctional<E, bigint, Semantic<R>>): Semantic<R>;
18
27
  limit(n: number): Semantic<E>;
19
28
  limit(n: bigint): Semantic<E>;
20
29
  map<R>(mapper: Functional<E, R>): Semantic<R>;
30
+ map<R>(mapper: BiFunctional<E, bigint, R>): Semantic<R>;
21
31
  peek(consumer: Consumer<E>): Semantic<E>;
22
32
  peek(consumer: BiConsumer<E, bigint>): Semantic<E>;
23
33
  redirect(redirector: BiFunctional<E, bigint, bigint>): Semantic<E>;
@@ -30,6 +40,7 @@ export declare class Semantic<E> {
30
40
  sorted(comparator: Comparator<E>): OrderedCollectable<E>;
31
41
  sub(start: bigint, end: bigint): Semantic<E>;
32
42
  takeWhile(predicate: Predicate<E>): Semantic<E>;
43
+ takeWhile(predicate: BiPredicate<E, bigint>): Semantic<E>;
33
44
  toCollectable(): Collectable<E>;
34
45
  toCollectable<C extends Collectable<E>>(mapper: Functional<Generator<E>, C>): C;
35
46
  toBigintStatistics(): BigIntStatistics<E>;
package/dist/semantic.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { Collectable, OrderedCollectable, UnorderedCollectable } from "./collectable";
2
2
  import { isBigInt, isCollectable, isFunction, isIterable, isNumber, isSemantic } from "./guard";
3
- import { useCompare, useRandom } from "./hook";
3
+ import { useHash } from "./hash";
4
+ import { useCompare } from "./hook";
4
5
  import { BigIntStatistics, NumericStatistics } from "./statistics";
5
6
  import { SemanticSymbol } from "./symbol";
6
7
  import { validate } from "./utility";
@@ -10,6 +11,21 @@ export class Semantic {
10
11
  Semantic = SemanticSymbol;
11
12
  constructor(generator) {
12
13
  this.generator = generator;
14
+ Object.defineProperties(this, {
15
+ "Semantic": {
16
+ value: SemanticSymbol,
17
+ writable: false,
18
+ enumerable: false,
19
+ configurable: false
20
+ },
21
+ "generator": {
22
+ value: generator,
23
+ writable: false,
24
+ enumerable: false,
25
+ configurable: false
26
+ }
27
+ });
28
+ Object.freeze(this);
13
29
  }
14
30
  concat(other) {
15
31
  if (isSemantic(other)) {
@@ -50,29 +66,15 @@ export class Semantic {
50
66
  }
51
67
  throw new TypeError("Invalid arguments.");
52
68
  }
53
- distinct(comparator) {
54
- if (validate(comparator)) {
55
- return new Semantic((accept, interrupt) => {
56
- try {
57
- let array = [];
58
- this.generator((element, index) => {
59
- if (!array.some((e) => comparator(e, element))) {
60
- array.push(element);
61
- accept(element, index);
62
- }
63
- }, interrupt);
64
- }
65
- catch (error) {
66
- throw new Error("Uncaught error on distinct.");
67
- }
68
- });
69
- }
69
+ distinct(argument1) {
70
+ let keyExtractor = validate(argument1) ? argument1 : (element) => element;
70
71
  return new Semantic((accept, interrupt) => {
71
72
  try {
72
73
  let set = new Set();
73
74
  this.generator((element, index) => {
74
- if (!set.has(element)) {
75
- set.add(element);
75
+ let key = keyExtractor(element, index);
76
+ if (!set.has(key)) {
77
+ set.add(key);
76
78
  accept(element, index);
77
79
  }
78
80
  }, interrupt);
@@ -89,7 +91,7 @@ export class Semantic {
89
91
  let dropping = true;
90
92
  this.generator((element, index) => {
91
93
  if (dropping) {
92
- if (!predicate(element)) {
94
+ if (!predicate(element, index)) {
93
95
  dropping = false;
94
96
  accept(element, index);
95
97
  }
@@ -110,7 +112,7 @@ export class Semantic {
110
112
  return new Semantic((accept, interrupt) => {
111
113
  try {
112
114
  this.generator((element, index) => {
113
- if (predicate(element)) {
115
+ if (predicate(element, index)) {
114
116
  accept(element, index);
115
117
  }
116
118
  }, interrupt);
@@ -128,8 +130,8 @@ export class Semantic {
128
130
  try {
129
131
  let count = 0n;
130
132
  let stop = false;
131
- this.generator((element) => {
132
- let result = mapper(element);
133
+ this.generator((element, index) => {
134
+ let result = mapper(element, index);
133
135
  if (isIterable(result)) {
134
136
  for (let subElement of result) {
135
137
  accept(subElement, count);
@@ -159,8 +161,8 @@ export class Semantic {
159
161
  try {
160
162
  let count = 0n;
161
163
  let stop = false;
162
- this.generator((element) => {
163
- let result = mapper(element);
164
+ this.generator((element, index) => {
165
+ let result = mapper(element, index);
164
166
  if (isIterable(result)) {
165
167
  for (let subElement of result) {
166
168
  accept(subElement, count);
@@ -227,7 +229,7 @@ export class Semantic {
227
229
  try {
228
230
  let stop = false;
229
231
  this.generator((element, index) => {
230
- let resolved = mapper(element);
232
+ let resolved = mapper(element, index);
231
233
  accept(resolved, index);
232
234
  stop = stop || interrupt(resolved, index);
233
235
  }, () => stop);
@@ -298,7 +300,7 @@ export class Semantic {
298
300
  return new Semantic((accept, interrupt) => {
299
301
  try {
300
302
  this.generator((element, index) => {
301
- accept(element, useRandom(index));
303
+ accept(element, useHash([element, index]));
302
304
  }, interrupt);
303
305
  }
304
306
  catch (error) {
@@ -384,7 +386,7 @@ export class Semantic {
384
386
  return new Semantic((accept, interrupt) => {
385
387
  try {
386
388
  this.generator((element, index) => {
387
- if (!predicate(element)) {
389
+ if (!predicate(element, index)) {
388
390
  interrupt(element, index);
389
391
  return;
390
392
  }
@@ -499,3 +501,6 @@ export class Semantic {
499
501
  }
500
502
  }
501
503
  ;
504
+ Object.freeze(Semantic);
505
+ Object.freeze(Semantic.prototype);
506
+ Object.freeze(Object.getPrototypeOf(Semantic));
package/dist/set.d.ts ADDED
@@ -0,0 +1,19 @@
1
+ import { HashMap } from "./map";
2
+ import type { BiConsumer, Consumer, TriConsumer } from "./utility";
3
+ export declare class HashSet<E> implements Set<E> {
4
+ protected map: HashMap<E, boolean>;
5
+ size: number;
6
+ constructor();
7
+ add(value: E): this;
8
+ clear(): void;
9
+ delete(value: E): boolean;
10
+ entries(): SetIterator<[E, E]>;
11
+ forEach(consumer: Consumer<E>): void;
12
+ forEach(consumer: BiConsumer<E, E>): void;
13
+ forEach(consumer: TriConsumer<E, E, Set<E>>): void;
14
+ has(value: E): boolean;
15
+ keys(): IterableIterator<E>;
16
+ values(): IterableIterator<E>;
17
+ [Symbol.iterator](): IterableIterator<E>;
18
+ [Symbol.toStringTag]: string;
19
+ }
package/dist/set.js ADDED
@@ -0,0 +1,64 @@
1
+ import { HashMap } from "./map";
2
+ export class HashSet {
3
+ map = new HashMap();
4
+ size = 0;
5
+ constructor() {
6
+ Object.defineProperty(this, "size", {
7
+ get: () => this.map.size,
8
+ set: (value) => {
9
+ this.map.size = value;
10
+ },
11
+ enumerable: true,
12
+ configurable: true
13
+ });
14
+ }
15
+ add(value) {
16
+ this.map.set(value, true);
17
+ return this;
18
+ }
19
+ clear() {
20
+ this.map.clear();
21
+ }
22
+ delete(value) {
23
+ return this.map.delete(value);
24
+ }
25
+ *entries() {
26
+ for (let [key, value] of this.map.entries()) {
27
+ if (value) {
28
+ yield [key, key];
29
+ }
30
+ }
31
+ }
32
+ forEach(consumer) {
33
+ for (let [key, value] of this.map.entries()) {
34
+ if (value) {
35
+ consumer(key, key);
36
+ }
37
+ }
38
+ }
39
+ has(value) {
40
+ return this.map.has(value);
41
+ }
42
+ *keys() {
43
+ for (let [key, value] of this.map.entries()) {
44
+ if (value) {
45
+ yield key;
46
+ }
47
+ }
48
+ }
49
+ *values() {
50
+ for (let [key, value] of this.map.entries()) {
51
+ if (value) {
52
+ yield key;
53
+ }
54
+ }
55
+ }
56
+ [Symbol.iterator]() {
57
+ return this.values();
58
+ }
59
+ [Symbol.toStringTag] = "HashSet";
60
+ }
61
+ ;
62
+ Object.freeze(HashSet);
63
+ Object.freeze(HashSet.prototype);
64
+ Object.freeze(Object.getPrototypeOf(HashSet));
@@ -1,5 +1,5 @@
1
1
  import { OrderedCollectable } from "./collectable";
2
- import { Collector, useBigIntAverage, useBigIntMedian, useBigIntMode, useBigIntSummate, useBigIntVariance, useFrequency, useNumericAverage, useNumericMedian, useNumericMode, useNumericStandardDeviation, useNumericSummate, useNumericVariance, useToAsyncGeneratorFunction, useToGeneratorFunction } from "./collector";
2
+ import { Collector, useBigIntAverage, useBigIntMedian, useBigIntMode, useBigIntSummate, useBigIntVariance, useFrequency, useNumericAverage, useNumericMedian, useNumericMode, useNumericStandardDeviation, useNumericSummate, useNumericVariance, useToArray } from "./collector";
3
3
  import { isFunction } from "./guard";
4
4
  import { useCompare, useToBigInt, useToNumber } from "./hook";
5
5
  import { StatisticsSymbol, NumericStatisticsSymbol, BigIntStatisticsSymbol } from "./symbol";
@@ -7,10 +7,19 @@ export class Statistics extends OrderedCollectable {
7
7
  Statistics = StatisticsSymbol;
8
8
  constructor(parameter, comparator) {
9
9
  super(parameter, comparator || useCompare);
10
+ Object.defineProperties(this, {
11
+ "Statistics": {
12
+ value: StatisticsSymbol,
13
+ enumerable: false,
14
+ writable: false,
15
+ configurable: false
16
+ }
17
+ });
18
+ Object.freeze(this);
10
19
  }
11
20
  *[Symbol.iterator]() {
12
21
  try {
13
- let collector = useToGeneratorFunction();
22
+ let collector = useToArray();
14
23
  yield* collector.collect(this.source());
15
24
  }
16
25
  catch (error) {
@@ -19,7 +28,7 @@ export class Statistics extends OrderedCollectable {
19
28
  }
20
29
  async *[Symbol.asyncIterator]() {
21
30
  try {
22
- let collector = useToAsyncGeneratorFunction();
31
+ let collector = useToArray();
23
32
  yield* collector.collect(this.source());
24
33
  }
25
34
  catch (error) {
@@ -34,14 +43,26 @@ export class Statistics extends OrderedCollectable {
34
43
  }
35
44
  }
36
45
  ;
46
+ Object.freeze(Statistics);
47
+ Object.freeze(Statistics.prototype);
48
+ Object.freeze(Object.getPrototypeOf(Statistics));
37
49
  export class NumericStatistics extends Statistics {
38
50
  NumericStatistics = NumericStatisticsSymbol;
39
51
  constructor(parameter, comparator) {
40
52
  super(parameter, comparator || useCompare);
53
+ Object.defineProperties(this, {
54
+ "NumericStatistics": {
55
+ value: NumericStatisticsSymbol,
56
+ enumerable: false,
57
+ writable: false,
58
+ configurable: false
59
+ }
60
+ });
61
+ Object.freeze(this);
41
62
  }
42
63
  *[Symbol.iterator]() {
43
64
  try {
44
- let collector = useToGeneratorFunction();
65
+ let collector = useToArray();
45
66
  yield* collector.collect(this.source());
46
67
  }
47
68
  catch (error) {
@@ -50,7 +71,7 @@ export class NumericStatistics extends Statistics {
50
71
  }
51
72
  async *[Symbol.asyncIterator]() {
52
73
  try {
53
- let collector = useToAsyncGeneratorFunction();
74
+ let collector = useToArray();
54
75
  yield* collector.collect(this.source());
55
76
  }
56
77
  catch (error) {
@@ -241,14 +262,26 @@ export class NumericStatistics extends Statistics {
241
262
  }
242
263
  }
243
264
  ;
265
+ Object.freeze(NumericStatistics);
266
+ Object.freeze(NumericStatistics.prototype);
267
+ Object.freeze(Object.getPrototypeOf(NumericStatistics));
244
268
  export class BigIntStatistics extends Statistics {
245
269
  BigIntStatistics = BigIntStatisticsSymbol;
246
270
  constructor(parameter, comparator) {
247
271
  super(parameter, comparator || useCompare);
272
+ Object.defineProperties(this, {
273
+ "BigIntStatistics": {
274
+ value: BigIntStatisticsSymbol,
275
+ enumerable: false,
276
+ writable: false,
277
+ configurable: false
278
+ }
279
+ });
280
+ Object.freeze(this);
248
281
  }
249
282
  *[Symbol.iterator]() {
250
283
  try {
251
- let collector = useToGeneratorFunction();
284
+ let collector = useToArray();
252
285
  yield* collector.collect(this.source());
253
286
  }
254
287
  catch (error) {
@@ -257,7 +290,7 @@ export class BigIntStatistics extends Statistics {
257
290
  }
258
291
  async *[Symbol.asyncIterator]() {
259
292
  try {
260
- let collector = useToAsyncGeneratorFunction();
293
+ let collector = useToArray();
261
294
  yield* collector.collect(this.source());
262
295
  }
263
296
  catch (error) {
@@ -445,3 +478,6 @@ export class BigIntStatistics extends Statistics {
445
478
  }
446
479
  }
447
480
  ;
481
+ Object.freeze(BigIntStatistics);
482
+ Object.freeze(BigIntStatistics.prototype);
483
+ Object.freeze(Object.getPrototypeOf(BigIntStatistics));
package/dist/symbol.d.ts CHANGED
@@ -8,3 +8,11 @@ export declare let StatisticsSymbol: symbol;
8
8
  export declare let NumericStatisticsSymbol: symbol;
9
9
  export declare let BigIntStatisticsSymbol: symbol;
10
10
  export declare let UnorderedCollectableSymbol: symbol;
11
+ export declare let SemanticMapSymbol: symbol;
12
+ export declare let HashMapSymbol: symbol;
13
+ export declare let HashSetSymbol: symbol;
14
+ export declare let TreeMapSymbol: symbol;
15
+ export declare let TreeSetSymbol: symbol;
16
+ export declare let BinaryNodeSymbol: symbol;
17
+ export declare let ReadBlackNodeSymbol: symbol;
18
+ export declare let HashableSymbol: symbol;
package/dist/symbol.js CHANGED
@@ -8,3 +8,11 @@ export let StatisticsSymbol = Symbol.for("Statistics");
8
8
  export let NumericStatisticsSymbol = Symbol.for("NumericStatistics");
9
9
  export let BigIntStatisticsSymbol = Symbol.for("BigIntStatistics");
10
10
  export let UnorderedCollectableSymbol = Symbol.for("UnorderedCollectable");
11
+ export let SemanticMapSymbol = Symbol.for("SemanticMap");
12
+ export let HashMapSymbol = Symbol.for("HashMap");
13
+ export let HashSetSymbol = Symbol.for("HashSet");
14
+ export let TreeMapSymbol = Symbol.for("TreeMap");
15
+ export let TreeSetSymbol = Symbol.for("TreeSet");
16
+ export let BinaryNodeSymbol = Symbol.for("BinaryNode");
17
+ export let ReadBlackNodeSymbol = Symbol.for("BlackAndRedNode");
18
+ export let HashableSymbol = Symbol.for("hashable");