mol_mutable 0.0.777 → 0.0.779

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
@@ -622,9 +622,8 @@ var $;
622
622
  if (sub_pos !== end) {
623
623
  this.peer_move(end, sub_pos);
624
624
  }
625
- this.data.pop();
626
- this.data.pop();
627
- if (this.data.length === this.sub_from)
625
+ this.data.length = end;
626
+ if (end === this.sub_from)
628
627
  this.reap();
629
628
  }
630
629
  reap() { }
@@ -856,9 +855,8 @@ var $;
856
855
  const sub = this.data[cursor];
857
856
  const pos = this.data[cursor + 1];
858
857
  sub.pub_off(pos);
859
- this.data.pop();
860
- this.data.pop();
861
858
  }
859
+ this.data.length = this.sub_from;
862
860
  this.cursor = this.pub_from;
863
861
  this.track_cut();
864
862
  this.cursor = $mol_wire_cursor.final;
@@ -867,23 +865,15 @@ var $;
867
865
  if (this.cursor < this.pub_from) {
868
866
  $mol_fail(new Error('Cut of non begun sub'));
869
867
  }
870
- let tail = 0;
868
+ let end = this.data.length;
871
869
  for (let cursor = this.cursor; cursor < this.sub_from; cursor += 2) {
872
870
  const pub = this.data[cursor];
873
871
  pub?.sub_off(this.data[cursor + 1]);
874
- if (this.sub_from < this.data.length) {
875
- this.peer_move(this.data.length - 2, cursor);
876
- this.data.pop();
877
- this.data.pop();
878
- }
879
- else {
880
- ++tail;
881
- }
882
- }
883
- for (; tail; --tail) {
884
- this.data.pop();
885
- this.data.pop();
872
+ end -= 2;
873
+ if (this.sub_from <= end)
874
+ this.peer_move(end, cursor);
886
875
  }
876
+ this.data.length = end;
887
877
  this.sub_from = this.cursor;
888
878
  }
889
879
  complete() { }