base128-ascii 2.1.3 → 2.1.5

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
25
25
  ```html
26
- <script src="https://cdn.jsdelivr.net/npm/base128-ascii/dist/browser.min.js"></script>
26
+ <script src="https://cdn.jsdelivr.net/npm/base128-ascii@latest/dist/browser.min.js"></script>
27
27
  ```
28
28
 
29
29
  #### JS
@@ -41,7 +41,7 @@ new Promise((rs) => {
41
41
  },
42
42
  });
43
43
  document.head.appendChild(document.createElement("script")).src =
44
- "https://cdn.jsdelivr.net/npm/base128-ascii/dist/browser.min.js";
44
+ "https://cdn.jsdelivr.net/npm/base128-ascii@latest/dist/browser.min.js";
45
45
  }).then(() => {
46
46
  console.log("base128 loaded!", self.base128);
47
47
  });
@@ -1 +1 @@
1
- var base128=(()=>{var s=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var w=(e,r)=>{for(var o in r)s(e,o,{get:r[o],enumerable:!0})},x=(e,r,o,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of d(r))!g.call(e,a)&&a!==o&&s(e,a,{get:()=>r[a],enumerable:!(t=i(r,a))||t.enumerable});return e};var A=e=>x(s({},"__esModule",{value:!0}),e);var S={};w(S,{EncodeOutput:()=>l,decode:()=>n,default:()=>f,encode:()=>h});var l=class{constructor(r){this.uint8Array=r}uint8Array;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 n(e){for(var r=new Uint8Array(Math.floor(e.length/8*7)),o=0,t=0,a,c=()=>(a=e.charCodeAt(o++))>>7?a=0:a;o<e.length;)r[t++]=c()<<1|c()>>6,r[t++]=a<<2|c()>>5,r[t++]=a<<3|c()>>4,r[t++]=a<<4|c()>>3,r[t++]=a<<5|c()>>2,r[t++]=a<<6|c()>>1,r[t++]=a<<7|c();return r}var y={EncodeOutput:l,encode:h,decode:n},f=y;return A(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/dist/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  export declare class EncodeOutput {
2
2
  constructor(out: Uint8Array);
3
- uint8Array: Uint8Array;
4
3
  toString(): string;
5
4
  toJSTemplateLiterals(): string;
6
5
  }
7
- export declare function encode(input: ArrayLike<number>): EncodeOutput;
6
+ type Uint8ArrayLike = ArrayLike<number>;
7
+ export declare function encode(input: Uint8ArrayLike): EncodeOutput;
8
8
  export declare function decode(input: string): Uint8Array;
9
9
  declare const base128: {
10
10
  EncodeOutput: typeof EncodeOutput;
package/dist/index.js CHANGED
@@ -2,7 +2,6 @@ export class EncodeOutput {
2
2
  constructor(out) {
3
3
  this.uint8Array = out;
4
4
  }
5
- uint8Array;
6
5
  toString() {
7
6
  return new TextDecoder().decode(this.uint8Array);
8
7
  }
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "base128-ascii",
3
- "version": "2.1.3",
3
+ "version": "2.1.5",
4
4
  "main": "dist/index.js",
5
5
  "browser": "dist/browser.min.js",
6
6
  "type": "module",
7
7
  "scripts": {
8
- "build": "rimraf dist && tsc && esbuild dist/index.js --bundle --global-name=base128 --minify --outfile=dist/browser.min.js",
9
- "test": "npm run build && node test.js",
8
+ "build": "rimraf dist && tsc && node scripts/build-for-browser.js",
9
+ "test": "npm run build && node scripts/test.js",
10
10
  "prepublishOnly": "npm run build"
11
11
  },
12
12
  "repository": {