@blackglory/structures 0.6.7 → 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.
@@ -9655,10 +9655,8 @@
9655
9655
  get [Symbol.toStringTag]() {
9656
9656
  return this.constructor.name;
9657
9657
  }
9658
- *[Symbol.iterator]() {
9659
- for (const value of this.values) {
9660
- yield value;
9661
- }
9658
+ [Symbol.iterator]() {
9659
+ return this.values[Symbol.iterator]();
9662
9660
  }
9663
9661
  has(value) {
9664
9662
  // 跟一般的实现不同, 不需要访问values数组.
@@ -9674,7 +9672,10 @@
9674
9672
  remove(value) {
9675
9673
  if (this.has(value)) {
9676
9674
  const lastValue = this.values.pop();
9677
- if (value !== lastValue) {
9675
+ if (value === lastValue) {
9676
+ this.valueToValueIndex[value] = undefined;
9677
+ }
9678
+ else {
9678
9679
  const indexOfValue = this.valueToValueIndex[value];
9679
9680
  this.values[indexOfValue] = lastValue;
9680
9681
  this.valueToValueIndex[lastValue] = indexOfValue;