serializable-bptree 4.0.1 → 4.0.3

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.
@@ -61,371 +61,6 @@ var StringComparator = class extends ValueComparator {
61
61
  }
62
62
  };
63
63
 
64
- // node_modules/cachebranch/dist/esm/index.mjs
65
- var CacheBranch = class {
66
- data;
67
- branches;
68
- constructor(data) {
69
- this.data = data;
70
- this.branches = /* @__PURE__ */ new Map();
71
- }
72
- /**
73
- * The method splits the provided key value into tokens and returns them as an array.
74
- * For instance, if you pass `'user/name/middle'` as the parameter, it will return `['user', 'name', 'middle']` as the split values.
75
- * @param key The key value to split.
76
- */
77
- tokens(key) {
78
- return key.split("/");
79
- }
80
- to(key, getNextBranch) {
81
- const tokens = this.tokens(key);
82
- let current = this;
83
- for (let i = 0, len = tokens.length; i < len; i++) {
84
- const last = i === len - 1;
85
- const key2 = tokens[i];
86
- const next = getNextBranch(current, key2, i, last);
87
- if (next === null) {
88
- return void 0;
89
- }
90
- current = next;
91
- }
92
- return current;
93
- }
94
- };
95
- var VOID = -1;
96
- var PRIMITIVE = 0;
97
- var ARRAY = 1;
98
- var OBJECT = 2;
99
- var DATE = 3;
100
- var REGEXP = 4;
101
- var MAP = 5;
102
- var SET = 6;
103
- var ERROR = 7;
104
- var BIGINT = 8;
105
- var env = typeof self === "object" ? self : globalThis;
106
- var deserializer = ($, _) => {
107
- const as = (out, index) => {
108
- $.set(index, out);
109
- return out;
110
- };
111
- const unpair = (index) => {
112
- if ($.has(index))
113
- return $.get(index);
114
- const [type, value] = _[index];
115
- switch (type) {
116
- case PRIMITIVE:
117
- case VOID:
118
- return as(value, index);
119
- case ARRAY: {
120
- const arr = as([], index);
121
- for (const index2 of value)
122
- arr.push(unpair(index2));
123
- return arr;
124
- }
125
- case OBJECT: {
126
- const object = as({}, index);
127
- for (const [key, index2] of value)
128
- object[unpair(key)] = unpair(index2);
129
- return object;
130
- }
131
- case DATE:
132
- return as(new Date(value), index);
133
- case REGEXP: {
134
- const { source, flags } = value;
135
- return as(new RegExp(source, flags), index);
136
- }
137
- case MAP: {
138
- const map = as(/* @__PURE__ */ new Map(), index);
139
- for (const [key, index2] of value)
140
- map.set(unpair(key), unpair(index2));
141
- return map;
142
- }
143
- case SET: {
144
- const set = as(/* @__PURE__ */ new Set(), index);
145
- for (const index2 of value)
146
- set.add(unpair(index2));
147
- return set;
148
- }
149
- case ERROR: {
150
- const { name, message } = value;
151
- return as(new env[name](message), index);
152
- }
153
- case BIGINT:
154
- return as(BigInt(value), index);
155
- case "BigInt":
156
- return as(Object(BigInt(value)), index);
157
- }
158
- return as(new env[type](value), index);
159
- };
160
- return unpair;
161
- };
162
- var deserialize = (serialized) => deserializer(/* @__PURE__ */ new Map(), serialized)(0);
163
- var EMPTY = "";
164
- var { toString } = {};
165
- var { keys } = Object;
166
- var typeOf = (value) => {
167
- const type = typeof value;
168
- if (type !== "object" || !value)
169
- return [PRIMITIVE, type];
170
- const asString = toString.call(value).slice(8, -1);
171
- switch (asString) {
172
- case "Array":
173
- return [ARRAY, EMPTY];
174
- case "Object":
175
- return [OBJECT, EMPTY];
176
- case "Date":
177
- return [DATE, EMPTY];
178
- case "RegExp":
179
- return [REGEXP, EMPTY];
180
- case "Map":
181
- return [MAP, EMPTY];
182
- case "Set":
183
- return [SET, EMPTY];
184
- }
185
- if (asString.includes("Array"))
186
- return [ARRAY, asString];
187
- if (asString.includes("Error"))
188
- return [ERROR, asString];
189
- return [OBJECT, asString];
190
- };
191
- var shouldSkip = ([TYPE, type]) => TYPE === PRIMITIVE && (type === "function" || type === "symbol");
192
- var serializer = (strict, json, $, _) => {
193
- const as = (out, value) => {
194
- const index = _.push(out) - 1;
195
- $.set(value, index);
196
- return index;
197
- };
198
- const pair = (value) => {
199
- if ($.has(value))
200
- return $.get(value);
201
- let [TYPE, type] = typeOf(value);
202
- switch (TYPE) {
203
- case PRIMITIVE: {
204
- let entry = value;
205
- switch (type) {
206
- case "bigint":
207
- TYPE = BIGINT;
208
- entry = value.toString();
209
- break;
210
- case "function":
211
- case "symbol":
212
- if (strict)
213
- throw new TypeError("unable to serialize " + type);
214
- entry = null;
215
- break;
216
- case "undefined":
217
- return as([VOID], value);
218
- }
219
- return as([TYPE, entry], value);
220
- }
221
- case ARRAY: {
222
- if (type)
223
- return as([type, [...value]], value);
224
- const arr = [];
225
- const index = as([TYPE, arr], value);
226
- for (const entry of value)
227
- arr.push(pair(entry));
228
- return index;
229
- }
230
- case OBJECT: {
231
- if (type) {
232
- switch (type) {
233
- case "BigInt":
234
- return as([type, value.toString()], value);
235
- case "Boolean":
236
- case "Number":
237
- case "String":
238
- return as([type, value.valueOf()], value);
239
- }
240
- }
241
- if (json && "toJSON" in value)
242
- return pair(value.toJSON());
243
- const entries = [];
244
- const index = as([TYPE, entries], value);
245
- for (const key of keys(value)) {
246
- if (strict || !shouldSkip(typeOf(value[key])))
247
- entries.push([pair(key), pair(value[key])]);
248
- }
249
- return index;
250
- }
251
- case DATE:
252
- return as([TYPE, value.toISOString()], value);
253
- case REGEXP: {
254
- const { source, flags } = value;
255
- return as([TYPE, { source, flags }], value);
256
- }
257
- case MAP: {
258
- const entries = [];
259
- const index = as([TYPE, entries], value);
260
- for (const [key, entry] of value) {
261
- if (strict || !(shouldSkip(typeOf(key)) || shouldSkip(typeOf(entry))))
262
- entries.push([pair(key), pair(entry)]);
263
- }
264
- return index;
265
- }
266
- case SET: {
267
- const entries = [];
268
- const index = as([TYPE, entries], value);
269
- for (const entry of value) {
270
- if (strict || !shouldSkip(typeOf(entry)))
271
- entries.push(pair(entry));
272
- }
273
- return index;
274
- }
275
- }
276
- const { message } = value;
277
- return as([TYPE, { name: type, message }], value);
278
- };
279
- return pair;
280
- };
281
- var serialize = (value, { json, lossy } = {}) => {
282
- const _ = [];
283
- return serializer(!(json || lossy), !!json, /* @__PURE__ */ new Map(), _)(value), _;
284
- };
285
- var esm_default = typeof structuredClone === "function" ? (
286
- /* c8 ignore start */
287
- (any, options) => options && ("json" in options || "lossy" in options) ? deserialize(serialize(any, options)) : structuredClone(any)
288
- ) : (any, options) => deserialize(serialize(any, options));
289
- var CacheData = class _CacheData {
290
- static IsDirty(data) {
291
- return data.dirty;
292
- }
293
- static SetDirty(data, value) {
294
- data.dirty = value;
295
- return data;
296
- }
297
- static StructuredClone = globalThis.structuredClone ?? esm_default;
298
- _raw;
299
- generator;
300
- dirty;
301
- constructor(generator) {
302
- this._raw = void 0;
303
- this.dirty = false;
304
- this.generator = generator;
305
- }
306
- /**
307
- * This is cached data.
308
- * It was generated at the time of caching, so there is a risk of modification if it's an object due to shallow copying.
309
- * Therefore, if it's not a primitive type, please avoid using this value directly and use the `clone` method to use a copied version of the data.
310
- */
311
- get raw() {
312
- if (!this.dirty) {
313
- throw new Error(`The data is not initialized and cannot be accessed. Please use the 'ensure' or 'set' method to create the data first.`);
314
- }
315
- return this._raw;
316
- }
317
- /**
318
- * The method returns a copied value of the cached data.
319
- * You can pass a function as a parameter to copy the value. This parameter function should return the copied value.
320
- *
321
- * If no parameter is passed, it defaults to using Javascript's or \@ungap/structured-clone's `structuredClone` function to copy the value.
322
- * If you prefer shallow copying instead of deep copying,
323
- * you can use the default options `array-shallow-copy`, `object-shallow-copy` and `deep-copy`,
324
- * which are replaced with functions to shallow copy arrays and objects, respectively. This is a syntactic sugar.
325
- * @param strategy The function that returns the copied value.
326
- * If you want to perform a shallow copy, simply pass the strings `array-shallow-copy` or `object-shallow-copy` for easy use.
327
- * The default is `structuredClone`.
328
- */
329
- clone(strategy = "deep-copy") {
330
- if (strategy && typeof strategy !== "string") {
331
- return strategy(this.raw);
332
- }
333
- switch (strategy) {
334
- case "array-shallow-copy":
335
- return [].concat(this.raw);
336
- case "object-shallow-copy":
337
- return Object.assign({}, this.raw);
338
- case "deep-copy":
339
- default:
340
- return _CacheData.StructuredClone(this.raw);
341
- }
342
- }
343
- };
344
- var CacheDataSync = class extends CacheData {
345
- static EmptyDataGenerator = () => void 0;
346
- static Update(branch, data, generator) {
347
- data._raw = generator(branch);
348
- data.generator = generator;
349
- data.dirty = true;
350
- return data;
351
- }
352
- static Cache(branch, data) {
353
- data._raw = data.generator(branch);
354
- return data;
355
- }
356
- };
357
- var CacheBranchSync = class _CacheBranchSync extends CacheBranch {
358
- root;
359
- constructor(generator = CacheDataSync.EmptyDataGenerator, root) {
360
- super(new CacheDataSync(generator));
361
- this.root = root ?? this;
362
- }
363
- ensureBranch(key, generator) {
364
- return this.to(key, (b, k) => {
365
- const branch = b;
366
- if (!branch.branches.has(k)) {
367
- branch.branches.set(k, new _CacheBranchSync(generator, this.root));
368
- }
369
- return branch.branches.get(k);
370
- });
371
- }
372
- getBranch(key) {
373
- return this.to(key, (b, k) => {
374
- const branch = b;
375
- if (!branch.branches.has(k)) {
376
- return null;
377
- }
378
- return branch.branches.get(k);
379
- });
380
- }
381
- cache(key, recursive) {
382
- const branch = this.ensureBranch(key, CacheDataSync.EmptyDataGenerator);
383
- if (!branch) {
384
- return this;
385
- }
386
- if (recursive === "bottom-up") {
387
- for (const key2 of branch.branches.keys()) {
388
- branch.cache(key2, recursive);
389
- }
390
- }
391
- CacheDataSync.Cache(this.root, branch.data);
392
- if (recursive === "top-down") {
393
- for (const key2 of branch.branches.keys()) {
394
- branch.cache(key2, recursive);
395
- }
396
- }
397
- return this;
398
- }
399
- ensure(key, generator) {
400
- const branch = this.ensureBranch(key, CacheDataSync.EmptyDataGenerator);
401
- if (!CacheDataSync.IsDirty(branch.data)) {
402
- CacheDataSync.Update(this.root, branch.data, generator);
403
- }
404
- return branch.data;
405
- }
406
- get(key) {
407
- const branch = this.ensureBranch(key, CacheDataSync.EmptyDataGenerator);
408
- if (!CacheDataSync.IsDirty(branch.data)) {
409
- return void 0;
410
- }
411
- return branch.data;
412
- }
413
- set(key, generator) {
414
- const branch = this.ensureBranch(key, CacheDataSync.EmptyDataGenerator);
415
- CacheDataSync.Update(this.root, branch.data, generator);
416
- return this;
417
- }
418
- delete(key) {
419
- const branch = this.ensureBranch(key, CacheDataSync.EmptyDataGenerator);
420
- if (branch) {
421
- branch.branches.clear();
422
- CacheDataSync.Update(this.root, branch.data, CacheDataSync.EmptyDataGenerator);
423
- CacheDataSync.SetDirty(branch.data, false);
424
- }
425
- return this;
426
- }
427
- };
428
-
429
64
  // src/utils/InvertedWeakMap.ts
