hyoo_sync_client 0.0.585 → 0.0.587

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.mjs CHANGED
@@ -453,9 +453,8 @@ var $;
453
453
  if (sub_pos !== end) {
454
454
  this.peer_move(end, sub_pos);
455
455
  }
456
- this.data.pop();
457
- this.data.pop();
458
- if (this.data.length === this.sub_from)
456
+ this.data.length = end;
457
+ if (end === this.sub_from)
459
458
  this.reap();
460
459
  }
461
460
  reap() { }
@@ -687,9 +686,8 @@ var $;
687
686
  const sub = this.data[cursor];
688
687
  const pos = this.data[cursor + 1];
689
688
  sub.pub_off(pos);
690
- this.data.pop();
691
- this.data.pop();
692
689
  }
690
+ this.data.length = this.sub_from;
693
691
  this.cursor = this.pub_from;
694
692
  this.track_cut();
695
693
  this.cursor = $mol_wire_cursor.final;
@@ -698,23 +696,15 @@ var $;
698
696
  if (this.cursor < this.pub_from) {
699
697
  $mol_fail(new Error('Cut of non begun sub'));
700
698
  }
701
- let tail = 0;
699
+ let end = this.data.length;
702
700
  for (let cursor = this.cursor; cursor < this.sub_from; cursor += 2) {
703
701
  const pub = this.data[cursor];
704
702
  pub?.sub_off(this.data[cursor + 1]);
705
- if (this.sub_from < this.data.length) {
706
- this.peer_move(this.data.length - 2, cursor);
707
- this.data.pop();
708
- this.data.pop();
709
- }
710
- else {
711
- ++tail;
712
- }
713
- }
714
- for (; tail; --tail) {
715
- this.data.pop();
716
- this.data.pop();
703
+ end -= 2;
704
+ if (this.sub_from <= end)
705
+ this.peer_move(end, cursor);
717
706
  }
707
+ this.data.length = end;
718
708
  this.sub_from = this.cursor;
719
709
  }
720
710
  complete() { }
package/node.test.js CHANGED
@@ -444,9 +444,8 @@ var $;
444
444
  if (sub_pos !== end) {
445
445
  this.peer_move(end, sub_pos);
446
446
  }
447
- this.data.pop();
448
- this.data.pop();
449
- if (this.data.length === this.sub_from)
447
+ this.data.length = end;
448
+ if (end === this.sub_from)
450
449
  this.reap();
451
450
  }
452
451
  reap() { }
@@ -678,9 +677,8 @@ var $;
678
677
  const sub = this.data[cursor];
679
678
  const pos = this.data[cursor + 1];
680
679
  sub.pub_off(pos);
681
- this.data.pop();
682
- this.data.pop();
683
680
  }
681
+ this.data.length = this.sub_from;
684
682
  this.cursor = this.pub_from;
685
683
  this.track_cut();
686
684
  this.cursor = $mol_wire_cursor.final;
@@ -689,23 +687,15 @@ var $;
689
687
  if (this.cursor < this.pub_from) {
690
688
  $mol_fail(new Error('Cut of non begun sub'));
691
689
  }
692
- let tail = 0;
690
+ let end = this.data.length;
693
691
  for (let cursor = this.cursor; cursor < this.sub_from; cursor += 2) {
694
692
  const pub = this.data[cursor];
695
693
  pub?.sub_off(this.data[cursor + 1]);
696
- if (this.sub_from < this.data.length) {
697
- this.peer_move(this.data.length - 2, cursor);
698
- this.data.pop();
699
- this.data.pop();
700
- }
701
- else {
702
- ++tail;
703
- }
704
- }
705
- for (; tail; --tail) {
706
- this.data.pop();
707
- this.data.pop();
694
+ end -= 2;
695
+ if (this.sub_from <= end)
696
+ this.peer_move(end, cursor);
708
697
  }
698
+ this.data.length = end;
709
699
  this.sub_from = this.cursor;
710
700
  }
711
701
  complete() { }