base128-ascii 2.1.11 → 2.1.12

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/README.md CHANGED
@@ -23,7 +23,7 @@ const decoded = base128.decode(eval(encodedTemplate))
23
23
 
24
24
  ```html browser
25
25
  <script>
26
- {class EncodeOutput{constructor(t){this.uint8Array=t}toString(){return(new TextDecoder).decode(this.uint8Array)}toJSTemplateLiterals(){return`\`${this.toString().replace(/[\r\\`]|\${|<\/script/g,t=>"\r"==t?"\\r":"<\/script"==t?"<\\/script":"\\"+t)}\``}}this.base128={EncodeOutput,encode(t){"string"==typeof t&&(t=(new TextEncoder).encode(t));for(var e=t.length,r=new Uint8Array(Math.ceil(e/7*8)),n=0,o=0;n<e;)r[o++]=t[n]>>1&127,r[o++]=127&(t[n++]<<6|t[n]>>2),r[o++]=127&(t[n++]<<5|t[n]>>3),r[o++]=127&(t[n++]<<4|t[n]>>4),r[o++]=127&(t[n++]<<3|t[n]>>5),r[o++]=127&(t[n++]<<2|t[n]>>6),r[o++]=127&(t[n++]<<1|t[n]>>7),r[o++]=127&t[n++];return new EncodeOutput(r)},decode(t){for(var e,r=t.length,n=new Uint8Array(Math.floor(r/8*7)),o=0,c=0,i=()=>(e=t.charCodeAt(o++))>127?e=0:e;o<r;)n[c++]=i()<<1|i()>>6,n[c++]=e<<2|i()>>5,n[c++]=e<<3|i()>>4,n[c++]=e<<4|i()>>3,n[c++]=e<<5|i()>>2,n[c++]=e<<6|i()>>1,n[c++]=e<<7|i();return n}}}
26
+ {class EncodeOutput{constructor(t){this.uint8Array=t}toString(){return(new TextDecoder).decode(this.uint8Array)}toJSTemplateLiterals(){return`\`${this.toString().replace(/[\r\\`]|\${|<\/script/g,t=>"\r"==t?"\\r":"<\/script"==t?"<\\/script":"\\"+t)}\``}}this.base128={EncodeOutput,encode(t){"string"==typeof t&&(t=(new TextEncoder).encode(t));for(var e=t.length,r=new Uint8Array(Math.ceil(e/7*8)),n=0,c=0;n<e;)r[c++]=t[n]>>1&127,r[c++]=127&(t[n++]<<6|t[n]>>2),r[c++]=127&(t[n++]<<5|t[n]>>3),r[c++]=127&(t[n++]<<4|t[n]>>4),r[c++]=127&(t[n++]<<3|t[n]>>5),r[c++]=127&(t[n++]<<2|t[n]>>6),r[c++]=127&(t[n++]<<1|t[n]>>7),r[c++]=127&t[n++];return new EncodeOutput(r)},decode(t){for(var e,r=t.length,n=new Uint8Array(r/8*7),c=0,o=0,i=()=>(e=t.charCodeAt(c++))>127?e=0:e;c<r;)n[o++]=i()<<1|i()>>6,n[o++]=e<<2|i()>>5,n[o++]=e<<3|i()>>4,n[o++]=e<<4|i()>>3,n[o++]=e<<5|i()>>2,n[o++]=e<<6|i()>>1,n[o++]=e<<7|i();return n}}}
27
27
  </script>
28
28
  ```
29
29
 
@@ -1 +1 @@
1
- {class EncodeOutput{constructor(t){this.uint8Array=t}toString(){return(new TextDecoder).decode(this.uint8Array)}toJSTemplateLiterals(){return`\`${this.toString().replace(/[\r\\`]|\${|<\/script/g,t=>"\r"==t?"\\r":"<\/script"==t?"<\\/script":"\\"+t)}\``}}this.base128={EncodeOutput,encode(t){"string"==typeof t&&(t=(new TextEncoder).encode(t));for(var e=t.length,r=new Uint8Array(Math.ceil(e/7*8)),n=0,o=0;n<e;)r[o++]=t[n]>>1&127,r[o++]=127&(t[n++]<<6|t[n]>>2),r[o++]=127&(t[n++]<<5|t[n]>>3),r[o++]=127&(t[n++]<<4|t[n]>>4),r[o++]=127&(t[n++]<<3|t[n]>>5),r[o++]=127&(t[n++]<<2|t[n]>>6),r[o++]=127&(t[n++]<<1|t[n]>>7),r[o++]=127&t[n++];return new EncodeOutput(r)},decode(t){for(var e,r=t.length,n=new Uint8Array(Math.floor(r/8*7)),o=0,c=0,i=()=>(e=t.charCodeAt(o++))>127?e=0:e;o<r;)n[c++]=i()<<1|i()>>6,n[c++]=e<<2|i()>>5,n[c++]=e<<3|i()>>4,n[c++]=e<<4|i()>>3,n[c++]=e<<5|i()>>2,n[c++]=e<<6|i()>>1,n[c++]=e<<7|i();return n}}}
1
+ {class EncodeOutput{constructor(t){this.uint8Array=t}toString(){return(new TextDecoder).decode(this.uint8Array)}toJSTemplateLiterals(){return`\`${this.toString().replace(/[\r\\`]|\${|<\/script/g,t=>"\r"==t?"\\r":"<\/script"==t?"<\\/script":"\\"+t)}\``}}this.base128={EncodeOutput,encode(t){"string"==typeof t&&(t=(new TextEncoder).encode(t));for(var e=t.length,r=new Uint8Array(Math.ceil(e/7*8)),n=0,c=0;n<e;)r[c++]=t[n]>>1&127,r[c++]=127&(t[n++]<<6|t[n]>>2),r[c++]=127&(t[n++]<<5|t[n]>>3),r[c++]=127&(t[n++]<<4|t[n]>>4),r[c++]=127&(t[n++]<<3|t[n]>>5),r[c++]=127&(t[n++]<<2|t[n]>>6),r[c++]=127&(t[n++]<<1|t[n]>>7),r[c++]=127&t[n++];return new EncodeOutput(r)},decode(t){for(var e,r=t.length,n=new Uint8Array(r/8*7),c=0,o=0,i=()=>(e=t.charCodeAt(c++))>127?e=0:e;c<r;)n[o++]=i()<<1|i()>>6,n[o++]=e<<2|i()>>5,n[o++]=e<<3|i()>>4,n[o++]=e<<4|i()>>3,n[o++]=e<<5|i()>>2,n[o++]=e<<6|i()>>1,n[o++]=e<<7|i();return n}}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "base128-ascii",
3
- "version": "2.1.11",
3
+ "version": "2.1.12",
4
4
  "type": "commonjs",
5
5
  "main": "./src/main.js",
6
6
  "module": "./src/module.mjs",
package/src/main.js CHANGED
@@ -59,7 +59,7 @@ module.exports = {
59
59
  */
60
60
  decode(input) {
61
61
  var il = input.length
62
- , out = new Uint8Array(Math.floor(il / 8 * 7))
62
+ , out = new Uint8Array(il / 8 * 7)
63
63
  , ii = 0
64
64
  , oi = 0
65
65
  , cache
package/src/module.mjs CHANGED
@@ -56,7 +56,7 @@ export function encode(input) {
56
56
  */
57
57
  export function decode(input) {
58
58
  var il = input.length
59
- , out = new Uint8Array(Math.floor(il / 8 * 7))
59
+ , out = new Uint8Array(il / 8 * 7)
60
60
  , ii = 0
61
61
  , oi = 0
62
62
  , cache