mol_tree2 1.0.950 → 1.0.952

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/node.test.js CHANGED
@@ -3010,9 +3010,8 @@ var $;
3010
3010
  if (sub_pos !== end) {
3011
3011
  this.peer_move(end, sub_pos);
3012
3012
  }
3013
- this.data.pop();
3014
- this.data.pop();
3015
- if (this.data.length === this.sub_from)
3013
+ this.data.length = end;
3014
+ if (end === this.sub_from)
3016
3015
  this.reap();
3017
3016
  }
3018
3017
  reap() { }
@@ -3244,9 +3243,8 @@ var $;
3244
3243
  const sub = this.data[cursor];
3245
3244
  const pos = this.data[cursor + 1];
3246
3245
  sub.pub_off(pos);
3247
- this.data.pop();
3248
- this.data.pop();
3249
3246
  }
3247
+ this.data.length = this.sub_from;
3250
3248
  this.cursor = this.pub_from;
3251
3249
  this.track_cut();
3252
3250
  this.cursor = $mol_wire_cursor.final;
@@ -3255,23 +3253,15 @@ var $;
3255
3253
  if (this.cursor < this.pub_from) {
3256
3254
  $mol_fail(new Error('Cut of non begun sub'));
3257
3255
  }
3258
- let tail = 0;
3256
+ let end = this.data.length;
3259
3257
  for (let cursor = this.cursor; cursor < this.sub_from; cursor += 2) {
3260
3258
  const pub = this.data[cursor];
3261
3259
  pub?.sub_off(this.data[cursor + 1]);
3262
- if (this.sub_from < this.data.length) {
3263
- this.peer_move(this.data.length - 2, cursor);
3264
- this.data.pop();
3265
- this.data.pop();
3266
- }
3267
- else {
3268
- ++tail;
3269
- }
3270
- }
3271
- for (; tail; --tail) {
3272
- this.data.pop();
3273
- this.data.pop();
3260
+ end -= 2;
3261
+ if (this.sub_from <= end)
3262
+ this.peer_move(end, cursor);
3274
3263
  }
3264
+ this.data.length = end;
3275
3265
  this.sub_from = this.cursor;
3276
3266
  }
3277
3267
  complete() { }