data-structure-typed 2.2.0 → 2.2.2

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.
Files changed (48) hide show
  1. package/CHANGELOG.md +3 -1
  2. package/README.md +1511 -840
  3. package/benchmark/report.html +1 -1
  4. package/benchmark/report.json +145 -169
  5. package/dist/cjs/index.cjs +20 -20
  6. package/dist/cjs/index.cjs.map +1 -1
  7. package/dist/cjs-legacy/index.cjs +20 -20
  8. package/dist/cjs-legacy/index.cjs.map +1 -1
  9. package/dist/esm/index.mjs +20 -20
  10. package/dist/esm/index.mjs.map +1 -1
  11. package/dist/esm-legacy/index.mjs +20 -20
  12. package/dist/esm-legacy/index.mjs.map +1 -1
  13. package/dist/types/data-structures/binary-tree/avl-tree.d.ts +3 -1
  14. package/dist/types/data-structures/binary-tree/binary-tree.d.ts +1 -0
  15. package/dist/types/data-structures/binary-tree/bst.d.ts +1 -0
  16. package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +1 -0
  17. package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +1 -0
  18. package/dist/types/types/data-structures/base/base.d.ts +1 -1
  19. package/dist/umd/data-structure-typed.js +20 -20
  20. package/dist/umd/data-structure-typed.js.map +1 -1
  21. package/dist/umd/data-structure-typed.min.js +2 -2
  22. package/dist/umd/data-structure-typed.min.js.map +1 -1
  23. package/package.json +2 -2
  24. package/src/data-structures/base/iterable-entry-base.ts +4 -4
  25. package/src/data-structures/binary-tree/avl-tree-counter.ts +1 -1
  26. package/src/data-structures/binary-tree/avl-tree-multi-map.ts +1 -1
  27. package/src/data-structures/binary-tree/avl-tree.ts +4 -2
  28. package/src/data-structures/binary-tree/binary-tree.ts +3 -2
  29. package/src/data-structures/binary-tree/bst.ts +2 -1
  30. package/src/data-structures/binary-tree/red-black-tree.ts +2 -1
  31. package/src/data-structures/binary-tree/tree-counter.ts +1 -1
  32. package/src/data-structures/binary-tree/tree-multi-map.ts +2 -1
  33. package/src/data-structures/graph/abstract-graph.ts +3 -3
  34. package/src/data-structures/hash/hash-map.ts +4 -4
  35. package/src/types/data-structures/base/base.ts +1 -1
  36. package/test/performance/data-structures/binary-tree/red-black-tree.test.ts +39 -36
  37. package/test/performance/runner-config.json +4 -4
  38. package/test/unit/data-structures/binary-tree/avl-tree-counter.test.ts +3 -3
  39. package/test/unit/data-structures/binary-tree/avl-tree-multi-map.test.ts +3 -3
  40. package/test/unit/data-structures/binary-tree/avl-tree.test.ts +3 -3
  41. package/test/unit/data-structures/binary-tree/binary-tree.test.ts +4 -4
  42. package/test/unit/data-structures/binary-tree/bst.test.ts +3 -3
  43. package/test/unit/data-structures/binary-tree/red-black-tree.test.ts +3 -3
  44. package/test/unit/data-structures/binary-tree/tree-counter.test.ts +3 -3
  45. package/test/unit/data-structures/binary-tree/tree-multi-map.test.ts +3 -3
  46. package/test/unit/data-structures/graph/directed-graph.test.ts +3 -3
  47. package/test/unit/data-structures/hash/hash-map.test.ts +14 -14
  48. package/test/performance/reportor.mjs +0 -505