430
65
  var InvertedWeakMap = class {
431
66
  _map;
@@ -480,10 +115,12 @@ var BPTree = class {
480
115
  like: (nv, v) => {
481
116
  const nodeValue = this.comparator.match(nv);
482
117
  const value = this.comparator.match(v);
483
- const regexp = this._cachedRegexp.ensure(value, () => {
118
+ if (!this._cachedRegexp.has(value)) {
484
119
  const pattern = value.replace(/%/g, ".*").replace(/_/g, ".");
485
- return new RegExp(`^${pattern}$`, "i");
486
- }).raw;
120
+ const regexp2 = new RegExp(`^${pattern}$`, "i");
121
+ this._cachedRegexp.set(value, regexp2);
122
+ }
123
+ const regexp = this._cachedRegexp.get(value);
487
124
  return regexp.test(nodeValue);
488
125
  }
489
126
  };
@@ -515,7 +152,7 @@ var BPTree = class {
515
152
  like: true
516
153
  };
517
154
  constructor(strategy, comparator) {
518
- this._cachedRegexp = new CacheBranchSync();
155
+ this._cachedRegexp = new InvertedWeakMap();
519
156
  this._nodeCreateBuffer = /* @__PURE__ */ new Map();
520
157
  this._nodeUpdateBuffer = /* @__PURE__ */ new Map();
521
158
  this._nodeDeleteBuffer = /* @__PURE__ */ new Map();
@@ -528,8 +165,8 @@ var BPTree = class {
528
165
  for (let i = 0, len = node.values.length; i < len; i++) {
529
166
  const nValue = node.values[i];
530
167
  if (this.comparator.isSame(value, nValue)) {
531
- const keys2 = node.keys[i];
532
- keys2.push(key);
168
+ const keys = node.keys[i];
169
+ keys.push(key);
533
170
  this.bufferForNodeUpdate(node);
534
171
  break;
535
172
  } else if (this.comparator.isLower(value, nValue)) {
@@ -583,12 +220,12 @@ var BPTreeSync = class extends BPTree {
583
220
  let i = node.values.length;
584
221
  while (i--) {
585
222
  const nValue = node.values[i];
586
- const keys2 = node.keys[i];
223
+ const keys = node.keys[i];
587
224
  if (comparator(nValue, value)) {
588
225
  found = true;
589
- let j = keys2.length;
226
+ let j = keys.length;
590
227
  while (j--) {
591
- pairs.push({ key: keys2[j], value: nValue });
228
+ pairs.push({ key: keys[j], value: nValue });
592
229
  }
593
230
  } else if (found && !fullScan) {
594
231
  done = true;
@@ -611,10 +248,10 @@ var BPTreeSync = class extends BPTree {
611
248
  while (!done) {
612
249
  for (let i = 0, len = node.values.length; i < len; i++) {
613
250
  const nValue = node.values[i];
614
- const keys2 = node.keys[i];
251
+ const keys = node.keys[i];
615
252
  if (comparator(nValue, value)) {
616
253
  found = true;
617
- for (const key of keys2) {
254
+ for (const key of keys) {
618
255
  pairs.push({ key, value: nValue });
619
256
  }
620
257
  } else if (found && !fullScan) {
@@ -647,11 +284,11 @@ var BPTreeSync = class extends BPTree {
647
284
  }
648
285
  return id;
649
286
  }
650
- _createNode(isLeaf, keys2, values, leaf = false, parent = null, next = null, prev = null) {
287
+ _createNode(isLeaf, keys, values, leaf = false, parent = null, next = null, prev = null) {
651
288
  const id = this._createNodeId(isLeaf);
652
289
  const node = {
653
290
  id,
654
- keys: keys2,
291
+ keys,
655
292
  values,
656
293
  leaf,
657
294
  parent,
@@ -681,9 +318,9 @@ var BPTreeSync = class extends BPTree {
681
318
  }
682
319
  }
683
320
  if (this.root === node && node.keys.length === 1) {
684
- const keys2 = node.keys;
321
+ const keys = node.keys;
685
322
  this.bufferForNodeDelete(this.root);
686
- this.root = this.getNode(keys2[0]);
323
+ this.root = this.getNode(keys[0]);
687
324
  this.root.parent = null;
688
325
  this.strategy.head.root = this.root.id;
689
326
  this.bufferForNodeUpdate(this.root);
@@ -757,8 +394,8 @@ var BPTreeSync = class extends BPTree {
757
394
  }
758
395
  pointer.values.push(...node.values);
759
396
  if (!pointer.leaf) {
760
- const keys2 = pointer.keys;
761
- for (const key2 of keys2) {
397
+ const keys = pointer.keys;
398
+ for (const key2 of keys) {
762
399
  const node2 = this.getNode(key2);
763
400
  node2.parent = pointer.id;
764
401
  this.bufferForNodeUpdate(node2);
@@ -958,8 +595,8 @@ var BPTreeSync = class extends BPTree {
958
595
  leftestNode() {
959
596
  let node = this.root;
960
597
  while (!node.leaf) {
961
- const keys2 = node.keys;
962
- node = this.getNode(keys2[0]);
598
+ const keys = node.keys;
599
+ node = this.getNode(keys[0]);
963
600
  }
964
601
  return node;
965
602
  }
@@ -1070,17 +707,17 @@ var BPTreeSync = class extends BPTree {
1070
707
  while (i--) {
1071
708
  const nValue = node.values[i];
1072
709
  if (this.comparator.isSame(value, nValue)) {
1073
- const keys2 = node.keys[i];
1074
- if (keys2.includes(key)) {
1075
- if (keys2.length > 1) {
1076
- keys2.splice(keys2.indexOf(key), 1);
710
+ const keys = node.keys[i];
711
+ if (keys.includes(key)) {
712
+ if (keys.length > 1) {
713
+ keys.splice(keys.indexOf(key), 1);
1077
714
  this.bufferForNodeUpdate(node);
1078
715
  } else if (node === this.root) {
1079
716
  node.values.splice(i, 1);
1080
717
  node.keys.splice(i, 1);
1081
718
  this.bufferForNodeUpdate(node);
1082
719
  } else {
1083
- keys2.splice(keys2.indexOf(key), 1);
720
+ keys.splice(keys.indexOf(key), 1);
1084
721
  node.keys.splice(i, 1);
1085
722
  node.values.splice(node.values.indexOf(value), 1);
1086
723
  this._deleteEntry(node, key, value);
@@ -1099,8 +736,8 @@ var BPTreeSync = class extends BPTree {
1099
736
  for (let i = 0, len = node.values.length; i < len; i++) {
1100
737
  const nValue = node.values[i];
1101
738
  if (this.comparator.isSame(value, nValue)) {
1102
- const keys2 = node.keys[i];
1103
- return keys2.includes(key);
739
+ const keys = node.keys[i];
740
+ return keys.includes(key);
1104
741
  }
1105
742
  }
1106
743
  return false;
@@ -1110,13 +747,13 @@ var BPTreeSync = class extends BPTree {
1110
747
  this.commitHeadBuffer();
1111
748
  }
1112
749
  forceUpdate() {
1113
- const keys2 = [...this.nodes.keys()];
750
+ const keys = [...this.nodes.keys()];
1114
751
  this.nodes.clear();
1115
752
  this.init();
1116
- for (const key of keys2) {
753
+ for (const key of keys) {
1117
754
  this.getNode(key);
1118
755
  }
1119
- return keys2.length;
756
+ return keys.length;
1120
757
  }
1121
758
  };
1122
759
 
@@ -1134,12 +771,12 @@ var BPTreeAsync = class extends BPTree {
1134
771
  let i = node.values.length;
1135
772
  while (i--) {
1136
773
  const nValue = node.values[i];
1137
- const keys2 = node.keys[i];
774
+ const keys = node.keys[i];
1138
775
  if (comparator(nValue, value)) {
1139
776
  found = true;
1140
- let j = keys2.length;
777
+ let j = keys.length;
1141
778
  while (j--) {
1142
- pairs.push({ key: keys2[j], value: nValue });
779
+ pairs.push({ key: keys[j], value: nValue });
1143
780
  }
1144
781
  } else if (found && !fullScan) {
1145
782
  done = true;
@@ -1162,10 +799,10 @@ var BPTreeAsync = class extends BPTree {
1162
799
  while (!done) {
1163
800
  for (let i = 0, len = node.values.length; i < len; i++) {
1164
801
  const nValue = node.values[i];
1165
- const keys2 = node.keys[i];
802
+ const keys = node.keys[i];
1166
803
  if (comparator(nValue, value)) {
1167
804
  found = true;
1168
- for (const key of keys2) {
805
+ for (const key of keys) {
1169
806
  pairs.push({ key, value: nValue });
1170
807
  }
1171
808
  } else if (found && !fullScan) {
@@ -1198,11 +835,11 @@ var BPTreeAsync = class extends BPTree {
1198
835
  }
1199
836
  return id;
1200
837
  }
1201
- async _createNode(isLeaf, keys2, values, leaf = false, parent = null, next = null, prev = null) {
838
+ async _createNode(isLeaf, keys, values, leaf = false, parent = null, next = null, prev = null) {
1202
839
  const id = await this._createNodeId(isLeaf);
1203
840
  const node = {
1204
841
  id,
1205
- keys: keys2,
842
+ keys,
1206
843
  values,
1207
844
  leaf,
1208
845
  parent,
@@ -1232,9 +869,9 @@ var BPTreeAsync = class extends BPTree {
1232
869
  }
1233
870
  }
1234
871
  if (this.root === node && node.keys.length === 1) {
1235
- const keys2 = node.keys;
872
+ const keys = node.keys;
1236
873
  this.bufferForNodeDelete(this.root);
1237
- this.root = await this.getNode(keys2[0]);
874
+ this.root = await this.getNode(keys[0]);
1238
875
  this.root.parent = null;
1239
876
  this.strategy.head.root = this.root.id;
1240
877
  this.bufferForNodeUpdate(this.root);
@@ -1308,8 +945,8 @@ var BPTreeAsync = class extends BPTree {
1308
945
  }
1309
946
  pointer.values.push(...node.values);
1310
947
  if (!pointer.leaf) {
1311
- const keys2 = pointer.keys;
1312
- for (const key2 of keys2) {
948
+ const keys = pointer.keys;
949
+ for (const key2 of keys) {
1313
950
  const node2 = await this.getNode(key2);
1314
951
  node2.parent = pointer.id;
1315
952
  this.bufferForNodeUpdate(node2);
@@ -1509,8 +1146,8 @@ var BPTreeAsync = class extends BPTree {
1509
1146
  async leftestNode() {
1510
1147
  let node = this.root;
1511
1148
  while (!node.leaf) {
1512
- const keys2 = node.keys;
1513
- node = await this.getNode(keys2[0]);
1149
+ const keys = node.keys;
1150
+ node = await this.getNode(keys[0]);
1514
1151
  }
1515
1152
  return node;
1516
1153
  }
@@ -1621,17 +1258,17 @@ var BPTreeAsync = class extends BPTree {
1621
1258
  while (i--) {
1622
1259
  const nValue = node.values[i];
1623
1260
  if (this.comparator.isSame(value, nValue)) {
1624
- const keys2 = node.keys[i];
1625
- if (keys2.includes(key)) {
1626
- if (keys2.length > 1) {
1627
- keys2.splice(keys2.indexOf(key), 1);
1261
+ const keys = node.keys[i];
1262
+ if (keys.includes(key)) {
1263
+ if (keys.length > 1) {
1264
+ keys.splice(keys.indexOf(key), 1);
1628
1265
  this.bufferForNodeUpdate(node);
1629
1266
  } else if (node === this.root) {
1630
1267
  node.values.splice(i, 1);
1631
1268
  node.keys.splice(i, 1);
1632
1269
  this.bufferForNodeUpdate(node);
1633
1270
  } else {
1634
- keys2.splice(keys2.indexOf(key), 1);
1271
+ keys.splice(keys.indexOf(key), 1);
1635
1272
  node.keys.splice(i, 1);
1636
1273
  node.values.splice(node.values.indexOf(value), 1);
1637
1274
  await this._deleteEntry(node, key, value);
@@ -1650,8 +1287,8 @@ var BPTreeAsync = class extends BPTree {
1650
1287
  for (let i = 0, len = node.values.length; i < len; i++) {
1651
1288
  const nValue = node.values[i];
1652
1289
  if (this.comparator.isSame(value, nValue)) {
1653
- const keys2 = node.keys[i];
1654
- return keys2.includes(key);
1290
+ const keys = node.keys[i];
1291
+ return keys.includes(key);
1655
1292
  }
1656
1293
  }
1657
1294
  return false;
@@ -1661,13 +1298,13 @@ var BPTreeAsync = class extends BPTree {
1661
1298
  await this.commitHeadBuffer();
1662
1299
  }
1663
1300
  async forceUpdate() {
1664
- const keys2 = [...this.nodes.keys()];
1301
+ const keys = [...this.nodes.keys()];
1665
1302
  this.nodes.clear();
1666
1303
  await this.init();
1667
- for (const key of keys2) {
1304
+ for (const key of keys) {
1668
1305
  await this.getNode(key);
1669
1306
  }
1670
- return keys2.length;
1307
+ return keys.length;
1671
1308
  }
1672
1309
  };
1673
1310