@blackglory/structures 0.11.1 → 0.11.3

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.
@@ -677,146 +677,8 @@
677
677
  arr.splice(0, startIndex);
678
678
  }
679
679
 
680
- class Emitter {
681
- constructor() {
682
- this.map = new Map();
683
- }
684
- get [Symbol.toStringTag]() {
685
- return this.constructor.name;
686
- }
687
- on(event, listener) {
688
- if (!this.map.has(event)) {
689
- this.map.set(event, new Set());
690
- }
691
- const set = this.map.get(event);
692
- set.add(handler);
693
- return () => {
694
- if (!this.map.has(event))
695
- return;
696
- const handlers = this.map.get(event);
697
- handlers.delete(handler);
698
- if (handlers.size === 0) {
699
- this.map.delete(event);
700
- }
701
- };
702
- function handler(...args) {
703
- listener(...args);
704
- }
705
- }
706
- once(event, listener) {
707
- const removeListener = this.on(event, (...args) => {
708
- listener(...args);
709
- removeListener();
710
- });
711
- return removeListener;
712
- }
713
- emit(event, ...args) {
714
- if (!this.map.has(event))
715
- return;
716
- this.map.get(event).forEach(cb => cb(...args));
717
- }
718
- }
719
-
720
- class HashMap {
721
- constructor(hash) {
722
- this.hash = hash;
723
- this.map = new Map();
724
- }
725
- get [Symbol.toStringTag]() {
726
- return this.constructor.name;
727
- }
728
- get size() {
729
- return this.map.size;
730
- }
731
- set(key, value) {
732
- this.map.set(this.hash(key), value);
733
- return this;
734
- }
735
- has(key) {
736
- return this.map.has(this.hash(key));
737
- }
738
- get(key) {
739
- return this.map.get(this.hash(key));
740
- }
741
- delete(key) {
742
- return this.map.delete(this.hash(key));
743
- }
744
- clear() {
745
- this.map.clear();
746
- }
747
- }
748
-
749
- class HashSet {
750
- constructor(hash) {
751
- this.hash = hash;
752
- this.map = new Map();
753
- }
754
- get [Symbol.toStringTag]() {
755
- return this.constructor.name;
756
- }
757
- get size() {
758
- return this.map.size;
759
- }
760
- [Symbol.iterator]() {
761
- return this.map.values();
762
- }
763
- add(value) {
764
- this.map.set(this.hash(value), value);
765
- return this;
766
- }
767
- delete(value) {
768
- return this.map.delete(this.hash(value));
769
- }
770
- has(value) {
771
- return this.map.has(this.hash(value));
772
- }
773
- clear() {
774
- this.map.clear();
775
- }
776
- values() {
777
- return this.map.values();
778
- }
779
- }
780
-
781
- class Queue {
782
- constructor() {
783
- this.items = [];
784
- }
785
- get [Symbol.toStringTag]() {
786
- return this.constructor.name;
787
- }
788
- get size() {
789
- return this.items.length;
790
- }
791
- empty() {
792
- this.items.length = 0;
793
- }
794
- enqueue(...items) {
795
- this.items.push(...items);
796
- }
797
- dequeue() {
798
- return this.items.shift();
799
- }
800
- remove(item) {
801
- let index;
802
- while ((index = this.items.indexOf(item)) >= 0) {
803
- this.items.splice(index, 1);
804
- }
805
- }
806
- }
807
-
808
680
  var es2018$6 = {};
809
681
 
810
- var customError = {};
811
-
812
- var es2018$5 = {};
813
-
814
- var middleware = {};
815
-
816
- var chunkAsync = {};
817
-
818
- var es2018$4 = {};
819
-
820
682
  var go$1 = {};
821
683
 
822
684
  go$1.go = void 0;
@@ -844,11 +706,11 @@
844
706
 
845
707
  var goMacrotask$1 = {};
846
708
 
847
- var es2018$3 = {};
709
+ var es2018$5 = {};
848
710
 
849
711
  var exponentialBackoff = {};
850
712
 
851
- var es2018$2 = {};
713
+ var es2018$4 = {};
852
714
 
853
715
  var random$1 = {};
854
716
 
@@ -892,10 +754,10 @@
892
754
  __exportStar(randomInt$1, exports);
