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.
- package/CHANGELOG.md +3 -1
- package/README.md +1511 -840
- package/benchmark/report.html +1 -1
- package/benchmark/report.json +145 -169
- package/dist/cjs/index.cjs +20 -20
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs-legacy/index.cjs +20 -20
- package/dist/cjs-legacy/index.cjs.map +1 -1
- package/dist/esm/index.mjs +20 -20
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm-legacy/index.mjs +20 -20
- package/dist/esm-legacy/index.mjs.map +1 -1
- package/dist/types/data-structures/binary-tree/avl-tree.d.ts +3 -1
- package/dist/types/data-structures/binary-tree/binary-tree.d.ts +1 -0
- package/dist/types/data-structures/binary-tree/bst.d.ts +1 -0
- package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +1 -0
- package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +1 -0
- package/dist/types/types/data-structures/base/base.d.ts +1 -1
- package/dist/umd/data-structure-typed.js +20 -20
- package/dist/umd/data-structure-typed.js.map +1 -1
- package/dist/umd/data-structure-typed.min.js +2 -2
- package/dist/umd/data-structure-typed.min.js.map +1 -1
- package/package.json +2 -2
- package/src/data-structures/base/iterable-entry-base.ts +4 -4
- package/src/data-structures/binary-tree/avl-tree-counter.ts +1 -1
- package/src/data-structures/binary-tree/avl-tree-multi-map.ts +1 -1
- package/src/data-structures/binary-tree/avl-tree.ts +4 -2
- package/src/data-structures/binary-tree/binary-tree.ts +3 -2
- package/src/data-structures/binary-tree/bst.ts +2 -1
- package/src/data-structures/binary-tree/red-black-tree.ts +2 -1
- package/src/data-structures/binary-tree/tree-counter.ts +1 -1
- package/src/data-structures/binary-tree/tree-multi-map.ts +2 -1
- package/src/data-structures/graph/abstract-graph.ts +3 -3
- package/src/data-structures/hash/hash-map.ts +4 -4
- package/src/types/data-structures/base/base.ts +1 -1
- package/test/performance/data-structures/binary-tree/red-black-tree.test.ts +39 -36
- package/test/performance/runner-config.json +4 -4
- package/test/unit/data-structures/binary-tree/avl-tree-counter.test.ts +3 -3
- package/test/unit/data-structures/binary-tree/avl-tree-multi-map.test.ts +3 -3
- package/test/unit/data-structures/binary-tree/avl-tree.test.ts +3 -3
- package/test/unit/data-structures/binary-tree/binary-tree.test.ts +4 -4
- package/test/unit/data-structures/binary-tree/bst.test.ts +3 -3
- package/test/unit/data-structures/binary-tree/red-black-tree.test.ts +3 -3
- package/test/unit/data-structures/binary-tree/tree-counter.test.ts +3 -3
- package/test/unit/data-structures/binary-tree/tree-multi-map.test.ts +3 -3
- package/test/unit/data-structures/graph/directed-graph.test.ts +3 -3
- package/test/unit/data-structures/hash/hash-map.test.ts +14 -14
- package/test/performance/reportor.mjs +0 -505
package/dist/esm/index.mjs
CHANGED
|
@@ -54,7 +54,7 @@ var IterableEntryBase = class {
|
|
|
54
54
|
every(predicate, thisArg) {
|
|
55
55
|
let index = 0;
|
|
56
56
|
for (const item of this) {
|
|
57
|
-
if (!predicate.call(thisArg, item[
|
|
57
|
+
if (!predicate.call(thisArg, item[1], item[0], index++, this)) {
|
|
58
58
|
return false;
|
|
59
59
|
}
|
|
60
60
|
}
|
|
@@ -70,7 +70,7 @@ var IterableEntryBase = class {
|
|
|
70
70
|
some(predicate, thisArg) {
|
|
71
71
|
let index = 0;
|
|
72
72
|
for (const item of this) {
|
|
73
|
-
if (predicate.call(thisArg, item[
|
|
73
|
+
if (predicate.call(thisArg, item[1], item[0], index++, this)) {
|
|
74
74
|
return true;
|
|
75
75
|
}
|
|
76
76
|
}
|
|
@@ -86,7 +86,7 @@ var IterableEntryBase = class {
|
|
|
86
86
|
let index = 0;
|
|
87
87
|
for (const item of this) {
|
|
88
88
|
const [key, value] = item;
|
|
89
|
-
callbackfn.call(thisArg,
|
|
89
|
+
callbackfn.call(thisArg, value, key, index++, this);
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
/**
|
|
@@ -100,7 +100,7 @@ var IterableEntryBase = class {
|
|
|
100
100
|
let index = 0;
|
|
101
101
|
for (const item of this) {
|
|
102
102
|
const [key, value] = item;
|
|
103
|
-
if (callbackfn.call(thisArg,
|
|
103
|
+
if (callbackfn.call(thisArg, value, key, index++, this)) return item;
|
|
104
104
|
}
|
|
105
105
|
return;
|
|
106
106
|
}
|
|
@@ -715,7 +715,7 @@ var HashMap = class extends IterableEntryBase {
|
|
|
715
715
|
map(callbackfn, thisArg) {
|
|
716
716
|
const out = this._createLike();
|
|
717
717
|
let index = 0;
|
|
718
|
-
for (const [key, value] of this) out.set(key, callbackfn.call(thisArg,
|
|
718
|
+
for (const [key, value] of this) out.set(key, callbackfn.call(thisArg, value, key, index++, this));
|
|
719
719
|
return out;
|
|
720
720
|
}
|
|
721
721
|
/**
|
|
@@ -728,7 +728,7 @@ var HashMap = class extends IterableEntryBase {
|
|
|
728
728
|
filter(predicate, thisArg) {
|
|
729
729
|
const out = this._createLike();
|
|
730
730
|
let index = 0;
|
|
731
|
-
for (const [key, value] of this) if (predicate.call(thisArg,
|
|
731
|
+
for (const [key, value] of this) if (predicate.call(thisArg, value, key, index++, this)) out.set(key, value);
|
|
732
732
|
return out;
|
|
733
733
|
}
|
|
734
734
|
/**
|
|
@@ -1053,7 +1053,7 @@ var LinkedHashMap = class extends IterableEntryBase {
|
|
|
1053
1053
|
const out = this._createLike();
|
|
1054
1054
|
let index = 0;
|
|
1055
1055
|
for (const [key, value] of this) {
|
|
1056
|
-
if (predicate.call(thisArg,
|
|
1056
|
+
if (predicate.call(thisArg, value, key, index, this)) out.set(key, value);
|
|
1057
1057
|
index++;
|
|
1058
1058
|
}
|
|
1059
1059
|
return out;
|
|
@@ -1071,7 +1071,7 @@ var LinkedHashMap = class extends IterableEntryBase {
|
|
|
1071
1071
|
const out = this._createLike();
|
|
1072
1072
|
let index = 0;
|
|
1073
1073
|
for (const [key, value] of this) {
|
|
1074
|
-
const [newKey, newValue] = callback.call(thisArg,
|
|
1074
|
+
const [newKey, newValue] = callback.call(thisArg, value, key, index, this);
|
|
1075
1075
|
out.set(newKey, newValue);
|
|
1076
1076
|
index++;
|
|
1077
1077
|
}
|
|
@@ -5690,7 +5690,7 @@ var AbstractGraph = class extends IterableEntryBase {
|
|
|
5690
5690
|
const filtered = [];
|
|
5691
5691
|
let index = 0;
|
|
5692
5692
|
for (const [key, value] of this) {
|
|
5693
|
-
if (predicate.call(thisArg,
|
|
5693
|
+
if (predicate.call(thisArg, value, key, index, this)) {
|
|
5694
5694
|
filtered.push([key, value]);
|
|
5695
5695
|
}
|
|
5696
5696
|
index++;
|
|
@@ -5705,7 +5705,7 @@ var AbstractGraph = class extends IterableEntryBase {
|
|
|
5705
5705
|
const filtered = [];
|
|
5706
5706
|
let index = 0;
|
|
5707
5707
|
for (const [key, value] of this) {
|
|
5708
|
-
if (predicate.call(thisArg,
|
|
5708
|
+
if (predicate.call(thisArg, value, key, index, this)) {
|
|
5709
5709
|
filtered.push([key, value]);
|
|
5710
5710
|
}
|
|
5711
5711
|
index++;
|
|
@@ -5716,7 +5716,7 @@ var AbstractGraph = class extends IterableEntryBase {
|
|
|
5716
5716
|
const mapped = [];
|
|
5717
5717
|
let index = 0;
|
|
5718
5718
|
for (const [key, value] of this) {
|
|
5719
|
-
mapped.push(callback.call(thisArg,
|
|
5719
|
+
mapped.push(callback.call(thisArg, value, key, index, this));
|
|
5720
5720
|
index++;
|
|
5721
5721
|
}
|
|
5722
5722
|
return mapped;
|
|
@@ -7992,7 +7992,7 @@ var BinaryTree = class extends IterableEntryBase {
|
|
|
7992
7992
|
filter(predicate, thisArg) {
|
|
7993
7993
|
const out = this._createInstance();
|
|
7994
7994
|
let i = 0;
|
|
7995
|
-
for (const [k, v] of this) if (predicate.call(thisArg,
|
|
7995
|
+
for (const [k, v] of this) if (predicate.call(thisArg, v, k, i++, this)) out.add([k, v]);
|
|
7996
7996
|
return out;
|
|
7997
7997
|
}
|
|
7998
7998
|
/**
|
|
@@ -8010,7 +8010,7 @@ var BinaryTree = class extends IterableEntryBase {
|
|
|
8010
8010
|
map(cb, options, thisArg) {
|
|
8011
8011
|
const out = this._createLike([], options);
|
|
8012
8012
|
let i = 0;
|
|
8013
|
-
for (const [k, v] of this) out.add(cb.call(thisArg,
|
|
8013
|
+
for (const [k, v] of this) out.add(cb.call(thisArg, v, k, i++, this));
|
|
8014
8014
|
return out;
|
|
8015
8015
|
}
|
|
8016
8016
|
/**
|
|
@@ -9116,7 +9116,7 @@ var BST = class extends BinaryTree {
|
|
|
9116
9116
|
const out = this._createLike([], options);
|
|
9117
9117
|
let index = 0;
|
|
9118
9118
|
for (const [key, value] of this) {
|
|
9119
|
-
out.add(callback.call(thisArg,
|
|
9119
|
+
out.add(callback.call(thisArg, value, key, index++, this));
|
|
9120
9120
|
}
|
|
9121
9121
|
return out;
|
|
9122
9122
|
}
|
|
@@ -10093,7 +10093,7 @@ var AVLTree = class extends BST {
|
|
|
10093
10093
|
const out = this._createLike([], options);
|
|
10094
10094
|
let index = 0;
|
|
10095
10095
|
for (const [key, value] of this) {
|
|
10096
|
-
out.add(callback.call(thisArg,
|
|
10096
|
+
out.add(callback.call(thisArg, value, key, index++, this));
|
|
10097
10097
|
}
|
|
10098
10098
|
return out;
|
|
10099
10099
|
}
|
|
@@ -10661,7 +10661,7 @@ var RedBlackTree = class extends BST {
|
|
|
10661
10661
|
const out = this._createLike([], options);
|
|
10662
10662
|
let index = 0;
|
|
10663
10663
|
for (const [key, value] of this) {
|
|
10664
|
-
out.add(callback.call(thisArg,
|
|
10664
|
+
out.add(callback.call(thisArg, value, key, index++, this));
|
|
10665
10665
|
}
|
|
10666
10666
|
return out;
|
|
10667
10667
|
}
|
|
@@ -11173,7 +11173,7 @@ var AVLTreeMultiMap = class extends AVLTree {
|
|
|
11173
11173
|
map(callback, options, thisArg) {
|
|
11174
11174
|
const out = this._createLike([], options);
|
|
11175
11175
|
let i = 0;
|
|
11176
|
-
for (const [k, v] of this) out.add(callback.call(thisArg,
|
|
11176
|
+
for (const [k, v] of this) out.add(callback.call(thisArg, v, k, i++, this));
|
|
11177
11177
|
return out;
|
|
11178
11178
|
}
|
|
11179
11179
|
/**
|
|
@@ -11452,7 +11452,7 @@ var TreeMultiMap = class extends RedBlackTree {
|
|
|
11452
11452
|
map(callback, options, thisArg) {
|
|
11453
11453
|
const out = this._createLike([], options);
|
|
11454
11454
|
let i = 0;
|
|
11455
|
-
for (const [k, v] of this) out.add(callback.call(thisArg,
|
|
11455
|
+
for (const [k, v] of this) out.add(callback.call(thisArg, v, k, i++, this));
|
|
11456
11456
|
return out;
|
|
11457
11457
|
}
|
|
11458
11458
|
/**
|
|
@@ -11833,7 +11833,7 @@ var TreeCounter = class extends RedBlackTree {
|
|
|
11833
11833
|
const out = this._createLike([], options);
|
|
11834
11834
|
let index = 0;
|
|
11835
11835
|
for (const [key, value] of this) {
|
|
11836
|
-
out.add(callback.call(thisArg,
|
|
11836
|
+
out.add(callback.call(thisArg, value, key, index++, this));
|
|
11837
11837
|
}
|
|
11838
11838
|
return out;
|
|
11839
11839
|
}
|
|
@@ -12258,7 +12258,7 @@ var AVLTreeCounter = class extends AVLTree {
|
|
|
12258
12258
|
const out = this._createLike([], options);
|
|
12259
12259
|
let index = 0;
|
|
12260
12260
|
for (const [key, value] of this) {
|
|
12261
|
-
out.add(callback.call(thisArg,
|
|
12261
|
+
out.add(callback.call(thisArg, value, key, index++, this));
|
|
12262
12262
|
}
|
|
12263
12263
|
return out;
|
|
12264
12264
|
}
|