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
|
@@ -55,7 +55,7 @@ var _IterableEntryBase = class _IterableEntryBase {
|
|
|
55
55
|
every(predicate, thisArg) {
|
|
56
56
|
let index = 0;
|
|
57
57
|
for (const item of this) {
|
|
58
|
-
if (!predicate.call(thisArg, item[
|
|
58
|
+
if (!predicate.call(thisArg, item[1], item[0], index++, this)) {
|
|
59
59
|
return false;
|
|
60
60
|
}
|
|
61
61
|
}
|
|
@@ -71,7 +71,7 @@ var _IterableEntryBase = class _IterableEntryBase {
|
|
|
71
71
|
some(predicate, thisArg) {
|
|
72
72
|
let index = 0;
|
|
73
73
|
for (const item of this) {
|
|
74
|
-
if (predicate.call(thisArg, item[
|
|
74
|
+
if (predicate.call(thisArg, item[1], item[0], index++, this)) {
|
|
75
75
|
return true;
|
|
76
76
|
}
|
|
77
77
|
}
|
|
@@ -87,7 +87,7 @@ var _IterableEntryBase = class _IterableEntryBase {
|
|
|
87
87
|
let index = 0;
|
|
88
88
|
for (const item of this) {
|
|
89
89
|
const [key, value] = item;
|
|
90
|
-
callbackfn.call(thisArg,
|
|
90
|
+
callbackfn.call(thisArg, value, key, index++, this);
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
/**
|
|
@@ -101,7 +101,7 @@ var _IterableEntryBase = class _IterableEntryBase {
|
|
|
101
101
|
let index = 0;
|
|
102
102
|
for (const item of this) {
|
|
103
103
|
const [key, value] = item;
|
|
104
|
-
if (callbackfn.call(thisArg,
|
|
104
|
+
if (callbackfn.call(thisArg, value, key, index++, this)) return item;
|
|
105
105
|
}
|
|
106
106
|
return;
|
|
107
107
|
}
|
|
@@ -715,7 +715,7 @@ var _HashMap = class _HashMap 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 _HashMap 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
|
/**
|
|
@@ -1052,7 +1052,7 @@ var _LinkedHashMap = class _LinkedHashMap extends IterableEntryBase {
|
|
|
1052
1052
|
const out = this._createLike();
|
|
1053
1053
|
let index = 0;
|
|
1054
1054
|
for (const [key, value] of this) {
|
|
1055
|
-
if (predicate.call(thisArg,
|
|
1055
|
+
if (predicate.call(thisArg, value, key, index, this)) out.set(key, value);
|
|
1056
1056
|
index++;
|
|
1057
1057
|
}
|
|
1058
1058
|
return out;
|
|
@@ -1070,7 +1070,7 @@ var _LinkedHashMap = class _LinkedHashMap extends IterableEntryBase {
|
|
|
1070
1070
|
const out = this._createLike();
|
|
1071
1071
|
let index = 0;
|
|
1072
1072
|
for (const [key, value] of this) {
|
|
1073
|
-
const [newKey, newValue] = callback.call(thisArg,
|
|
1073
|
+
const [newKey, newValue] = callback.call(thisArg, value, key, index, this);
|
|
1074
1074
|
out.set(newKey, newValue);
|
|
1075
1075
|
index++;
|
|
1076
1076
|
}
|
|
@@ -5679,7 +5679,7 @@ var _AbstractGraph = class _AbstractGraph extends IterableEntryBase {
|
|
|
5679
5679
|
const filtered = [];
|
|
5680
5680
|
let index = 0;
|
|
5681
5681
|
for (const [key, value] of this) {
|
|
5682
|
-
if (predicate.call(thisArg,
|
|
5682
|
+
if (predicate.call(thisArg, value, key, index, this)) {
|
|
5683
5683
|
filtered.push([key, value]);
|
|
5684
5684
|
}
|
|
5685
5685
|
index++;
|
|
@@ -5694,7 +5694,7 @@ var _AbstractGraph = class _AbstractGraph extends IterableEntryBase {
|
|
|
5694
5694
|
const filtered = [];
|
|
5695
5695
|
let index = 0;
|
|
5696
5696
|
for (const [key, value] of this) {
|
|
5697
|
-
if (predicate.call(thisArg,
|
|
5697
|
+
if (predicate.call(thisArg, value, key, index, this)) {
|
|
5698
5698
|
filtered.push([key, value]);
|
|
5699
5699
|
}
|
|
5700
5700
|
index++;
|
|
@@ -5705,7 +5705,7 @@ var _AbstractGraph = class _AbstractGraph extends IterableEntryBase {
|
|
|
5705
5705
|
const mapped = [];
|
|
5706
5706
|
let index = 0;
|
|
5707
5707
|
for (const [key, value] of this) {
|
|
5708
|
-
mapped.push(callback.call(thisArg,
|
|
5708
|
+
mapped.push(callback.call(thisArg, value, key, index, this));
|
|
5709
5709
|
index++;
|
|
5710
5710
|
}
|
|
5711
5711
|
return mapped;
|
|
@@ -7982,7 +7982,7 @@ var _BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
7982
7982
|
filter(predicate, thisArg) {
|
|
7983
7983
|
const out = this._createInstance();
|
|
7984
7984
|
let i = 0;
|
|
7985
|
-
for (const [k, v] of this) if (predicate.call(thisArg,
|
|
7985
|
+
for (const [k, v] of this) if (predicate.call(thisArg, v, k, i++, this)) out.add([k, v]);
|
|
7986
7986
|
return out;
|
|
7987
7987
|
}
|
|
7988
7988
|
/**
|
|
@@ -8000,7 +8000,7 @@ var _BinaryTree = class _BinaryTree extends IterableEntryBase {
|
|
|
8000
8000
|
map(cb, options, thisArg) {
|
|
8001
8001
|
const out = this._createLike([], options);
|
|
8002
8002
|
let i = 0;
|
|
8003
|
-
for (const [k, v] of this) out.add(cb.call(thisArg,
|
|
8003
|
+
for (const [k, v] of this) out.add(cb.call(thisArg, v, k, i++, this));
|
|
8004
8004
|
return out;
|
|
8005
8005
|
}
|
|
8006
8006
|
/**
|
|
@@ -9100,7 +9100,7 @@ var _BST = class _BST extends BinaryTree {
|
|
|
9100
9100
|
const out = this._createLike([], options);
|
|
9101
9101
|
let index = 0;
|
|
9102
9102
|
for (const [key, value] of this) {
|
|
9103
|
-
out.add(callback.call(thisArg,
|
|
9103
|
+
out.add(callback.call(thisArg, value, key, index++, this));
|
|
9104
9104
|
}
|
|
9105
9105
|
return out;
|
|
9106
9106
|
}
|
|
@@ -10073,7 +10073,7 @@ var _AVLTree = class _AVLTree extends BST {
|
|
|
10073
10073
|
const out = this._createLike([], options);
|
|
10074
10074
|
let index = 0;
|
|
10075
10075
|
for (const [key, value] of this) {
|
|
10076
|
-
out.add(callback.call(thisArg,
|
|
10076
|
+
out.add(callback.call(thisArg, value, key, index++, this));
|
|
10077
10077
|
}
|
|
10078
10078
|
return out;
|
|
10079
10079
|
}
|
|
@@ -10639,7 +10639,7 @@ var _RedBlackTree = class _RedBlackTree extends BST {
|
|
|
10639
10639
|
const out = this._createLike([], options);
|
|
10640
10640
|
let index = 0;
|
|
10641
10641
|
for (const [key, value] of this) {
|
|
10642
|
-
out.add(callback.call(thisArg,
|
|
10642
|
+
out.add(callback.call(thisArg, value, key, index++, this));
|
|
10643
10643
|
}
|
|
10644
10644
|
return out;
|
|
10645
10645
|
}
|
|
@@ -11152,7 +11152,7 @@ var _AVLTreeMultiMap = class _AVLTreeMultiMap extends AVLTree {
|
|
|
11152
11152
|
map(callback, options, thisArg) {
|
|
11153
11153
|
const out = this._createLike([], options);
|
|
11154
11154
|
let i = 0;
|
|
11155
|
-
for (const [k, v] of this) out.add(callback.call(thisArg,
|
|
11155
|
+
for (const [k, v] of this) out.add(callback.call(thisArg, v, k, i++, this));
|
|
11156
11156
|
return out;
|
|
11157
11157
|
}
|
|
11158
11158
|
/**
|
|
@@ -11431,7 +11431,7 @@ var _TreeMultiMap = class _TreeMultiMap extends RedBlackTree {
|
|
|
11431
11431
|
map(callback, options, thisArg) {
|
|
11432
11432
|
const out = this._createLike([], options);
|
|
11433
11433
|
let i = 0;
|
|
11434
|
-
for (const [k, v] of this) out.add(callback.call(thisArg,
|
|
11434
|
+
for (const [k, v] of this) out.add(callback.call(thisArg, v, k, i++, this));
|
|
11435
11435
|
return out;
|
|
11436
11436
|
}
|
|
11437
11437
|
/**
|
|
@@ -11812,7 +11812,7 @@ var _TreeCounter = class _TreeCounter extends RedBlackTree {
|
|
|
11812
11812
|
const out = this._createLike([], options);
|
|
11813
11813
|
let index = 0;
|
|
11814
11814
|
for (const [key, value] of this) {
|
|
11815
|
-
out.add(callback.call(thisArg,
|
|
11815
|
+
out.add(callback.call(thisArg, value, key, index++, this));
|
|
11816
11816
|
}
|
|
11817
11817
|
return out;
|
|
11818
11818
|
}
|
|
@@ -12236,7 +12236,7 @@ var _AVLTreeCounter = class _AVLTreeCounter extends AVLTree {
|
|
|
12236
12236
|
const out = this._createLike([], options);
|
|
12237
12237
|
let index = 0;
|
|
12238
12238
|
for (const [key, value] of this) {
|
|
12239
|
-
out.add(callback.call(thisArg,
|
|
12239
|
+
out.add(callback.call(thisArg, value, key, index++, this));
|
|
12240
12240
|
}
|
|
12241
12241
|
return out;
|
|
12242
12242
|
}
|