mol_crypto_lib 0.1.1379 → 0.1.1381

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