mol_compare_deep 0.0.1134 → 0.0.1135

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
@@ -1669,9 +1669,8 @@ var $;
1669
1669
  if (sub_pos !== end) {
1670
1670
  this.peer_move(end, sub_pos);
1671
1671
  }
1672
- this.data.pop();
1673
- this.data.pop();
1674
- if (this.data.length === this.sub_from)
1672
+ this.data.length = end;
1673
+ if (end === this.sub_from)
1675
1674
  this.reap();
1676
1675
  }
1677
1676
  reap() { }
@@ -1903,9 +1902,8 @@ var $;
1903
1902
  const sub = this.data[cursor];
1904
1903
  const pos = this.data[cursor + 1];
1905
1904
  sub.pub_off(pos);
1906
- this.data.pop();
1907
- this.data.pop();
1908
1905
  }
1906
+ this.data.length = this.sub_from;
1909
1907
  this.cursor = this.pub_from;
1910
1908
  this.track_cut();
1911
1909
  this.cursor = $mol_wire_cursor.final;
@@ -1914,23 +1912,15 @@ var $;
1914
1912
  if (this.cursor < this.pub_from) {
1915
1913
  $mol_fail(new Error('Cut of non begun sub'));
1916
1914
  }
1917
- let tail = 0;
1915
+ let end = this.data.length;
1918
1916
  for (let cursor = this.cursor; cursor < this.sub_from; cursor += 2) {
1919
1917
  const pub = this.data[cursor];
1920
1918
  pub?.sub_off(this.data[cursor + 1]);
1921
- if (this.sub_from < this.data.length) {
1922
- this.peer_move(this.data.length - 2, cursor);
1923
- this.data.pop();
1924
- this.data.pop();
1925
- }
1926
- else {
1927
- ++tail;
1928
- }
1929
- }
1930
- for (; tail; --tail) {
1931
- this.data.pop();
1932
- this.data.pop();
1919
+ end -= 2;
1920
+ if (this.sub_from <= end)
1921
+ this.peer_move(end, cursor);
1933
1922
  }
1923
+ this.data.length = end;
1934
1924
  this.sub_from = this.cursor;
1935
1925
  }
1936
1926
  complete() { }