@blackglory/structures 0.6.8 → 0.6.9
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 +4 -4
- package/dist/es2015/index.mjs.map +1 -1
- package/dist/es2015/index.umd.js +4 -4
- 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 +4 -4
- package/dist/es2018/index.mjs.map +1 -1
- package/dist/es2018/index.umd.js +4 -4
- 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 +2 -4
- package/lib/es2015/sparse-set.js.map +1 -1
- package/lib/es2018/sparse-set.js +2 -4
- package/lib/es2018/sparse-set.js.map +1 -1
- package/package.json +1 -1
package/dist/es2018/index.mjs
CHANGED
|
@@ -9655,10 +9655,8 @@ class SparseSet {
|
|
|
9655
9655
|
}
|
|
9656
9656
|
}
|
|
9657
9657
|
has(value) {
|
|
9658
|
-
|
|
9659
|
-
return es2018$e.
|
|
9660
|
-
? false
|
|
9661
|
-
: this.values[index] === value;
|
|
9658
|
+
// 跟一般的实现不同, 不需要访问values数组.
|
|
9659
|
+
return es2018$e.isntUndefined(this.valueToValueIndex[value]);
|
|
9662
9660
|
}
|
|
9663
9661
|
add(value) {
|
|
9664
9662
|
if (!this.has(value)) {
|
|
@@ -9674,6 +9672,8 @@ class SparseSet {
|
|
|
9674
9672
|
const indexOfValue = this.valueToValueIndex[value];
|
|
9675
9673
|
this.values[indexOfValue] = lastValue;
|
|
9676
9674
|
this.valueToValueIndex[lastValue] = indexOfValue;
|
|
9675
|
+
// 跟一般的实现不同, 直接删除值的索引.
|
|
9676
|
+
this.valueToValueIndex[value] = undefined;
|
|
9677
9677
|
}
|
|
9678
9678
|
}
|
|
9679
9679
|
}
|