base128-ascii 2.1.6 → 2.1.7
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 +3 -25
- package/dist/browser.min.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -19,32 +19,10 @@ const encodedTemplate = base128.encode(fs.readFileSync("example.gz")).toJSTempla
|
|
|
19
19
|
const decoded = base128.decode(eval(encodedTemplate))
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
-
### Browser
|
|
22
|
+
### Browser
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
<script src="https://cdn.jsdelivr.net/npm/base128-ascii@2.1.6/dist/browser.min.js"></script>
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
#### JS
|
|
30
|
-
```js
|
|
31
|
-
new Promise((rs) => {
|
|
32
|
-
if (self.base128?.EncodeOutput) return rs();
|
|
33
|
-
Object.defineProperty(self, "base128", {
|
|
34
|
-
configurable: true,
|
|
35
|
-
set(value) {
|
|
36
|
-
Object.defineProperty(this, "base128", {
|
|
37
|
-
configurable: true,
|
|
38
|
-
value,
|
|
39
|
-
});
|
|
40
|
-
rs();
|
|
41
|
-
},
|
|
42
|
-
});
|
|
43
|
-
document.head.appendChild(document.createElement("script")).src =
|
|
44
|
-
"https://cdn.jsdelivr.net/npm/base128-ascii@2.1.6/dist/browser.min.js";
|
|
45
|
-
}).then(() => {
|
|
46
|
-
console.log("base128 loaded!", self.base128);
|
|
47
|
-
});
|
|
24
|
+
```js browser
|
|
25
|
+
(()=>{var l=class{constructor(r){this.uint8Array=r}toString(){return new TextDecoder().decode(this.uint8Array)}toJSTemplateLiterals(){return`\`${this.toString().replace(/[\r\\`]|\${|<\/script/g,r=>r=="\r"?"\\r":r=="<\/script"?"<\\/script":"\\"+r)}\``}};function h(e){for(var r=new Uint8Array(Math.ceil(e.length/7*8)),o=0,t=0;o<e.length;)r[t++]=e[o]>>1,r[t++]=e[o++]<<6&127|e[o]>>2,r[t++]=e[o++]<<5&127|e[o]>>3,r[t++]=e[o++]<<4&127|e[o]>>4,r[t++]=e[o++]<<3&127|e[o]>>5,r[t++]=e[o++]<<2&127|e[o]>>6,r[t++]=e[o++]<<1&127|e[o]>>7,r[t++]=e[o++]&127;return new l(r)}function s(e){for(var r=new Uint8Array(Math.floor(e.length/8*7)),o=0,t=0,c,a=()=>(c=e.charCodeAt(o++))>>7?c=0:c;o<e.length;)r[t++]=a()<<1|a()>>6,r[t++]=c<<2|a()>>5,r[t++]=c<<3|a()>>4,r[t++]=c<<4|a()>>3,r[t++]=c<<5|a()>>2,r[t++]=c<<6|a()>>1,r[t++]=c<<7|a();return r}base128={EncodeOutput:l,encode:h,decode:s};})();
|
|
48
26
|
```
|
|
49
27
|
|
|
50
28
|
---
|
package/dist/browser.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{var l=class{constructor(r){this.uint8Array=r}toString(){return new TextDecoder().decode(this.uint8Array)}toJSTemplateLiterals(){return`\`${this.toString().replace(/[\r\\`]|\${|<\/script/g,r=>r=="\r"?"\\r":r=="<\/script"?"<\\/script":"\\"+r)}\``}};function h(e){for(var r=new Uint8Array(Math.ceil(e.length/7*8)),o=0,t=0;o<e.length;)r[t++]=e[o]>>1,r[t++]=e[o++]<<6&127|e[o]>>2,r[t++]=e[o++]<<5&127|e[o]>>3,r[t++]=e[o++]<<4&127|e[o]>>4,r[t++]=e[o++]<<3&127|e[o]>>5,r[t++]=e[o++]<<2&127|e[o]>>6,r[t++]=e[o++]<<1&127|e[o]>>7,r[t++]=e[o++]&127;return new l(r)}function s(e){for(var r=new Uint8Array(Math.floor(e.length/8*7)),o=0,t=0,c,a=()=>(c=e.charCodeAt(o++))>>7?c=0:c;o<e.length;)r[t++]=a()<<1|a()>>6,r[t++]=c<<2|a()>>5,r[t++]=c<<3|a()>>4,r[t++]=c<<4|a()>>3,r[t++]=c<<5|a()>>2,r[t++]=c<<6|a()>>1,r[t++]=c<<7|a();return r}base128={EncodeOutput:l,encode:h,decode:s};})()
|
|
1
|
+
(()=>{var l=class{constructor(r){this.uint8Array=r}toString(){return new TextDecoder().decode(this.uint8Array)}toJSTemplateLiterals(){return`\`${this.toString().replace(/[\r\\`]|\${|<\/script/g,r=>r=="\r"?"\\r":r=="<\/script"?"<\\/script":"\\"+r)}\``}};function h(e){for(var r=new Uint8Array(Math.ceil(e.length/7*8)),o=0,t=0;o<e.length;)r[t++]=e[o]>>1,r[t++]=e[o++]<<6&127|e[o]>>2,r[t++]=e[o++]<<5&127|e[o]>>3,r[t++]=e[o++]<<4&127|e[o]>>4,r[t++]=e[o++]<<3&127|e[o]>>5,r[t++]=e[o++]<<2&127|e[o]>>6,r[t++]=e[o++]<<1&127|e[o]>>7,r[t++]=e[o++]&127;return new l(r)}function s(e){for(var r=new Uint8Array(Math.floor(e.length/8*7)),o=0,t=0,c,a=()=>(c=e.charCodeAt(o++))>>7?c=0:c;o<e.length;)r[t++]=a()<<1|a()>>6,r[t++]=c<<2|a()>>5,r[t++]=c<<3|a()>>4,r[t++]=c<<4|a()>>3,r[t++]=c<<5|a()>>2,r[t++]=c<<6|a()>>1,r[t++]=c<<7|a();return r}base128={EncodeOutput:l,encode:h,decode:s};})();
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "base128-ascii",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.7",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"browser": "dist/browser.min.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"build": "
|
|
8
|
+
"build": "rimraf dist && tsc && node scripts/build-for-browser.js",
|
|
9
9
|
"test": "npm run build && node scripts/test.js",
|
|
10
10
|
"prepublishOnly": "npm run build"
|
|
11
11
|
},
|