serializable-bptree 5.0.4 → 5.0.5
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/cjs/index.cjs +8 -8
- package/dist/esm/index.mjs +8 -8
- package/package.json +1 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -336,7 +336,7 @@ var BPTreeSync = class extends BPTree {
|
|
|
336
336
|
}
|
|
337
337
|
}
|
|
338
338
|
}
|
|
339
|
-
if (this.root === node && node.keys.length === 1) {
|
|
339
|
+
if (this.root.id === node.id && node.keys.length === 1) {
|
|
340
340
|
const keys = node.keys;
|
|
341
341
|
this.bufferForNodeDelete(this.root);
|
|
342
342
|
this.root = this.getNode(keys[0]);
|
|
@@ -344,7 +344,7 @@ var BPTreeSync = class extends BPTree {
|
|
|
344
344
|
this.strategy.head.root = this.root.id;
|
|
345
345
|
this.bufferForNodeUpdate(this.root);
|
|
346
346
|
return;
|
|
347
|
-
} else if (this.root === node) {
|
|
347
|
+
} else if (this.root.id === node.id) {
|
|
348
348
|
this.bufferForNodeUpdate(this.root);
|
|
349
349
|
return;
|
|
350
350
|
} else if (node.keys.length < Math.ceil(this.order / 2) && !node.leaf || node.values.length < Math.ceil((this.order - 1) / 2) && node.leaf) {
|
|
@@ -522,7 +522,7 @@ var BPTreeSync = class extends BPTree {
|
|
|
522
522
|
}
|
|
523
523
|
}
|
|
524
524
|
_insertInParent(node, value, pointer) {
|
|
525
|
-
if (this.root === node) {
|
|
525
|
+
if (this.root.id === node.id) {
|
|
526
526
|
const root = this._createNode(false, [node.id, pointer.id], [value]);
|
|
527
527
|
this.root = root;
|
|
528
528
|
this.strategy.head.root = root.id;
|
|
@@ -740,7 +740,7 @@ var BPTreeSync = class extends BPTree {
|
|
|
740
740
|
if (keys.length > 1) {
|
|
741
741
|
keys.splice(keys.indexOf(key), 1);
|
|
742
742
|
this.bufferForNodeUpdate(node);
|
|
743
|
-
} else if (node === this.root) {
|
|
743
|
+
} else if (node.id === this.root.id) {
|
|
744
744
|
node.values.splice(i, 1);
|
|
745
745
|
node.keys.splice(i, 1);
|
|
746
746
|
this.bufferForNodeUpdate(node);
|
|
@@ -898,7 +898,7 @@ var BPTreeAsync = class extends BPTree {
|
|
|
898
898
|
}
|
|
899
899
|
}
|
|
900
900
|
}
|
|
901
|
-
if (this.root === node && node.keys.length === 1) {
|
|
901
|
+
if (this.root.id === node.id && node.keys.length === 1) {
|
|
902
902
|
const keys = node.keys;
|
|
903
903
|
this.bufferForNodeDelete(this.root);
|
|
904
904
|
this.root = await this.getNode(keys[0]);
|
|
@@ -906,7 +906,7 @@ var BPTreeAsync = class extends BPTree {
|
|
|
906
906
|
this.strategy.head.root = this.root.id;
|
|
907
907
|
this.bufferForNodeUpdate(this.root);
|
|
908
908
|
return;
|
|
909
|
-
} else if (this.root === node) {
|
|
909
|
+
} else if (this.root.id === node.id) {
|
|
910
910
|
this.bufferForNodeUpdate(this.root);
|
|
911
911
|
return;
|
|
912
912
|
} else if (node.keys.length < Math.ceil(this.order / 2) && !node.leaf || node.values.length < Math.ceil((this.order - 1) / 2) && node.leaf) {
|
|
@@ -1084,7 +1084,7 @@ var BPTreeAsync = class extends BPTree {
|
|
|
1084
1084
|
}
|
|
1085
1085
|
}
|
|
1086
1086
|
async _insertInParent(node, value, pointer) {
|
|
1087
|
-
if (this.root === node) {
|
|
1087
|
+
if (this.root.id === node.id) {
|
|
1088
1088
|
const root = await this._createNode(false, [node.id, pointer.id], [value]);
|
|
1089
1089
|
this.root = root;
|
|
1090
1090
|
this.strategy.head.root = root.id;
|
|
@@ -1302,7 +1302,7 @@ var BPTreeAsync = class extends BPTree {
|
|
|
1302
1302
|
if (keys.length > 1) {
|
|
1303
1303
|
keys.splice(keys.indexOf(key), 1);
|
|
1304
1304
|
this.bufferForNodeUpdate(node);
|
|
1305
|
-
} else if (node === this.root) {
|
|
1305
|
+
} else if (node.id === this.root.id) {
|
|
1306
1306
|
node.values.splice(i, 1);
|
|
1307
1307
|
node.keys.splice(i, 1);
|
|
1308
1308
|
this.bufferForNodeUpdate(node);
|
package/dist/esm/index.mjs
CHANGED
|
@@ -302,7 +302,7 @@ var BPTreeSync = class extends BPTree {
|
|
|
302
302
|
}
|
|
303
303
|
}
|
|
304
304
|
}
|
|
305
|
-
if (this.root === node && node.keys.length === 1) {
|
|
305
|
+
if (this.root.id === node.id && node.keys.length === 1) {
|
|
306
306
|
const keys = node.keys;
|
|
307
307
|
this.bufferForNodeDelete(this.root);
|
|
308
308
|
this.root = this.getNode(keys[0]);
|
|
@@ -310,7 +310,7 @@ var BPTreeSync = class extends BPTree {
|
|
|
310
310
|
this.strategy.head.root = this.root.id;
|
|
311
311
|
this.bufferForNodeUpdate(this.root);
|
|
312
312
|
return;
|
|
313
|
-
} else if (this.root === node) {
|
|
313
|
+
} else if (this.root.id === node.id) {
|
|
314
314
|
this.bufferForNodeUpdate(this.root);
|
|
315
315
|
return;
|
|
316
316
|
} else if (node.keys.length < Math.ceil(this.order / 2) && !node.leaf || node.values.length < Math.ceil((this.order - 1) / 2) && node.leaf) {
|
|
@@ -488,7 +488,7 @@ var BPTreeSync = class extends BPTree {
|
|
|
488
488
|
}
|
|
489
489
|
}
|
|
490
490
|
_insertInParent(node, value, pointer) {
|
|
491
|
-
if (this.root === node) {
|
|
491
|
+
if (this.root.id === node.id) {
|
|
492
492
|
const root = this._createNode(false, [node.id, pointer.id], [value]);
|
|
493
493
|
this.root = root;
|
|
494
494
|
this.strategy.head.root = root.id;
|
|
@@ -706,7 +706,7 @@ var BPTreeSync = class extends BPTree {
|
|
|
706
706
|
if (keys.length > 1) {
|
|
707
707
|
keys.splice(keys.indexOf(key), 1);
|
|
708
708
|
this.bufferForNodeUpdate(node);
|
|
709
|
-
} else if (node === this.root) {
|
|
709
|
+
} else if (node.id === this.root.id) {
|
|
710
710
|
node.values.splice(i, 1);
|
|
711
711
|
node.keys.splice(i, 1);
|
|
712
712
|
this.bufferForNodeUpdate(node);
|
|
@@ -864,7 +864,7 @@ var BPTreeAsync = class extends BPTree {
|
|
|
864
864
|
}
|
|
865
865
|
}
|
|
866
866
|
}
|
|
867
|
-
if (this.root === node && node.keys.length === 1) {
|
|
867
|
+
if (this.root.id === node.id && node.keys.length === 1) {
|
|
868
868
|
const keys = node.keys;
|
|
869
869
|
this.bufferForNodeDelete(this.root);
|
|
870
870
|
this.root = await this.getNode(keys[0]);
|
|
@@ -872,7 +872,7 @@ var BPTreeAsync = class extends BPTree {
|
|
|
872
872
|
this.strategy.head.root = this.root.id;
|
|
873
873
|
this.bufferForNodeUpdate(this.root);
|
|
874
874
|
return;
|
|
875
|
-
} else if (this.root === node) {
|
|
875
|
+
} else if (this.root.id === node.id) {
|
|
876
876
|
this.bufferForNodeUpdate(this.root);
|
|
877
877
|
return;
|
|
878
878
|
} else if (node.keys.length < Math.ceil(this.order / 2) && !node.leaf || node.values.length < Math.ceil((this.order - 1) / 2) && node.leaf) {
|
|
@@ -1050,7 +1050,7 @@ var BPTreeAsync = class extends BPTree {
|
|
|
1050
1050
|
}
|
|
1051
1051
|
}
|
|
1052
1052
|
async _insertInParent(node, value, pointer) {
|
|
1053
|
-
if (this.root === node) {
|
|
1053
|
+
if (this.root.id === node.id) {
|
|
1054
1054
|
const root = await this._createNode(false, [node.id, pointer.id], [value]);
|
|
1055
1055
|
this.root = root;
|
|
1056
1056
|
this.strategy.head.root = root.id;
|
|
@@ -1268,7 +1268,7 @@ var BPTreeAsync = class extends BPTree {
|
|
|
1268
1268
|
if (keys.length > 1) {
|
|
1269
1269
|
keys.splice(keys.indexOf(key), 1);
|
|
1270
1270
|
this.bufferForNodeUpdate(node);
|
|
1271
|
-
} else if (node === this.root) {
|
|
1271
|
+
} else if (node.id === this.root.id) {
|
|
1272
1272
|
node.values.splice(i, 1);
|
|
1273
1273
|
node.keys.splice(i, 1);
|
|
1274
1274
|
this.bufferForNodeUpdate(node);
|