base128-ascii 2.0.0 → 2.0.1

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.
Files changed (2) hide show
  1. package/dist/index.js +3 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -20,7 +20,7 @@ export function encode(input) {
20
20
  return str ??= new TextDecoder().decode(out);
21
21
  },
22
22
  toJSTemplateLiterals() {
23
- return jstl ??= '`' + this.toString().replace(/[\r\\`]|\${|\0\d?|<\/script/g, (match) => {
23
+ return jstl ??= `\`${this.toString().replace(/[\r\\`]|\${|\0\d?|<\/script/g, (match) => {
24
24
  if (match == '\r')
25
25
  return '\\r';
26
26
  if (match == '</script')
@@ -31,16 +31,13 @@ export function encode(input) {
31
31
  return '\\0';
32
32
  }
33
33
  return '\\' + match;
34
- }) + '`';
34
+ })}\``;
35
35
  }
36
36
  };
37
37
  }
38
38
  export function decode(input) {
39
39
  let ii = 0, oi = 0, cache;
40
- const out = new Uint8Array(Math.floor(input.length / 8 * 7));
41
- function update() {
42
- return cache = input.charCodeAt(ii++) || 0;
43
- }
40
+ const update = () => cache = input.charCodeAt(ii++), out = new Uint8Array(Math.floor(input.length / 8 * 7));
44
41
  while (ii < input.length) {
45
42
  // 0 1 2 3 4 5 6 7
46
43
  // in _0000000 _1111111 _2222222 _3333333 _4444444 _5555555 _6666666 _7777777
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "base128-ascii",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "main": "dist/index.js",
5
5
  "type": "module",
6
6
  "scripts": {