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/cjs/index.cjs
CHANGED
|
@@ -56,7 +56,7 @@ var IterableEntryBase = class {
|
|
|
56
56
|
every(predicate, thisArg) {
|
|
57
57
|
let index = 0;
|
|
58
58
|
for (const item of this) {
|
|
59
|
-
if (!predicate.call(thisArg, item[
|
|
59
|
+
if (!predicate.call(thisArg, item[1], item[0], index++, this)) {
|
|
60
60
|
return false;
|
|
61
61
|
}
|
|
62
62
|
}
|
|
@@ -72,7 +72,7 @@ var IterableEntryBase = class {
|
|
|
72
72
|
some(predicate, thisArg) {
|
|
73
73
|
let index = 0;
|
|
74
74
|
for (const item of this) {
|
|
75
|
-
if (predicate.call(thisArg, item[
|
|
75
|
+
if (predicate.call(thisArg, item[1], item[0], index++, this)) {
|
|
76
76
|
return true;
|
|
77
77
|
}
|
|
78
78
|
}
|
|
@@ -88,7 +88,7 @@ var IterableEntryBase = class {
|
|
|
88
88
|
let index = 0;
|
|
89
89
|
for (const item of this) {
|
|
90
90
|
const [key, value] = item;
|
|
91
|
-
callbackfn.call(thisArg,
|
|
91
|
+
callbackfn.call(thisArg, value, key, index++, this);
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
/**
|
|
@@ -102,7 +102,7 @@ var IterableEntryBase = class {
|
|
|
102
102
|
let index = 0;
|
|
103
103
|
for (const item of this) {
|
|
104
104
|
const [key, value] = item;
|
|
105
|
-
if (callbackfn.call(thisArg,
|
|
105
|
+
if (callbackfn.call(thisArg, value, key, index++, this)) return item;
|
|
106
106
|
}
|
|
107
107
|
return;
|
|
108
108
|
}
|
|
@@ -717,7 +717,7 @@ var HashMap = class extends IterableEntryBase {
|
|
|
717
717
|
map(callbackfn, thisArg) {
|
|
718
718
|
const out = this._createLike();
|
|
719
719
|
let index = 0;
|
|
720
|
-
for (const [key, value] of this) out.set(key, callbackfn.call(thisArg,
|
|
720
|
+
for (const [key, value] of this) out.set(key, callbackfn.call(thisArg, value, key, index++, this));
|
|
721
721
|
return out;
|
|
722
722
|
}
|
|
723
723
|
/**
|
|
@@ -730,7 +730,7 @@ var HashMap = class extends IterableEntryBase {
|
|
|
730
730
|
filter(predicate, thisArg) {
|
|
731
731
|
const out = this._createLike();
|
|
732
732
|
let index = 0;
|
|
733
|
-
for (const [key, value] of this) if (predicate.call(thisArg,
|
|
733
|
+
for (const [key, value] of this) if (predicate.call(thisArg, value, key, index++, this)) out.set(key, value);
|
|
734
734
|
return out;
|
|
735
735
|
}
|
|
736
736
|
/**
|
|
@@ -1055,7 +1055,7 @@ var LinkedHashMap = class extends IterableEntryBase {
|
|
|
1055
1055
|
const out = this._createLike();
|
|
1056
1056
|
let index = 0;
|
|
1057
1057
|
for (const [key, value] of this) {
|
|
1058
|
-
if (predicate.call(thisArg,
|
|
1058
|
+
if (predicate.call(thisArg, value, key, index, this)) out.set(key, value);
|
|
1059
1059
|
index++;
|
|
1060
1060
|
}
|
|
1061
1061
|
return out;
|
|
@@ -1073,7 +1073,7 @@ var LinkedHashMap = class extends IterableEntryBase {
|
|
|
1073
1073
|
const out = this._createLike();
|
|
1074
1074
|
let index = 0;
|
|
1075
1075
|
for (const [key, value] of this) {
|
|
1076
|
-
const [newKey, newValue] = callback.call(thisArg,
|
|
1076
|
+
const [newKey, newValue] = callback.call(thisArg, value, key, index, this);
|
|
1077
1077
|
out.set(newKey, newValue);
|
|
1078
1078
|
index++;
|
|
1079
1079
|
}
|
|
@@ -5692,7 +5692,7 @@ var AbstractGraph = class extends IterableEntryBase {
|
|
|
5692
5692
|
const filtered = [];
|
|
5693
5693
|
let index = 0;
|
|
5694
5694
|
for (const [key, value] of this) {
|
|
5695
|
-
if (predicate.call(thisArg,
|
|
5695
|
+
if (predicate.call(thisArg, value, key, index, this)) {
|
|
5696
5696
|
filtered.push([key, value]);
|
|
5697
5697
|
}
|
|
5698
5698
|
index++;
|
|
@@ -5707,7 +5707,7 @@ var AbstractGraph = class extends IterableEntryBase {
|
|
|
5707
5707
|
const filtered = [];
|
|
5708
5708
|
let index = 0;
|
|
5709
5709
|
for (const [key, value] of this) {
|
|
5710
|
-
if (predicate.call(thisArg,
|
|
5710
|
+
if (predicate.call(thisArg, value, key, index, this)) {
|
|
5711
5711
|
filtered.push([key, value]);
|
|
5712
5712
|
}
|
|
5713
5713
|
index++;
|
|
@@ -5718,7 +5718,7 @@ var AbstractGraph = class extends IterableEntryBase {
|
|
|
5718
5718
|
const mapped = [];
|
|
5719
5719
|
let index = 0;
|
|
5720
5720
|
for (const [key, value] of this) {
|
|
5721
|
-
mapped.push(callback.call(thisArg,
|
|
5721
|
+
mapped.push(callback.call(thisArg, value, key, index, this));
|
|
5722
5722
|
index++;
|
|
5723
5723
|
}
|
|
5724
5724
|
return mapped;
|
|
@@ -7994,7 +7994,7 @@ var BinaryTree = class extends IterableEntryBase {
|
|
|
7994
7994
|
filter(predicate, thisArg) {
|
|
7995
7995
|
const out = this._createInstance();
|
|
7996
7996
|
let i = 0;
|
|
7997
|
-
for (const [k, v] of this) if (predicate.call(thisArg,
|
|
7997
|
+
for (const [k, v] of this) if (predicate.call(thisArg, v, k, i++, this)) out.add([k, v]);
|
|
7998
7998
|
return out;
|
|
7999
7999
|
}
|
|
8000
8000
|
/**
|
|
@@ -8012,7 +8012,7 @@ var BinaryTree = class extends IterableEntryBase {
|
|
|
8012
8012
|
map(cb, options, thisArg) {
|
|
8013
8013
|
const out = this._createLike([], options);
|
|
8014
8014
|
let i = 0;
|
|
8015
|
-
for (const [k, v] of this) out.add(cb.call(thisArg,
|
|
8015
|
+
for (const [k, v] of this) out.add(cb.call(thisArg, v, k, i++, this));
|
|
8016
8016
|
return out;
|
|
8017
8017
|
}
|
|
8018
8018
|
/**
|
|
@@ -9118,7 +9118,7 @@ var BST = class extends BinaryTree {
|
|
|
9118
9118
|
const out = this._createLike([], options);
|
|
9119
9119
|
let index = 0;
|
|
9120
9120
|
for (const [key, value] of this) {
|
|
9121
|
-
out.add(callback.call(thisArg,
|
|
9121
|
+
out.add(callback.call(thisArg, value, key, index++, this));
|
|
9122
9122
|
}
|
|
9123
9123
|
return out;
|
|
9124
9124
|
}
|
|
@@ -10095,7 +10095,7 @@ var AVLTree = class extends BST {
|
|
|
10095
10095
|
const out = this._createLike([], options);
|
|
10096
10096
|
let index = 0;
|
|
10097
10097
|
for (const [key, value] of this) {
|
|
10098
|
-
out.add(callback.call(thisArg,
|
|
10098
|
+
out.add(callback.call(thisArg, value, key, index++, this));
|
|
10099
10099
|
}
|
|
10100
10100
|
return out;
|
|
10101
10101
|
}
|
|
@@ -10663,7 +10663,7 @@ var RedBlackTree = class extends BST {
|
|
|
10663
10663
|
const out = this._createLike([], options);
|
|
10664
10664
|
let index = 0;
|
|
10665
10665
|
for (const [key, value] of this) {
|
|
10666
|
-
out.add(callback.call(thisArg,
|
|
10666
|
+
out.add(callback.call(thisArg, value, key, index++, this));
|
|
10667
10667
|
}
|
|
10668
10668
|
return out;
|
|
10669
10669
|
}
|
|
@@ -11175,7 +11175,7 @@ var AVLTreeMultiMap = class extends AVLTree {
|
|
|
11175
11175
|
map(callback, options, thisArg) {
|
|
11176
11176
|
const out = this._createLike([], options);
|
|
11177
11177
|
let i = 0;
|
|
11178
|
-
for (const [k, v] of this) out.add(callback.call(thisArg,
|
|
11178
|
+
for (const [k, v] of this) out.add(callback.call(thisArg, v, k, i++, this));
|
|
11179
11179
|
return out;
|
|
11180
11180
|
}
|
|
11181
11181
|
/**
|
|
@@ -11454,7 +11454,7 @@ var TreeMultiMap = class extends RedBlackTree {
|
|
|
11454
11454
|
map(callback, options, thisArg) {
|
|
11455
11455
|
const out = this._createLike([], options);
|
|
11456
11456
|
let i = 0;
|
|
11457
|
-
for (const [k, v] of this) out.add(callback.call(thisArg,
|
|
11457
|
+
for (const [k, v] of this) out.add(callback.call(thisArg, v, k, i++, this));
|
|
11458
11458
|
return out;
|
|
11459
11459
|
}
|
|
11460
11460
|
/**
|
|
@@ -11835,7 +11835,7 @@ var TreeCounter = class extends RedBlackTree {
|
|
|
11835
11835
|
const out = this._createLike([], options);
|
|
11836
11836
|
let index = 0;
|
|
11837
11837
|
for (const [key, value] of this) {
|
|
11838
|
-
out.add(callback.call(thisArg,
|
|
11838
|
+
out.add(callback.call(thisArg, value, key, index++, this));
|
|
11839
11839
|
}
|
|
11840
11840
|
return out;
|
|
11841
11841
|
}
|
|
@@ -12260,7 +12260,7 @@ var AVLTreeCounter = class extends AVLTree {
|
|
|
12260
12260
|
const out = this._createLike([], options);
|
|
12261
12261
|
let index = 0;
|
|
12262
12262
|
for (const [key, value] of this) {
|
|
12263
|
-
out.add(callback.call(thisArg,
|
|
12263
|
+
out.add(callback.call(thisArg, value, key, index++, this));
|
|
12264
12264
|
}
|
|
12265
12265
|
return out;
|
|
12266
12266
|
}
|