mol_key 0.0.1118 → 0.0.1120

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
@@ -1592,9 +1592,8 @@ var $;
1592
1592
  if (sub_pos !== end) {
1593
1593
  this.peer_move(end, sub_pos);
1594
1594
  }
1595
- this.data.pop();
1596
- this.data.pop();
1597
- if (this.data.length === this.sub_from)
1595
+ this.data.length = end;
1596
+ if (end === this.sub_from)
1598
1597
  this.reap();
1599
1598
  }
1600
1599
  reap() { }
@@ -1826,9 +1825,8 @@ var $;
1826
1825
  const sub = this.data[cursor];
1827
1826
  const pos = this.data[cursor + 1];
1828
1827
  sub.pub_off(pos);
1829
- this.data.pop();
1830
- this.data.pop();
1831
1828
  }
1829
+ this.data.length = this.sub_from;
1832
1830
  this.cursor = this.pub_from;
1833
1831
  this.track_cut();
1834
1832
  this.cursor = $mol_wire_cursor.final;
@@ -1837,23 +1835,15 @@ var $;
1837
1835
  if (this.cursor < this.pub_from) {
1838
1836
  $mol_fail(new Error('Cut of non begun sub'));
1839
1837
  }
1840
- let tail = 0;
1838
+ let end = this.data.length;
1841
1839
  for (let cursor = this.cursor; cursor < this.sub_from; cursor += 2) {
1842
1840
  const pub = this.data[cursor];
1843
1841
  pub?.sub_off(this.data[cursor + 1]);
1844
- if (this.sub_from < this.data.length) {
1845
- this.peer_move(this.data.length - 2, cursor);
1846
- this.data.pop();
1847
- this.data.pop();
1848
- }
1849
- else {
1850
- ++tail;
1851
- }
1852
- }
1853
- for (; tail; --tail) {
1854
- this.data.pop();
1855
- this.data.pop();
1842
+ end -= 2;
1843
+ if (this.sub_from <= end)
1844
+ this.peer_move(end, cursor);
1856
1845
  }
1846
+ this.data.length = end;
1857
1847
  this.sub_from = this.cursor;
1858
1848
  }
1859
1849
  complete() { }