data-structure-typed 2.2.0 → 2.2.1
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 +1 -1
- package/README.md +66 -21
- 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
|
@@ -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[
|
|
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[
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
12237
|
+
out.add(callback.call(thisArg, value, key, index++, this));
|
|
12238
12238
|
}
|
|
12239
12239
|
return out;
|
|
12240
12240
|
}
|