mol_mutable 0.0.778 → 0.0.780

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
@@ -249,11 +249,13 @@ var $node = new Proxy({ require }, {
249
249
  get(target, name, wrapper) {
250
250
  if (target[name])
251
251
  return target[name];
252
- const mod = target.require('module');
253
- if (mod.builtinModules.indexOf(name) >= 0)
252
+ if (name.startsWith('node:'))
254
253
  return target.require(name);
255
254
  if (name[0] === '.')
256
255
  return target.require(name);
256
+ const mod = target.require('module');
257
+ if (mod.builtinModules.indexOf(name) >= 0)
258
+ return target.require(name);
257
259
  try {
258
260
  target.require.resolve(name);
259
261
  }
@@ -622,9 +624,8 @@ var $;
622
624
  if (sub_pos !== end) {
623
625
  this.peer_move(end, sub_pos);
624
626
  }
625
- this.data.pop();
626
- this.data.pop();
627
- if (this.data.length === this.sub_from)
627
+ this.data.length = end;
628
+ if (end === this.sub_from)
628
629
  this.reap();
629
630
  }
630
631
  reap() { }
@@ -856,9 +857,8 @@ var $;
856
857
  const sub = this.data[cursor];
857
858
  const pos = this.data[cursor + 1];
858
859
  sub.pub_off(pos);
859
- this.data.pop();
860
- this.data.pop();
861
860
  }
861
+ this.data.length = this.sub_from;
862
862
  this.cursor = this.pub_from;
863
863
  this.track_cut();
864
864
  this.cursor = $mol_wire_cursor.final;
@@ -867,23 +867,15 @@ var $;
867
867
  if (this.cursor < this.pub_from) {
868
868
  $mol_fail(new Error('Cut of non begun sub'));
869
869
  }
870
- let tail = 0;
870
+ let end = this.data.length;
871
871
  for (let cursor = this.cursor; cursor < this.sub_from; cursor += 2) {
872
872
  const pub = this.data[cursor];
873
873
  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();
874
+ end -= 2;
875
+ if (this.sub_from <= end)
876
+ this.peer_move(end, cursor);
886
877
  }
878
+ this.data.length = end;
887
879
  this.sub_from = this.cursor;
888
880
  }
889
881
  complete() { }