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.
@@ -1,18 +1,29 @@
1
- import { Collector, useAllMatch, useAnyMatch, useCollect, useCount, useError, useFindAny, useFindFirst, useFindLast, useForEach, useGroup, useGroupBy, useJoin, useLog, useNoneMatch, usePartition, useReduce, useToArray, useToMap, useToSet, useWrite } from "./collector";
2
- import { from } from "./factory";
3
- import { isBigInt, isCollector, isFunction, isIterable, isObject, isString } from "./guard";
1
+ import { Collector, useAllMatch, useAnyMatch, useCollect, useCount, useError, useFindAny, useFindFirst, useFindLast, useFindMaximum, useFindMinimum, useForEach, useGroup, useGroupBy, useJoin, useLog, useNoneMatch, usePartition, usePartitionBy, useReduce, useToArray, useToAsyncGeneratorFunction, useToGeneratorFunction, useToMap, useToSet, useWrite } from "./collector";
2
+ import { isBigInt, isCollector, isFunction, isObject, isString } from "./guard";
4
3
  import { useCompare } from "./hook";
5
4
  import { Optional } from "./optional";
6
5
  import { Semantic } from "./semantic";
7
- import { CollectableSymbol, OrderedCollectableSymbol, UnorderedCollectableSymbol, WindowCollectableSymbol } from "./symbol";
6
+ import { CollectableSymbol, OrderedCollectableSymbol, UnorderedCollectableSymbol } from "./symbol";
8
7
  import { invalidate, validate } from "./utility";
