@blackglory/structures 0.10.9 → 0.10.12

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.
@@ -16481,6 +16481,12 @@ class SparseMap {
16481
16481
  get [Symbol.toStringTag]() {
16482
16482
  return this.constructor.name;
16483
16483
  }
16484
+ get size() {
16485
+ return this.indexToKey.length;
16486
+ }
16487
+ get internalArray() {
16488
+ return this.indexToValue;
16489
+ }
16484
16490
  *entries() {
16485
16491
  for (let i = 0; i < this.indexToKey.length; i++) {
16486
16492
  yield [this.indexToKey[i], this.indexToValue[i]];
@@ -16492,6 +16498,9 @@ class SparseMap {
16492
16498
  values() {
16493
16499
  return this.indexToValue.values();
16494
16500
  }
16501
+ getInternalIndexOfKey(key) {
16502
+ return this.keyToIndex[key];
16503
+ }
16495
16504
  has(key) {
16496
16505
  // 跟一般的稀疏集实现不同, 不需要访问values数组.
16497
16506
  return key in this.keyToIndex;
@@ -16545,6 +16554,12 @@ class TypedSparseMap {
16545
16554
  get [Symbol.toStringTag]() {
16546
16555
  return this.constructor.name;
16547
16556
  }
16557
+ get size() {
16558
+ return this.indexToKey.length;
16559
+ }
16560
+ get internalTypedArray() {
16561
+ return this.indexToValue.internalTypedArray;
16562
+ }
16548
16563
  *entries() {
16549
16564
  for (let i = 0; i < this.indexToKey.length; i++) {
16550
16565
  yield [
@@ -16561,6 +16576,9 @@ class TypedSparseMap {
16561
16576
  yield this.indexToValue.internalTypedArray[i];
16562
16577
  }
16563
16578
  }
16579
+ getInternalIndexOfKey(key) {
16580
+ return this.keyToIndex[key];
16581
+ }
16564
16582
  has(key) {
16565
16583
  const index = this.keyToIndex[key];
16566
16584
  return this.indexToKey[index] === key;