mol_vary 0.0.90 → 0.0.91

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
@@ -65,10 +65,20 @@ var $;
65
65
  var $;
66
66
  (function ($) {
67
67
  let buf = new Uint8Array(2 ** 12);
68
+ function $mol_charset_buffer(size) {
69
+ if (buf.byteLength < size)
70
+ buf = new Uint8Array(size);
71
+ return buf;
72
+ }
73
+ $.$mol_charset_buffer = $mol_charset_buffer;
74
+ })($ || ($ = {}));
75
+
76
+ ;
77
+ "use strict";
78
+ var $;
79
+ (function ($) {
68
80
  function $mol_charset_encode(str) {
69
- const capacity = str.length * 3;
70
- if (buf.byteLength < capacity)
71
- buf = new Uint8Array(capacity);
81
+ const buf = $mol_charset_buffer(str.length * 3);
72
82
  return buf.slice(0, $mol_charset_encode_to(str, buf));
73
83
  }
74
84
  $.$mol_charset_encode = $mol_charset_encode;
package/node.test.js CHANGED
@@ -56,10 +56,20 @@ var $;
56
56
  var $;
57
57
  (function ($) {
58
58
  let buf = new Uint8Array(2 ** 12);
59
+ function $mol_charset_buffer(size) {
60
+ if (buf.byteLength < size)
61
+ buf = new Uint8Array(size);
62
+ return buf;
63
+ }
64
+ $.$mol_charset_buffer = $mol_charset_buffer;
65
+ })($ || ($ = {}));
66
+
67
+ ;
68
+ "use strict";
69
+ var $;
70
+ (function ($) {
59
71
  function $mol_charset_encode(str) {
60
- const capacity = str.length * 3;
61
- if (buf.byteLength < capacity)
62
- buf = new Uint8Array(capacity);
72
+ const buf = $mol_charset_buffer(str.length * 3);
63
73
  return buf.slice(0, $mol_charset_encode_to(str, buf));
64
74
  }
65
75
  $.$mol_charset_encode = $mol_charset_encode;