@blackglory/structures 0.10.10 → 0.10.13

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.
@@ -16484,6 +16484,9 @@ class SparseMap {
16484
16484
  get size() {
16485
16485
  return this.indexToKey.length;
16486
16486
  }
16487
+ get internalArray() {
16488
+ return this.indexToValue;
16489
+ }
16487
16490
  *entries() {
16488
16491
  for (let i = 0; i < this.indexToKey.length; i++) {
16489
16492
  yield [this.indexToKey[i], this.indexToValue[i]];
@@ -16495,6 +16498,9 @@ class SparseMap {
16495
16498
  values() {
16496
16499
  return this.indexToValue.values();
16497
16500
  }
16501
+ getInternalIndexOfKey(key) {
16502
+ return this.keyToIndex[key];
16503
+ }
16498
16504
  has(key) {
16499
16505
  // 跟一般的稀疏集实现不同, 不需要访问values数组.
16500
16506
  return key in this.keyToIndex;
@@ -16531,7 +16537,7 @@ class SparseMap {
16531
16537
  const index = this.keyToIndex[key];
16532
16538
  this.indexToKey[index] = lastKey;
16533
16539
  this.indexToValue[index] = lastValue;
16534
- this.keyToIndex[key] = index;
16540
+ this.keyToIndex[lastKey] = index;
16535
16541
  delete this.keyToIndex[key];
16536
16542
  }
16537
16543
  }
@@ -16551,6 +16557,9 @@ class TypedSparseMap {
16551
16557
  get size() {
16552
16558
  return this.indexToKey.length;
16553
16559
  }
16560
+ get internalTypedArray() {
16561
+ return this.indexToValue.internalTypedArray;
16562
+ }
16554
16563
  *entries() {
16555
16564
  for (let i = 0; i < this.indexToKey.length; i++) {
16556
16565
  yield [
@@ -16567,6 +16576,9 @@ class TypedSparseMap {
16567
16576
  yield this.indexToValue.internalTypedArray[i];
16568
16577
  }
16569
16578
  }
16579
+ getInternalIndexOfKey(key) {
16580
+ return this.keyToIndex[key];
16581
+ }
16570
16582
  has(key) {
16571
16583
  const index = this.keyToIndex[key];
16572
16584
  return this.indexToKey[index] === key;