@blackglory/structures 0.6.9 → 0.6.10
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/dist/es2015/index.min.mjs +1 -1
- package/dist/es2015/index.min.mjs.map +1 -1
- package/dist/es2015/index.mjs +6 -5
- package/dist/es2015/index.mjs.map +1 -1
- package/dist/es2015/index.umd.js +6 -5
- package/dist/es2015/index.umd.js.map +1 -1
- package/dist/es2015/index.umd.min.js +1 -1
- package/dist/es2015/index.umd.min.js.map +1 -1
- package/dist/es2018/index.min.mjs +1 -1
- package/dist/es2018/index.min.mjs.map +1 -1
- package/dist/es2018/index.mjs +6 -5
- package/dist/es2018/index.mjs.map +1 -1
- package/dist/es2018/index.umd.js +6 -5
- package/dist/es2018/index.umd.js.map +1 -1
- package/dist/es2018/index.umd.min.js +1 -1
- package/dist/es2018/index.umd.min.js.map +1 -1
- package/lib/es2015/sparse-set.js +6 -5
- package/lib/es2015/sparse-set.js.map +1 -1
- package/lib/es2018/sparse-set.js +6 -5
- package/lib/es2018/sparse-set.js.map +1 -1
- package/package.json +1 -1
package/dist/es2018/index.mjs
CHANGED
|
@@ -9649,10 +9649,8 @@ class SparseSet {
|
|
|
9649
9649
|
get [Symbol.toStringTag]() {
|
|
9650
9650
|
return this.constructor.name;
|
|
9651
9651
|
}
|
|
9652
|
-
|
|
9653
|
-
|
|
9654
|
-
yield value;
|
|
9655
|
-
}
|
|
9652
|
+
[Symbol.iterator]() {
|
|
9653
|
+
return this.values[Symbol.iterator]();
|
|
9656
9654
|
}
|
|
9657
9655
|
has(value) {
|
|
9658
9656
|
// 跟一般的实现不同, 不需要访问values数组.
|
|
@@ -9668,7 +9666,10 @@ class SparseSet {
|
|
|
9668
9666
|
remove(value) {
|
|
9669
9667
|
if (this.has(value)) {
|
|
9670
9668
|
const lastValue = this.values.pop();
|
|
9671
|
-
if (value
|
|
9669
|
+
if (value === lastValue) {
|
|
9670
|
+
this.valueToValueIndex[value] = undefined;
|
|
9671
|
+
}
|
|
9672
|
+
else {
|
|
9672
9673
|
const indexOfValue = this.valueToValueIndex[value];
|
|
9673
9674
|
this.values[indexOfValue] = lastValue;
|
|
9674
9675
|
this.valueToValueIndex[lastValue] = indexOfValue;
|