mol_regexp 0.0.1396 → 0.0.1398

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
@@ -887,9 +887,8 @@ var $;
887
887
  if (sub_pos !== end) {
888
888
  this.peer_move(end, sub_pos);
889
889
  }
890
- this.data.pop();
891
- this.data.pop();
892
- if (this.data.length === this.sub_from)
890
+ this.data.length = end;
891
+ if (end === this.sub_from)
893
892
  this.reap();
894
893
  }
895
894
  reap() { }
@@ -1121,9 +1120,8 @@ var $;
1121
1120
  const sub = this.data[cursor];
1122
1121
  const pos = this.data[cursor + 1];
1123
1122
  sub.pub_off(pos);
1124
- this.data.pop();
1125
- this.data.pop();
1126
1123
  }
1124
+ this.data.length = this.sub_from;
1127
1125
  this.cursor = this.pub_from;
1128
1126
  this.track_cut();
1129
1127
  this.cursor = $mol_wire_cursor.final;
@@ -1132,23 +1130,15 @@ var $;
1132
1130
  if (this.cursor < this.pub_from) {
1133
1131
  $mol_fail(new Error('Cut of non begun sub'));
1134
1132
  }
1135
- let tail = 0;
1133
+ let end = this.data.length;
1136
1134
  for (let cursor = this.cursor; cursor < this.sub_from; cursor += 2) {
1137
1135
  const pub = this.data[cursor];
1138
1136
  pub?.sub_off(this.data[cursor + 1]);
1139
- if (this.sub_from < this.data.length) {
1140
- this.peer_move(this.data.length - 2, cursor);
1141
- this.data.pop();
1142
- this.data.pop();
1143
- }
1144
- else {
1145
- ++tail;
1146
- }
1147
- }
1148
- for (; tail; --tail) {
1149
- this.data.pop();
1150
- this.data.pop();
1137
+ end -= 2;
1138
+ if (this.sub_from <= end)
1139
+ this.peer_move(end, cursor);
1151
1140
  }
1141
+ this.data.length = end;
1152
1142
  this.sub_from = this.cursor;
1153
1143
  }
1154
1144
  complete() { }