mol_text_distance 0.0.1047 → 0.0.1049

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
@@ -257,11 +257,13 @@ var $node = new Proxy({ require }, {
257
257
  get(target, name, wrapper) {
258
258
  if (target[name])
259
259
  return target[name];
260
- const mod = target.require('module');
261
- if (mod.builtinModules.indexOf(name) >= 0)
260
+ if (name.startsWith('node:'))
262
261
  return target.require(name);
263
262
  if (name[0] === '.')
264
263
  return target.require(name);
264
+ const mod = target.require('module');
265
+ if (mod.builtinModules.indexOf(name) >= 0)
266
+ return target.require(name);
265
267
  try {
266
268
  target.require.resolve(name);
267
269
  }
@@ -645,9 +647,8 @@ var $;
645
647
  if (sub_pos !== end) {
646
648
  this.peer_move(end, sub_pos);
647
649
  }
648
- this.data.pop();
649
- this.data.pop();
650
- if (this.data.length === this.sub_from)
650
+ this.data.length = end;
651
+ if (end === this.sub_from)
651
652
  this.reap();
652
653
  }
653
654
  reap() { }
@@ -879,9 +880,8 @@ var $;
879
880
  const sub = this.data[cursor];
880
881
  const pos = this.data[cursor + 1];
881
882
  sub.pub_off(pos);
882
- this.data.pop();
883
- this.data.pop();
884
883
  }
884
+ this.data.length = this.sub_from;
885
885
  this.cursor = this.pub_from;
886
886
  this.track_cut();
887
887
  this.cursor = $mol_wire_cursor.final;
@@ -890,23 +890,15 @@ var $;
890
890
  if (this.cursor < this.pub_from) {
891
891
  $mol_fail(new Error('Cut of non begun sub'));
892
892
  }
893
- let tail = 0;
893
+ let end = this.data.length;
894
894
  for (let cursor = this.cursor; cursor < this.sub_from; cursor += 2) {
895
895
  const pub = this.data[cursor];
896
896
  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();
897
+ end -= 2;
898
+ if (this.sub_from <= end)
899
+ this.peer_move(end, cursor);
909
900
  }
901
+ this.data.length = end;
910
902
  this.sub_from = this.cursor;
911
903
  }
912
904
  complete() { }