@@ -53,7 +53,7 @@ var _IterableEntryBase = class _IterableEntryBase {
53
53
  every(predicate, thisArg) {
54
54
  let index = 0;
55
55
  for (const item of this) {
56
- if (!predicate.call(thisArg, item[0], item[1], index++, this)) {
56
+ if (!predicate.call(thisArg, item[1], item[0], index++, this)) {
57
57
  return false;
58
58
  }
59
59
  }
@@ -69,7 +69,7 @@ var _IterableEntryBase = class _IterableEntryBase {
69
69
  some(predicate, thisArg) {
70
70
  let index = 0;
71
71
  for (const item of this) {
72
- if (predicate.call(thisArg, item[0], item[1], index++, this)) {
72
+ if (predicate.call(thisArg, item[1], item[0], index++, this)) {
73
73
  return true;
74
74
  }
75
75
  }
@@ -85,7 +85,7 @@ var _IterableEntryBase = class _IterableEntryBase {
85
85
  let index = 0;
86
86
  for (const item of this) {
87
87
  const [key, value] = item;
88
- callbackfn.call(thisArg, key, value, index++, this);
88
+ callbackfn.call(thisArg, value, key, index++, this);
89
89
  }
90
90
  }
91
91
  /**
@@ -99,7 +99,7 @@ var _IterableEntryBase = class _IterableEntryBase {
99
99
  let index = 0;
100
100
  for (const item of this) {
101
101
  const [key, value] = item;
102
- if (callbackfn.call(thisArg, key, value, index++, this)) return item;
102
+ if (callbackfn.call(thisArg, value, key, index++, this)) return item;
103
103
  }
104
104
  return;
105
105
  }
@@ -713,7 +713,7 @@ var _HashMap = class _HashMap extends IterableEntryBase {
713
713
  map(callbackfn, thisArg) {
714
714
  const out = this._createLike();
715
715
  let index = 0;
716
- for (const [key, value] of this) out.set(key, callbackfn.call(thisArg, key, value, index++, this));
716
+ for (const [key, value] of this) out.set(key, callbackfn.call(thisArg, value, key, index++, this));
717
717
  return out;
718
718
  }
719
719
  /**
@@ -726,7 +726,7 @@ var _HashMap = class _HashMap extends IterableEntryBase {
726
726
  filter(predicate, thisArg) {
727
727
  const out = this._createLike();
728
728
  let index = 0;
729
- for (const [key, value] of this) if (predicate.call(thisArg, key, value, index++, this)) out.set(key, value);
729
+ for (const [key, value] of this) if (predicate.call(thisArg, value, key, index++, this)) out.set(key, value);
730
730
  return out;
731
731
  }
732
732
  /**
@@ -1050,7 +1050,7 @@ var _LinkedHashMap = class _LinkedHashMap extends IterableEntryBase {
1050
1050
  const out = this._createLike();
1051
1051
  let index = 0;
1052
1052
  for (const [key, value] of this) {
1053
- if (predicate.call(thisArg, key, value, index, this)) out.set(key, value);
1053
+ if (predicate.call(thisArg, value, key, index, this)) out.set(key, value);
1054
1054
  index++;
1055
1055
  }
1056
1056
  return out;
@@ -1068,7 +1068,7 @@ var _LinkedHashMap = class _LinkedHashMap extends IterableEntryBase {
1068
1068
  const out = this._createLike();
1069
1069
  let index = 0;
1070
1070
  for (const [key, value] of this) {
1071
- const [newKey, newValue] = callback.call(thisArg, key, value, index, this);
1071
+ const [newKey, newValue] = callback.call(thisArg, value, key, index, this);
1072
1072
  out.set(newKey, newValue);
1073
1073
  index++;
1074
1074
  }
@@ -5677,7 +5677,7 @@ var _AbstractGraph = class _AbstractGraph extends IterableEntryBase {
5677
5677
  const filtered = [];
5678
5678
  let index = 0;
5679
5679
  for (const [key, value] of this) {
5680
- if (predicate.call(thisArg, key, value, index, this)) {
5680
+ if (predicate.call(thisArg, value, key, index, this)) {
5681
5681
  filtered.push([key, value]);
5682
5682
  }
5683
5683
  index++;
@@ -5692,7 +5692,7 @@ var _AbstractGraph = class _AbstractGraph extends IterableEntryBase {
5692
5692
  const filtered = [];
5693
5693
  let index = 0;
5694
5694
  for (const [key, value] of this) {
5695
- if (predicate.call(thisArg, key, value, index, this)) {
5695
+ if (predicate.call(thisArg, value, key, index, this)) {
5696
5696
  filtered.push([key, value]);
5697
5697
  }
5698
5698
  index++;
@@ -5703,7 +5703,7 @@ var _AbstractGraph = class _AbstractGraph extends IterableEntryBase {
5703
5703
  const mapped = [];
5704
5704
  let index = 0;
5705
5705
  for (const [key, value] of this) {
5706
- mapped.push(callback.call(thisArg, key, value, index, this));
5706
+ mapped.push(callback.call(thisArg, value, key, index, this));
5707
5707
  index++;
5708
5708
  }
5709
5709
  return mapped;
@@ -7980,7 +7980,7 @@ var _BinaryTree = class _BinaryTree extends IterableEntryBase {
7980
7980
  filter(predicate, thisArg) {
7981
7981
  const out = this._createInstance();
7982
7982
  let i = 0;
7983
- for (const [k, v] of this) if (predicate.call(thisArg, k, v, i++, this)) out.add([k, v]);
7983
+ for (const [k, v] of this) if (predicate.call(thisArg, v, k, i++, this)) out.add([k, v]);
7984
7984
  return out;
7985
7985
  }
7986
7986
  /**
@@ -7998,7 +7998,7 @@ var _BinaryTree = class _BinaryTree extends IterableEntryBase {
7998
7998
  map(cb, options, thisArg) {
7999
7999
  const out = this._createLike([], options);
8000
8000
  let i = 0;
8001
- for (const [k, v] of this) out.add(cb.call(thisArg, k, v, i++, this));
8001
+ for (const [k, v] of this) out.add(cb.call(thisArg, v, k, i++, this));
8002
8002
  return out;
8003
8003
  }
8004
8004
  /**
@@ -9098,7 +9098,7 @@ var _BST = class _BST extends BinaryTree {
9098
9098
  const out = this._createLike([], options);
9099
9099
  let index = 0;
9100
9100
  for (const [key, value] of this) {
9101
- out.add(callback.call(thisArg, key, value, index++, this));
9101
+ out.add(callback.call(thisArg, value, key, index++, this));
9102
9102
  }
9103
9103
  return out;
9104
9104
  }
@@ -10071,7 +10071,7 @@ var _AVLTree = class _AVLTree extends BST {
10071
10071
  const out = this._createLike([], options);
10072
10072
  let index = 0;
10073
10073
  for (const [key, value] of this) {
10074
- out.add(callback.call(thisArg, key, value, index++, this));
10074
+ out.add(callback.call(thisArg, value, key, index++, this));
10075
10075
  }
10076
10076
  return out;
10077
10077
  }
@@ -10637,7 +10637,7 @@ var _RedBlackTree = class _RedBlackTree extends BST {
10637
10637
  const out = this._createLike([], options);
10638
10638
  let index = 0;
10639
10639
  for (const [key, value] of this) {
10640
- out.add(callback.call(thisArg, key, value, index++, this));
10640
+ out.add(callback.call(thisArg, value, key, index++, this));
10641
10641
  }
10642
10642
  return out;
10643
10643
  }
@@ -11150,7 +11150,7 @@ var _AVLTreeMultiMap = class _AVLTreeMultiMap extends AVLTree {
11150
11150
  map(callback, options, thisArg) {
11151
11151
  const out = this._createLike([], options);
11152
11152
  let i = 0;
11153
- for (const [k, v] of this) out.add(callback.call(thisArg, k, v, i++, this));
11153
+ for (const [k, v] of this) out.add(callback.call(thisArg, v, k, i++, this));
11154
11154
  return out;
11155
11155
  }
11156
11156
  /**
@@ -11429,7 +11429,7 @@ var _TreeMultiMap = class _TreeMultiMap extends RedBlackTree {
11429
11429
  map(callback, options, thisArg) {
11430
11430
  const out = this._createLike([], options);
11431
11431
  let i = 0;
11432
- for (const [k, v] of this) out.add(callback.call(thisArg, k, v, i++, this));
11432
+ for (const [k, v] of this) out.add(callback.call(thisArg, v, k, i++, this));
11433
11433
  return out;
11434
11434
  }
11435
11435
  /**
@@ -11810,7 +11810,7 @@ var _TreeCounter = class _TreeCounter extends RedBlackTree {
11810
11810
  const out = this._createLike([], options);
11811
11811
  let index = 0;
11812
11812
  for (const [key, value] of this) {
11813
- out.add(callback.call(thisArg, key, value, index++, this));
11813
+ out.add(callback.call(thisArg, value, key, index++, this));
11814
11814
  }
11815
11815
  return out;
11816
11816
  }
@@ -12234,7 +12234,7 @@ var _AVLTreeCounter = class _AVLTreeCounter extends AVLTree {
12234
12234
  const out = this._createLike([], options);
12235
12235
  let index = 0;
12236
12236
  for (const [key, value] of this) {
12237
- out.add(callback.call(thisArg, key, value, index++, this));
12237
+ out.add(callback.call(thisArg, value, key, index++, this));
12238
12238
  }
12239
12239
  return out;
12240
12240
  }