mol_wire_lib 1.0.1279 → 1.0.1281

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
@@ -84,9 +84,8 @@ var $;
84
84
  if (sub_pos !== end) {
85
85
  this.peer_move(end, sub_pos);
86
86
  }
87
- this.data.pop();
88
- this.data.pop();
89
- if (this.data.length === this.sub_from)
87
+ this.data.length = end;
88
+ if (end === this.sub_from)
90
89
  this.reap();
91
90
  }
92
91
  reap() { }
@@ -318,9 +317,8 @@ var $;
318
317
  const sub = this.data[cursor];
319
318
  const pos = this.data[cursor + 1];
320
319
  sub.pub_off(pos);
321
- this.data.pop();
322
- this.data.pop();
323
320
  }
321
+ this.sub_from = this.pub_from;
324
322
  this.cursor = this.pub_from;
325
323
  this.track_cut();
326
324
  this.cursor = $mol_wire_cursor.final;
@@ -329,23 +327,15 @@ var $;
329
327
  if (this.cursor < this.pub_from) {
330
328
  $mol_fail(new Error('Cut of non begun sub'));
331
329
  }
332
- let tail = 0;
330
+ let end = this.data.length;
333
331
  for (let cursor = this.cursor; cursor < this.sub_from; cursor += 2) {
334
332
  const pub = this.data[cursor];
335
333
  pub?.sub_off(this.data[cursor + 1]);
336
- if (this.sub_from < this.data.length) {
337
- this.peer_move(this.data.length - 2, cursor);
338
- this.data.pop();
339
- this.data.pop();
340
- }
341
- else {
342
- ++tail;
343
- }
344
- }
345
- for (; tail; --tail) {
346
- this.data.pop();
347
- this.data.pop();
334
+ end -= 2;
335
+ if (this.sub_from < end)
336
+ this.peer_move(end, cursor);
348
337
  }
338
+ this.data.length = end;
349
339
  this.sub_from = this.cursor;
350
340
  }
351
341
  complete() { }
package/node.test.js CHANGED
@@ -75,9 +75,8 @@ var $;
75
75
  if (sub_pos !== end) {
76
76
  this.peer_move(end, sub_pos);
77
77
  }
78
- this.data.pop();
79
- this.data.pop();
80
- if (this.data.length === this.sub_from)
78
+ this.data.length = end;
79
+ if (end === this.sub_from)
81
80
  this.reap();
82
81
  }
83
82
  reap() { }
@@ -309,9 +308,8 @@ var $;
309
308
  const sub = this.data[cursor];
310
309
  const pos = this.data[cursor + 1];
311
310
  sub.pub_off(pos);
312
- this.data.pop();
313
- this.data.pop();
314
311
  }
312
+ this.sub_from = this.pub_from;
315
313
  this.cursor = this.pub_from;
316
314
  this.track_cut();
317
315
  this.cursor = $mol_wire_cursor.final;
@@ -320,23 +318,15 @@ var $;
320
318
  if (this.cursor < this.pub_from) {
321
319
  $mol_fail(new Error('Cut of non begun sub'));
322
320
  }
323
- let tail = 0;
321
+ let end = this.data.length;
324
322
  for (let cursor = this.cursor; cursor < this.sub_from; cursor += 2) {
325
323
  const pub = this.data[cursor];
326
324
  pub?.sub_off(this.data[cursor + 1]);
327
- if (this.sub_from < this.data.length) {
328
- this.peer_move(this.data.length - 2, cursor);
329
- this.data.pop();
330
- this.data.pop();
331
- }
332
- else {
333
- ++tail;
334
- }
335
- }
336
- for (; tail; --tail) {
337
- this.data.pop();
338
- this.data.pop();
325
+ end -= 2;
326
+ if (this.sub_from < end)
327
+ this.peer_move(end, cursor);
339
328
  }
329
+ this.data.length = end;
340
330
  this.sub_from = this.cursor;
341
331
  }
342
332
  complete() { }