893
755
  __exportStar(randomIntInclusive$1, exports);
894
756
 
895
- } (es2018$2));
757
+ } (es2018$4));
896
758
 
897
759
  exponentialBackoff.calculateExponentialBackoffTimeout = void 0;
898
- const extra_rand_1 = es2018$2;
760
+ const extra_rand_1 = es2018$4;
899
761
  function calculateExponentialBackoffTimeout({ baseTimeout, retries, maxTimeout = Infinity, factor = 2, jitter = true }) {
900
762
  const timeout = Math.min(factor ** retries * baseTimeout, maxTimeout);
901
763
  if (jitter) {
@@ -1010,10 +872,10 @@
1010
872
  __exportStar(setTimeoutLoop$1, exports);
1011
873
  __exportStar(setDynamicTimeoutLoop$1, exports);
1012
874
 
1013
- } (es2018$3));
875
+ } (es2018$5));
1014
876
 
1015
877
  goMacrotask$1.goMacrotask = void 0;
1016
- const extra_timers_1 = es2018$3;
878
+ const extra_timers_1 = es2018$5;
1017
879
  function goMacrotask(fn) {
1018
880
  return new Promise((resolve, reject) => {
1019
881
  (0, extra_timers_1.setImmediate)(async () => {
@@ -1046,7 +908,151 @@
1046
908
  __exportStar(goMicrotask$1, exports);
1047
909
  __exportStar(goMacrotask$1, exports);
1048
910
 
1049
- } (es2018$4));
911
+ } (es2018$6));
912
+
913
+ class Emitter {
914
+ constructor() {
915
+ this.map = new Map();
916
+ }
917
+ get [Symbol.toStringTag]() {
918
+ return this.constructor.name;
919
+ }
920
+ on(event, listener) {
921
+ const set = es2018$6.go(() => {
922
+ const set = this.map.get(event);
923
+ if (set) {
924
+ return set;
925
+ }
926
+ else {
927
+ const set = new Set();
928
+ this.map.set(event, set);
929
+ return set;
930
+ }
931
+ });
932
+ set.add(handler);
933
+ return () => {
934
+ const handlers = this.map.get(event);
935
+ if (handlers) {
936
+ const deleted = handlers.delete(handler);
937
+ if (deleted && handlers.size === 0) {
938
+ this.map.delete(event);
939
+ }
940
+ }
941
+ };
942
+ function handler(...args) {
943
+ listener(...args);
944
+ }
945
+ }
946
+ once(event, listener) {
947
+ const removeListener = this.on(event, (...args) => {
948
+ listener(...args);
949
+ removeListener();
950
+ });
951
+ return removeListener;
952
+ }
953
+ emit(event, ...args) {
954
+ var _a;
955
+ (_a = this.map.get(event)) === null || _a === void 0 ? void 0 : _a.forEach(cb => cb(...args));
956
+ }
957
+ }
958
+
959
+ class HashMap {
960
+ constructor(hash) {
961
+ this.hash = hash;
962
+ this.map = new Map();
963
+ }
964
+ get [Symbol.toStringTag]() {
965
+ return this.constructor.name;
966
+ }
967
+ get size() {
968
+ return this.map.size;
969
+ }
970
+ set(key, value) {
971
+ this.map.set(this.hash(key), value);
972
+ return this;
973
+ }
974
+ has(key) {
975
+ return this.map.has(this.hash(key));
976
+ }
977
+ get(key) {
978
+ return this.map.get(this.hash(key));
979
+ }
980
+ delete(key) {
981
+ return this.map.delete(this.hash(key));
982
+ }
983
+ clear() {
984
+ this.map.clear();
985
+ }
986
+ }
987
+
988
+ class HashSet {
989
+ constructor(hash) {
990
+ this.hash = hash;
991
+ this.map = new Map();
992
+ }
993
+ get [Symbol.toStringTag]() {
994
+ return this.constructor.name;
995
+ }
996
+ get size() {
997
+ return this.map.size;
998
+ }
999
+ [Symbol.iterator]() {
1000
+ return this.map.values();
1001
+ }
1002
+ add(value) {
1003
+ this.map.set(this.hash(value), value);
1004
+ return this;
1005
+ }
1006
+ delete(value) {
1007
+ return this.map.delete(this.hash(value));
1008
+ }
1009
+ has(value) {
1010
+ return this.map.has(this.hash(value));
1011
+ }
1012
+ clear() {
1013
+ this.map.clear();
1014
+ }
1015
+ values() {
1016
+ return this.map.values();
1017
+ }
1018
+ }
1019
+
1020
+ class Queue {
1021
+ constructor() {
1022
+ this.items = [];
1023
+ }
1024
+ get [Symbol.toStringTag]() {
1025
+ return this.constructor.name;
1026
+ }
1027
+ get size() {
1028
+ return this.items.length;
1029
+ }
1030
+ empty() {
1031
+ this.items.length = 0;
1032
+ }
1033
+ enqueue(...items) {
1034
+ this.items.push(...items);
1035
+ }
1036
+ dequeue() {
1037
+ return this.items.shift();
1038
+ }
1039
+ remove(item) {
1040
+ let index;
1041
+ while ((index = this.items.indexOf(item)) >= 0) {
1042
+ this.items.splice(index, 1);
1043
+ }
1044
+ }
1045
+ }
1046
+
1047
+ var es2018$3 = {};
1048
+
1049
+ var customError = {};
1050
+
1051
+ var es2018$2 = {};
1052
+
1053
+ var middleware = {};
1054
+
1055
+ var chunkAsync = {};
1050
1056
 
1051
1057
  var hasRequiredChunkAsync;
1052
1058
 
@@ -1054,7 +1060,7 @@
1054
1060
  if (hasRequiredChunkAsync) return chunkAsync;
1055
1061
  hasRequiredChunkAsync = 1;
1056
1062
  chunkAsync.chunkAsync = void 0;
1057
- const go_1 = es2018$4;
1063
+ const go_1 = es2018$6;
1058
1064
  const errors_1 = requireEs2018();
1059
1065
  function chunkAsync$1(iterable, size) {
1060
1066
  (0, errors_1.assert)(Number.isInteger(size), 'The parameter size must be an integer');
@@ -1519,7 +1525,7 @@
1519
1525
  if (hasRequiredChunk) return chunk;
1520
1526
  hasRequiredChunk = 1;
1521
1527
  chunk.chunk = void 0;
1522
- const go_1 = es2018$4;
1528
+ const go_1 = es2018$6;
1523
1529
  const errors_1 = requireEs2018();
1524
1530
  function chunk$1(iterable, size) {
1525
1531
  (0, errors_1.assert)(Number.isInteger(size), 'The parameter size must be an integer');
@@ -1546,7 +1552,7 @@
1546
1552
 
1547
1553
  concatAsync$1.concatAsync = void 0;
1548
1554
  const types_1$i = es2018$1;
1549
- const go_1$1 = es2018$4;
1555
+ const go_1$1 = es2018$6;
1550
1556
  function concatAsync(iterable, ...otherIterables) {
1551
1557
  return (0, go_1$1.go)(async function* () {
1552
1558
  for (const iter of [iterable, ...otherIterables]) {
@@ -1568,7 +1574,7 @@
1568
1574
  var concat$1 = {};
1569
1575
 
1570
1576
  concat$1.concat = void 0;
1571
- const go_1 = es2018$4;
1577
+ const go_1 = es2018$6;
1572
1578
  function concat(iterable, ...otherIterables) {
1573
1579
  return (0, go_1.go)(function* () {
1574
1580
  for (const iter of [iterable, ...otherIterables]) {
@@ -1602,7 +1608,7 @@
1602
1608
  if (hasRequiredDropAsync) return dropAsync;
1603
1609
  hasRequiredDropAsync = 1;
1604
1610
  dropAsync.dropAsync = void 0;
1605
- const go_1 = es2018$4;
1611
+ const go_1 = es2018$6;
1606
1612
  const utils_1 = utils;
1607
1613
  const errors_1 = requireEs2018();
1608
1614
  function dropAsync$1(iterable, count) {
@@ -1645,7 +1651,7 @@
1645
1651
  if (hasRequiredDropRightAsync) return dropRightAsync;
1646
1652
  hasRequiredDropRightAsync = 1;
1647
1653
  dropRightAsync.dropRightAsync = void 0;
1648
- const go_1 = es2018$4;
1654
+ const go_1 = es2018$6;
1649
1655
  const utils_1 = utils;
1650
1656
  const errors_1 = requireEs2018();
1651
1657
  function dropRightAsync$1(iterable, count) {
@@ -1681,7 +1687,7 @@
1681
1687
  if (hasRequiredDropRight) return dropRight;
1682
1688
  hasRequiredDropRight = 1;
1683
1689
  dropRight.dropRight = void 0;
1684
- const go_1 = es2018$4;
1690
+ const go_1 = es2018$6;
1685
1691
  const utils_1 = utils;
1686
1692
  const errors_1 = requireEs2018();
1687
1693
  function dropRight$1(iterable, count) {
@@ -1789,7 +1795,7 @@
1789
1795
  if (hasRequiredDrop) return drop;
1790
1796
  hasRequiredDrop = 1;
1791
1797
  drop.drop = void 0;
1792
- const go_1 = es2018$4;
1798
+ const go_1 = es2018$6;
1793
1799
  const utils_1 = utils;
1794
1800
  const errors_1 = requireEs2018();
1795
1801
  function drop$1(iterable, count) {
@@ -2052,7 +2058,7 @@
2052
2058
  if (hasRequiredRepeatAsync) return repeatAsync;
2053
2059
  hasRequiredRepeatAsync = 1;
2054
2060
  repeatAsync.repeatAsync = void 0;
2055
- const go_1 = es2018$4;
2061
+ const go_1 = es2018$6;
2056
2062
  const errors_1 = requireEs2018();
2057
2063
  function repeatAsync$1(iterable, times) {
2058
2064
  (0, errors_1.assert)(times === Infinity || Number.isInteger(times), 'The parameter times must be an integer');
@@ -2095,7 +2101,7 @@
2095
2101
  if (hasRequiredRepeat) return repeat;
2096
2102
  hasRequiredRepeat = 1;
2097
2103
  repeat.repeat = void 0;
2098
- const go_1 = es2018$4;
2104
+ const go_1 = es2018$6;
2099
2105
  const errors_1 = requireEs2018();
2100
2106
  function repeat$1(iterable, times) {
2101
2107
  (0, errors_1.assert)(times === Infinity || Number.isInteger(times), 'The parameter times must be an integer');
@@ -2138,7 +2144,7 @@
2138
2144
  if (hasRequiredSliceAsync) return sliceAsync;
2139
2145
  hasRequiredSliceAsync = 1;
2140
2146
  sliceAsync.sliceAsync = void 0;
2141
- const go_1 = es2018$4;
2147
+ const go_1 = es2018$6;
2142
2148
  const errors_1 = requireEs2018();
2143
2149
  function sliceAsync$1(iterable, start, end = Infinity) {
2144
2150
  (0, errors_1.assert)(Number.isInteger(start), 'The parameter start must be an integer');
@@ -2169,7 +2175,7 @@
2169
2175
  if (hasRequiredSlice) return slice;
2170
2176
  hasRequiredSlice = 1;
2171
2177
  slice.slice = void 0;
2172
- const go_1 = es2018$4;
2178
+ const go_1 = es2018$6;
2173
2179
  const errors_1 = requireEs2018();
2174
2180
  function slice$1(iterable, start, end = Infinity) {
2175
2181
  (0, errors_1.assert)(Number.isInteger(start), 'The parameter start must be an integer');
@@ -2300,7 +2306,7 @@
2300
2306
  if (hasRequiredTakeAsync) return takeAsync;
2301
2307
  hasRequiredTakeAsync = 1;
2302
2308
  takeAsync.takeAsync = void 0;
2303
- const go_1 = es2018$4;
2309
+ const go_1 = es2018$6;
2304
2310
  const errors_1 = requireEs2018();
2305
2311
  function takeAsync$1(iterable, count) {
2306
2312
  (0, errors_1.assert)(Number.isInteger(count), 'The parameter count must be an integer');
@@ -2329,7 +2335,7 @@
2329
2335
  if (hasRequiredTakeRightAsync) return takeRightAsync;
2330
2336
  hasRequiredTakeRightAsync = 1;
2331
2337
  takeRightAsync.takeRightAsync = void 0;
2332
- const go_1 = es2018$4;
2338
+ const go_1 = es2018$6;
2333
2339
  const errors_1 = requireEs2018();
2334
2340
  function takeRightAsync$1(iterable, count) {
2335
2341
  (0, errors_1.assert)(Number.isInteger(count), 'The parameter count must be an integer');
@@ -2367,7 +2373,7 @@
2367
2373
  if (hasRequiredTakeRight) return takeRight;
2368
2374
  hasRequiredTakeRight = 1;
2369
2375
  takeRight.takeRight = void 0;
2370
- const go_1 = es2018$4;
2376
+ const go_1 = es2018$6;
2371
2377
  const errors_1 = requireEs2018();
2372
2378
  function takeRight$1(iterable, count) {
2373
2379
  (0, errors_1.assert)(Number.isInteger(count), 'The parameter count must be an integer');
@@ -2451,7 +2457,7 @@
2451
2457
  if (hasRequiredTake) return take;
2452
2458
  hasRequiredTake = 1;
2453
2459
  take.take = void 0;
2454
- const go_1 = es2018$4;
2460
+ const go_1 = es2018$6;
2455
2461
  const errors_1 = requireEs2018();
2456
2462
  function take$1(iterable, count) {
2457
2463
  (0, errors_1.assert)(Number.isInteger(count), 'The parameter count must be an integer');
@@ -3391,7 +3397,7 @@
3391
3397
  var hasRequiredEs2018$1;
3392
3398
 
3393
3399
  function requireEs2018$1 () {
3394
- if (hasRequiredEs2018$1) return es2018$5;
3400
+ if (hasRequiredEs2018$1) return es2018$2;
3395
3401
  hasRequiredEs2018$1 = 1;
3396
3402
  (function (exports) {
3397
3403
  var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
@@ -3410,8 +3416,8 @@
3410
3416
  };__exportStar(requireMiddleware(), exports);
3411
3417
  __exportStar(output, exports);
3412
3418
 
3413
- } (es2018$5));
3414
- return es2018$5;
3419
+ } (es2018$2));
3420
+ return es2018$2;
3415
3421
  }
3416
3422
 
3417
3423
  var getErrorNames$1 = {};
@@ -3615,7 +3621,7 @@
3615
3621
  var hasRequiredEs2018;
3616
3622
 
3617
3623
  function requireEs2018 () {
3618
- if (hasRequiredEs2018) return es2018$6;
3624
+ if (hasRequiredEs2018) return es2018$3;
3619
3625
  hasRequiredEs2018 = 1;
3620
3626
  (function (exports) {
3621
3627
  var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
@@ -3640,8 +3646,8 @@
3640
3646
  __exportStar(getErrorNames$1, exports);
3641
3647
  __exportStar(traverseErrorPrototypeChain$1, exports);
3642
3648
 
3643
- } (es2018$6));
3644
- return es2018$6;
3649
+ } (es2018$3));
3650
+ return es2018$3;
3645
3651
  }
3646
3652
 
3647
3653
  var es2018Exports$1 = requireEs2018();
@@ -3790,7 +3796,7 @@
3790
3796
  if (this.itemMetadataSortedByExpirationTime.length > 0) {
3791
3797
  const item = this.itemMetadataSortedByExpirationTime[0];
3792
3798
  if (Number.isFinite(item.expirationTime)) {
3793
- const cancel = es2018$3.setSchedule(item.expirationTime, () => {
3799
+ const cancel = es2018$5.setSchedule(item.expirationTime, () => {
3794
3800
  this.clearExpiredItems(Date.now());
3795
3801
  this.rescheduleClearTimeout();
3796
3802
  });
@@ -3918,7 +3924,7 @@
3918
3924
  if (this.itemMetadataSortedByExpirationTime.length > 0) {
3919
3925
  const item = this.itemMetadataSortedByExpirationTime[0];
3920
3926
  if (Number.isFinite(item.expirationTime)) {
3921
- const cancel = es2018$3.setSchedule(item.expirationTime, () => {
3927
+ const cancel = es2018$5.setSchedule(item.expirationTime, () => {
3922
3928
  this.clearExpiredItems(Date.now());
3923
3929
  this.rescheduleClearTimeout();
3924
3930
  });