mol_text_distance 0.0.1046 → 0.0.1048

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
@@ -645,9 +645,8 @@ var $;
645
645
  if (sub_pos !== end) {
646
646
  this.peer_move(end, sub_pos);
647
647
  }
648
- this.data.pop();
649
- this.data.pop();
650
- if (this.data.length === this.sub_from)
648
+ this.data.length = end;
649
+ if (end === this.sub_from)
651
650
  this.reap();
652
651
  }
653
652
  reap() { }
@@ -879,9 +878,8 @@ var $;
879
878
  const sub = this.data[cursor];
880
879
  const pos = this.data[cursor + 1];
881
880
  sub.pub_off(pos);
882
- this.data.pop();
883
- this.data.pop();
884
881
  }
882
+ this.data.length = this.sub_from;
885
883
  this.cursor = this.pub_from;
886
884
  this.track_cut();
887
885
  this.cursor = $mol_wire_cursor.final;
@@ -890,23 +888,15 @@ var $;
890
888
  if (this.cursor < this.pub_from) {
891
889
  $mol_fail(new Error('Cut of non begun sub'));
892
890
  }
893
- let tail = 0;
891
+ let end = this.data.length;
894
892
  for (let cursor = this.cursor; cursor < this.sub_from; cursor += 2) {
895
893
  const pub = this.data[cursor];
896
894
  pub?.sub_off(this.data[cursor + 1]);
897
- if (this.sub_from < this.data.length) {
898
- this.peer_move(this.data.length - 2, cursor);
899
- this.data.pop();
900
- this.data.pop();
901
- }
902
- else {
903
- ++tail;
904
- }
905
- }
906
- for (; tail; --tail) {
907
- this.data.pop();
908
- this.data.pop();
895
+ end -= 2;
896
+ if (this.sub_from <= end)
897
+ this.peer_move(end, cursor);
909
898
  }
899
+ this.data.length = end;
910
900
  this.sub_from = this.cursor;
911
901
  }
912
902
  complete() { }