9
8
  export class Collectable {
10
9
  Collectable = CollectableSymbol;
11
10
  constructor() {
11
+ Object.defineProperty(this, "Collectable", {
12
+ value: CollectableSymbol,
13
+ enumerable: false,
14
+ writable: false,
15
+ configurable: false
16
+ });
17
+ Object.freeze(this);
12
18
  }
13
19
  anyMatch(predicate) {
14
20
  if (isFunction(predicate)) {
15
- return useAnyMatch(predicate).collect(this);
21
+ try {
22
+ return useAnyMatch(predicate).collect(this);
23
+ }
24
+ catch (error) {
25
+ throw new Error("Uncaught error on anyMatch.");
26
+ }
16
27
  }
17
28
  throw new TypeError("Predicate must be a function.");
18
29
  }
@@ -20,43 +31,63 @@ export class Collectable {
20
31
  return useAllMatch(predicate).collect(this);
21
32
  }
22
33
  collect(argument1, argument2, argument3, argument4) {
23
- if (isCollector(argument1)) {
24
- let collector = argument1;
25
- return collector.collect(this);
26
- }
27
- if (isFunction(argument1) && isFunction(argument2) && isFunction(argument3)) {
28
- let identity = argument1;
29
- let accumulator = argument2;
30
- let finisher = argument3;
31
- return useCollect(identity, accumulator, finisher).collect(this);
32
- }
33
- if (isFunction(argument1) && isFunction(argument2) && isFunction(argument3) && isFunction(argument4)) {
34
- let identity = argument1;
35
- let interrupt = argument2;
36
- let accumulator = argument3;
37
- let finisher = argument4;
38
- return useCollect(identity, interrupt, accumulator, finisher).collect(this);
34
+ try {
35
+ if (isCollector(argument1)) {
36
+ let collector = argument1;
37
+ return collector.collect(this);
38
+ }
39
+ if (isFunction(argument1) && isFunction(argument2) && isFunction(argument3)) {
40
+ let identity = argument1;
41
+ let accumulator = argument2;
42
+ let finisher = argument3;
43
+ return useCollect(identity, accumulator, finisher).collect(this);
44
+ }
45
+ if (isFunction(argument1) && isFunction(argument2) && isFunction(argument3) && isFunction(argument4)) {
46
+ let identity = argument1;
47
+ let interrupt = argument2;
48
+ let accumulator = argument3;
49
+ let finisher = argument4;
50
+ return useCollect(identity, interrupt, accumulator, finisher).collect(this);
51
+ }
52
+ }
53
+ catch (error) {
54
+ throw new Error("Uncaught error on collect.");
39
55
  }
40
56
  throw new TypeError("Invalid arguments.");
41
57
  }
42
58
  count() {
43
- return useCount().collect(this);
59
+ return useCount().collect(this.source());
44
60
  }
45
61
  error(argument1, argument2, argument3) {
46
62
  if (invalidate(argument1) && invalidate(argument2) && invalidate(argument3)) {
47
- useError().collect(this);
63
+ try {
64
+ useError().collect(this.source());
65
+ }
66
+ catch (error) {
67
+ throw new Error("Uncaught error on error.");
68
+ }
48
69
  }
49
70
  else if (isFunction(argument1) && invalidate(argument2) && invalidate(argument3)) {
50
- let accumulator = argument1;
51
- useError(accumulator).collect(this);
71
+ try {
72
+ let accumulator = argument1;
73
+ useError(accumulator).collect(this.source());
74
+ }
75
+ catch (error) {
76
+ throw new Error("Uncaught error on error.");
77
+ }
52
78
  }
53
79
  else if (isString(argument1) && isFunction(argument2) && isString(argument3)) {
54
- let prefix = argument1;
55
- let accumulator = argument2;
56
- let suffix = argument3;
57
- useError(prefix, accumulator, suffix).collect(this);
80
+ try {
81
+ let prefix = argument1;
82
+ let accumulator = argument2;
83
+ let suffix = argument3;
84
+ useError(prefix, accumulator, suffix).collect(this.source());
85
+ }
86
+ catch (error) {
87
+ throw new Error("Uncaught error on error.");
88
+ }
58
89
  }
59
- {
90
+ else {
60
91
  throw new TypeError("Invalid arguments.");
61
92
  }
62
93
  }
@@ -64,17 +95,55 @@ export class Collectable {
64
95
  return this.count() === 0n;
65
96
  }
66
97
  findAny() {
67
- return useFindAny().collect(this);
98
+ try {
99
+ return useFindAny().collect(this.source());
100
+ }
101
+ catch (error) {
102
+ throw new Error("Uncaught error on findAny.");
103
+ }
68
104
  }
69
105
  findFirst() {
70
- return useFindFirst().collect(this);
106
+ try {
107
+ return useFindFirst().collect(this.source());
108
+ }
109
+ catch (error) {
110
+ throw new Error("Uncaught error on findFirst.");
111
+ }
71
112
  }
72
113
  findLast() {
73
- return useFindLast().collect(this);
114
+ try {
115
+ return useFindLast().collect(this.source());
116
+ }
117
+ catch (error) {
118
+ throw new Error("Uncaught error on findLast.");
119
+ }
120
+ }
121
+ findMaximum(argument1) {
122
+ try {
123
+ let comparator = isFunction(argument1) ? argument1 : useCompare;
124
+ return useFindMaximum(comparator).collect(this.source());
125
+ }
126
+ catch (error) {
127
+ throw new Error("Uncaught error on findMaximum.");
128
+ }
129
+ }
130
+ findMinimum(argument1) {
131
+ try {
132
+ let comparator = isFunction(argument1) ? argument1 : useCompare;
133
+ return useFindMinimum(comparator).collect(this.source());
134
+ }
135
+ catch (error) {
136
+ throw new Error("Uncaught error on findMinimum.");
137
+ }
74
138
  }
75
139
  forEach(action) {
76
140
  if (isFunction(action)) {
77
- useForEach(action).collect(this);
141
+ try {
142
+ useForEach(action).collect(this);
143
+ }
144
+ catch (error) {
145
+ throw new Error("Uncaught error on forEach.");
146
+ }
78
147
  }
79
148
  else {
80
149
  throw new TypeError("Action must be a function.");
@@ -82,97 +151,162 @@ export class Collectable {
82
151
  }
83
152
  group(classifier) {
84
153
  if (isFunction(classifier)) {
85
- return useGroup(classifier).collect(this);
154
+ try {
155
+ return useGroup(classifier).collect(this.source());
156
+ }
157
+ catch (error) {
158
+ throw new Error("Uncaught error on group.");
159
+ }
86
160
  }
87
161
  throw new TypeError("Classifier must be a function.");
88
162
  }
89
163
  groupBy(keyExtractor, valueExtractor) {
90
164
  if (isFunction(keyExtractor) && isFunction(valueExtractor)) {
91
- return useGroupBy(keyExtractor, valueExtractor).collect(this);
165
+ try {
166
+ return useGroupBy(keyExtractor, valueExtractor).collect(this.source());
167
+ }
168
+ catch (error) {
169
+ throw new Error("Uncaught error on groupBy.");
170
+ }
92
171
  }
93
172
  throw new TypeError("Key and value extractors must be functions.");
94
173
  }
95
174
  join(argument1, argument2, argument3) {
96
175
  if (invalidate(argument1) && invalidate(argument2) && invalidate(argument3)) {
97
- return useJoin().collect(this);
176
+ try {
177
+ return useJoin().collect(this.source());
178
+ }
179
+ catch (error) {
180
+ throw new Error("Uncaught error on join.");
181
+ }
98
182
  }
99
- if (isString(argument1) && invalidate(argument2) && invalidate(argument3)) {
100
- let delimiter = argument1;
101
- return useJoin(delimiter).collect(this);
183
+ else if (isString(argument1) && invalidate(argument2) && invalidate(argument3)) {
184
+ try {
185
+ let delimiter = argument1;
186
+ return useJoin(delimiter).collect(this.source());
187
+ }
188
+ catch (error) {
189
+ throw new Error("Uncaught error on join.");
190
+ }
102
191
  }
103
- if (isString(argument1) && isFunction(argument2) && isString(argument3)) {
104
- let prefix = argument1;
105
- let accumulator = argument2;
106
- let suffix = argument3;
107
- return useJoin(prefix, accumulator, suffix).collect(this);
192
+ else if (isString(argument1) && isFunction(argument2) && isString(argument3)) {
193
+ try {
194
+ let prefix = argument1;
195
+ let accumulator = argument2;
196
+ let suffix = argument3;
197
+ return useJoin(prefix, accumulator, suffix).collect(this.source());
198
+ }
199
+ catch (error) {
200
+ throw new Error("Uncaught error on join.");
201
+ }
108
202
  }
109
- if (isString(argument1) && isString(argument2) && isString(argument3)) {
110
- let prefix = argument1;
111
- let delimiter = argument2;
112
- let suffix = argument3;
113
- return useJoin(prefix, delimiter, suffix).collect(this);
203
+ else if (isString(argument1) && isString(argument2) && isString(argument3)) {
204
+ try {
205
+ let prefix = argument1;
206
+ let delimiter = argument2;
207
+ let suffix = argument3;
208
+ return useJoin(prefix, delimiter, suffix).collect(this.source());
209
+ }
210
+ catch (error) {
211
+ throw new Error("Uncaught error on join.");
212
+ }
114
213
  }
115
214
  throw new TypeError("Invalid arguments.");
116
215
  }
117
216
  log(argument1, argument2, argument3) {
118
- if (invalidate(argument1) && invalidate(argument2) && invalidate(argument3)) {
119
- useLog().collect(this);
120
- }
121
- else if (isFunction(argument1) && invalidate(argument2) && invalidate(argument3)) {
122
- let accumulator = argument1;
123
- useLog(accumulator).collect(this);
217
+ if (isFunction(argument1) && invalidate(argument2) && invalidate(argument3)) {
218
+ try {
219
+ let accumulator = argument1;
220
+ useLog(accumulator).collect(this.source());
221
+ }
222
+ catch (error) {
223
+ throw new Error("Uncaught error on log.");
224
+ }
124
225
  }
125
226
  else if (isString(argument1) && isFunction(argument2) && isString(argument3)) {
126
- let prefix = argument1;
127
- let accumulator = argument2;
128
- let suffix = argument3;
129
- useLog(prefix, accumulator, suffix).collect(this);
227
+ try {
228
+ let prefix = argument1;
229
+ let accumulator = argument2;
230
+ let suffix = argument3;
231
+ useLog(prefix, accumulator, suffix).collect(this.source());
232
+ }
233
+ catch (error) {
234
+ throw new Error("Uncaught error on log.");
235
+ }
130
236
  }
131
- {
132
- throw new TypeError("Invalid arguments.");
237
+ else {
238
+ try {
239
+ useLog().collect(this.source());
240
+ }
241
+ catch (error) {
242
+ throw new Error("Uncaught error on log.");
243
+ }
133
244
  }
134
245
  }
135
246
  nonMatch(predicate) {
136
247
  if (isFunction(predicate)) {
137
- return useNoneMatch(predicate).collect(this);
248
+ try {
249
+ return useNoneMatch(predicate).collect(this.source());
250
+ }
251
+ catch (error) {
252
+ throw new Error("Uncaught error on nonMatch.");
253
+ }
138
254
  }
139
255
  throw new TypeError("Predicate must be a function.");
140
256
  }
141
257
  partition(count) {
142
258
  if (isBigInt(count)) {
143
- return usePartition(count).collect(this);
259
+ try {
260
+ return usePartition(count).collect(this.source());
261
+ }
262
+ catch (error) {
263
+ throw new Error("Uncaught error on partition.");
264
+ }
144
265
  }
145
266
  throw new TypeError("Count must be a BigInt.");
146
267
  }
147
268
  partitionBy(classifier) {
148
- return this.collect(() => {
149
- return [];
150
- }, (array, element) => {
151
- let index = classifier(element);
152
- while (index > BigInt(array.length) - 1n) {
153
- array.push([]);
154
- }
155
- array[Number(index)].push(element);
156
- return array;
157
- }, (result) => {
158
- return result;
159
- });
269
+ if (isFunction(classifier)) {
270
+ try {
271
+ let collector = usePartitionBy(classifier);
272
+ return collector.collect(this.source());
273
+ }
274
+ catch (error) {
275
+ throw new Error("Uncaught error on partitionBy.");
276
+ }
277
+ }
278
+ throw new TypeError("Classifier must be a function.");
160
279
  }
161
280
  reduce(argument1, argument2, argument3) {
162
281
  if (isFunction(argument1) && invalidate(argument2) && invalidate(argument3)) {
163
- let accumulator = argument1;
164
- return useReduce(accumulator).collect(this);
282
+ try {
283
+ let accumulator = argument1;
284
+ return useReduce(accumulator).collect(this.source());
285
+ }
286
+ catch (error) {
287
+ throw new Error("Uncaught error on reduce.");
288
+ }
165
289
  }
166
290
  else if (validate(argument1) && isFunction(argument2) && invalidate(argument3)) {
167
- let identity = argument1;
168
- let accumulator = argument2;
169
- return useReduce(identity, accumulator).collect(this);
291
+ try {
292
+ let identity = argument1;
293
+ let accumulator = argument2;
294
+ return useReduce(identity, accumulator).collect(this.source());
295
+ }
296
+ catch (error) {
297
+ throw new Error("Uncaught error on reduce.");
298
+ }
170
299
  }
171
300
  else if (validate(argument1) && isFunction(argument2) && isFunction(argument3)) {
172
- let identity = argument1;
173
- let accumulator = argument2;
174
- let finisher = argument3;
175
- return useReduce(identity, accumulator, finisher).collect(this);
301
+ try {
302
+ let identity = argument1;
303
+ let accumulator = argument2;
304
+ let finisher = argument3;
305
+ return useReduce(identity, accumulator, finisher).collect(this.source());
306
+ }
307
+ catch (error) {
308
+ throw new Error("Uncaught error on reduce.");
309
+ }
176
310
  }
177
311
  else {
178
312
  throw new TypeError("Invalid arguments.");
@@ -180,143 +314,207 @@ export class Collectable {
180
314
  }
181
315
  semantic() {
182
316
  let source = this.source();
183
- if (isIterable(source)) {
184
- return from(source);
185
- }
186
- else if (isFunction(source)) {
187
- return new Semantic(source);
317
+ if (isFunction(source)) {
318
+ try {
319
+ return new Semantic(source);
320
+ }
321
+ catch (error) {
322
+ throw new Error("Uncaught error on semantic.");
323
+ }
188
324
  }
189
325
  else {
190
326
  throw new TypeError("Invalid source.");
191
327
  }
192
328
  }
193
329
  toArray() {
194
- return useToArray().collect(this);
330
+ try {
331
+ return useToArray().collect(this.source());
332
+ }
333
+ catch (error) {
334
+ throw new Error("Uncaught error on toArray.");
335
+ }
195
336
  }
196
337
  toMap(keyExtractor, valueExtractor) {
197
- return useToMap(keyExtractor, valueExtractor).collect(this);
338
+ try {
339
+ return useToMap(keyExtractor, valueExtractor).collect(this.source());
340
+ }
341
+ catch (error) {
342
+ throw new Error("Uncaught error on toMap.");
343
+ }
198
344
  }
199
345
  toSet() {
200
- return useToSet().collect(this);
346
+ try {
347
+ return useToSet().collect(this.source());
348
+ }
349
+ catch (error) {
350
+ throw new Error("Uncaught error on toSet.");
351
+ }
201
352
  }
202
353
  write(argument1, argument2) {
203
354
  if (isObject(argument1)) {
204
- let stream = argument1;
205
- if (isFunction(argument2)) {
206
- let accumulator = argument2;
207
- return useWrite(stream, accumulator);
355
+ try {
356
+ let stream = argument1;
357
+ if (isFunction(argument2)) {
358
+ let accumulator = argument2;
359
+ return useWrite(stream, accumulator).collect(this.source());
360
+ }
361
+ else {
362
+ return useWrite(stream).collect(this.source());
363
+ }
208
364
  }
209
- else {
210
- return useWrite(stream);
365
+ catch (error) {
366
+ throw new Error("Uncaught error on write.");
211
367
  }
212
368
  }
213
369
  throw new TypeError("Invalid arguments.");
214
370
  }
215
371
  }
216
372
  ;
373
+ Object.freeze(Collectable);
374
+ Object.freeze(Collectable.prototype);
375
+ Object.freeze(Object.getPrototypeOf(Collectable.prototype));
217
376
  export class UnorderedCollectable extends Collectable {
218
377
  UnorderedCollectable = UnorderedCollectableSymbol;
219
378
  generator;
220
- constructor(generator) {
379
+ constructor(argument1) {
221
380
  super();
222
- this.generator = generator;
381
+ if (isFunction(argument1)) {
382
+ this.generator = argument1;
383
+ Object.defineProperties(this, {
384
+ "UnorderedCollectable": {
385
+ value: UnorderedCollectableSymbol,
386
+ writable: false,
387
+ enumerable: false,
388
+ configurable: false
389
+ },
390
+ "generator": {
391
+ value: this.generator,
392
+ writable: false,
393
+ enumerable: false,
394
+ configurable: false
395
+ }
396
+ });
397
+ Object.freeze(this);
398
+ }
399
+ else {
400
+ throw new TypeError("Source must be an iterable or a generator function.");
401
+ }
223
402
  }
224
403
  source() {
225
404
  return this.generator;
226
405
  }
406
+ *[Symbol.iterator]() {
407
+ try {
408
+ let collector = useToGeneratorFunction();
409
+ yield* collector.collect(this.generator);
410
+ }
411
+ catch (error) {
412
+ throw new Error("Uncaught error on Generator.");
413
+ }
414
+ }
415
+ async *[Symbol.asyncIterator]() {
416
+ try {
417
+ let collector = useToAsyncGeneratorFunction();
418
+ yield* collector.collect(this.generator);
419
+ }
420
+ catch (error) {
421
+ throw new Error("Uncaught error on AsyncGenerator.");
422
+ }
423
+ }
227
424
  }
228
425
  ;
426
+ Object.freeze(UnorderedCollectable);
427
+ Object.freeze(UnorderedCollectable.prototype);
428
+ Object.freeze(Object.getPrototypeOf(UnorderedCollectable.prototype));
229
429
  export class OrderedCollectable extends Collectable {
230
430
  OrderedCollectable = OrderedCollectableSymbol;
231
- ordered = [];
431
+ buffer;
232
432
  constructor(argument1, argument2) {
233
433
  super();
234
- let buffer = [];
235
- if (isIterable(argument1)) {
236
- let iterable = argument1;
237
- let index = 0n;
238
- for (let element of iterable) {
239
- buffer.push({
240
- index: index,
241
- value: element
434
+ if (isFunction(argument1)) {
435
+ try {
436
+ if (isFunction(argument2)) {
437
+ let collector = useToArray();
438
+ this.buffer = collector.collect(argument1).sort(argument2).map((element, index) => {
439
+ return {
440
+ element: element,
441
+ index: BigInt(index)
442
+ };
443
+ });
444
+ }
445
+ else {
446
+ let collector = useToArray();
447
+ this.buffer = collector.collect(argument1).map((element, index) => {
448
+ return {
449
+ element: element,
450
+ index: BigInt(index)
451
+ };
452
+ }).sort((a, b) => {
453
+ return Number(a.index - b.index);
454
+ });
455
+ }
456
+ Object.defineProperties(this, {
457
+ "OrderedCollectable": {
458
+ value: OrderedCollectableSymbol,
459
+ writable: false,
460
+ enumerable: false,
461
+ configurable: false
462
+ },
463
+ "buffer": {
464
+ value: this.buffer,
465
+ writable: false,
466
+ enumerable: false,
467
+ configurable: false
468
+ }
242
469
  });
243
- index++;
470
+ Object.freeze(this);
471
+ }
472
+ catch (error) {
473
+ throw new Error("Uncaught error on creating buffer.");
244
474
  }
245
- }
246
- else if (isFunction(argument1)) {
247
- let generator = argument1;
248
- generator((element, index) => {
249
- buffer.push({
250
- index: index,
251
- value: element
252
- });
253
- }, () => false);
254
475
  }
255
476
  else {
256
- throw new TypeError("Invalid arguments.");
477
+ throw new TypeError("Source must be an iterable or a generator function.");
257
478
  }
258
- buffer.map((indexed, _index, array) => {
259
- let length = BigInt(array.length);
260
- return {
261
- index: ((indexed.index % length) + length) % length,
262
- value: indexed.value
263
- };
264
- }).sort((a, b) => {
265
- if (isFunction(argument2)) {
266
- let comparator = argument2;
267
- return comparator(a.value, b.value);
268
- }
269
- else {
270
- return useCompare(a.index, b.index);
271
- }
272
- }).forEach((indexed) => {
273
- this.ordered.push(indexed);
274
- });
275
479
  }
276
- source() {
277
- return this.ordered.map((indexed) => indexed.value);
480
+ *[Symbol.iterator]() {
481
+ try {
482
+ let collector = useToGeneratorFunction();
483
+ yield* collector.collect(this.source());
484
+ }
485
+ catch (error) {
486
+ throw new Error("Uncaught error on Generator.");
487
+ }
278
488
  }
279
- }
280
- ;
281
- export class WindowCollectable extends OrderedCollectable {
282
- WindowCollectable = WindowCollectableSymbol;
283
- constructor(parameter, comparator) {
284
- if (isIterable(parameter)) {
285
- if (isFunction(comparator)) {
286
- super(parameter, comparator);
287
- }
288
- else {
289
- super(parameter);
290
- }
489
+ async *[Symbol.asyncIterator]() {
490
+ try {
491
+ let collector = useToAsyncGeneratorFunction();
492
+ yield* collector.collect(this.source());
291
493
  }
292
- else if (isFunction(parameter)) {
293
- if (isFunction(comparator)) {
294
- super(parameter, comparator);
295
- }
296
- else {
297
- super(parameter);
298
- }
494
+ catch (error) {
495
+ throw new Error("Uncaught error on AsyncGenerator.");
299
496
  }
300
497
  }
301
- slide(size, step = 1n) {
302
- if (size > 0n && step > 0n) {
303
- let source = this.toArray();
304
- let windows = [];
305
- let windowStartIndex = 0n;
306
- while (windowStartIndex < BigInt(source.length)) {
307
- let windowEnd = windowStartIndex + size;
308
- let window = source.slice(Number(windowStartIndex), Number(windowEnd));
309
- if (window.length > 0) {
310
- windows.push(window);
498
+ source() {
499
+ try {
500
+ return (accept, interrupt) => {
501
+ for (let indexed of this.buffer) {
502
+ if (interrupt(indexed.element, indexed.index)) {
503
+ break;
504
+ }
505
+ accept(indexed.element, indexed.index);
311
506
  }
312
- windowStartIndex += step;
313
- }
314
- return from(windows).map((window) => from(window));
507
+ };
508
+ }
509
+ catch (error) {
510
+ throw new Error("Uncaught error on creating source.");
315
511
  }
316
- throw new RangeError("Invalid arguments.");
317
512
  }
318
- tumble(size) {
319
- return this.slide(size, size);
513
+ isEmpty() {
514
+ return this.buffer.length === 0;
320
515
  }
321
516
  }
322
517
  ;
518
+ Object.freeze(OrderedCollectable);
519
+ Object.freeze(OrderedCollectable.prototype);
520
+ Object.freeze(Object.getPrototypeOf(OrderedCollectable.prototype));