Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@hexagon/base64

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hexagon/base64 - npm Package Compare versions

Comparing version 2.0.2 to 2.0.3

3

dist/base64.d.ts

@@ -12,4 +12,3 @@ /**

/**
* Convenience
function for creating a base64 encoded string from an ArrayBuffer instance
* Convenience function for creating a base64 encoded string from an ArrayBuffer instance
* @public

@@ -16,0 +15,0 @@ *

@@ -1,1 +0,1 @@

var a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",b="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",y=n=>{let t=typeof Uint8Array>"u"?[]:new Uint8Array(256),o=a.length;for(let e=0;e<o;e++)t[n.charCodeAt(e)]=e;return t},p=y(a),m=y(b),w=/^[-A-Za-z0-9\-_]*$/,d=/^[-A-Za-z0-9+/]*={0,3}$/;function h(n,t){let o=n.length,e=n.length*.75,r,i=0,s,c,u,g;n[n.length-1]==="="&&(e--,n[n.length-2]==="="&&e--);let A=new ArrayBuffer(e),l=new Uint8Array(A),f=t?m:p;for(r=0;r<o;r+=4)s=f[n.charCodeAt(r)],c=f[n.charCodeAt(r+1)],u=f[n.charCodeAt(r+2)],g=f[n.charCodeAt(r+3)],l[i++]=s<<2|c>>4,l[i++]=(c&15)<<4|u>>2,l[i++]=(u&3)<<6|g&63;return A}function U(n,t){let o=new Uint8Array(n),e,r="",i=o.length,s=t?b:a;for(e=0;e<i;e+=3)r+=s[o[e]>>2],r+=s[(o[e]&3)<<4|o[e+1]>>4],r+=s[(o[e+1]&15)<<2|o[e+2]>>6],r+=s[o[e+2]&63];let c=i%3;return c===2?r=r.substring(0,r.length-1)+(t?"":"="):c===1&&(r=r.substring(0,r.length-2)+(t?"":"==")),r}function k(n,t){return new TextDecoder().decode(h(n,t))}function B(n,t){return U(new TextEncoder().encode(n),t)}function C(n,t){if(!(typeof n=="string"||n instanceof String))return!1;try{return t?w.test(n):d.test(n)}catch{return!1}}var x={toString:k,fromString:B,toArrayBuffer:h,fromArrayBuffer:U,validate:C};export{x as base64,U as fromArrayBuffer,B as fromString,h as toArrayBuffer,k as toString,C as validate};
var l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",y="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",b=r=>{let t=typeof Uint8Array>"u"?[]:new Uint8Array(256),o=l.length;for(let e=0;e<o;e++)t[r.charCodeAt(e)]=e;return t},m=b(l),p=b(y),w=/^[-A-Za-z0-9\-_]*$/,B=/^[-A-Za-z0-9+/]*={0,3}$/;function h(r,t){let o=r.length,e=r.length*.75,n,f=0,s,i,a,g;r[r.length-1]==="="&&(e--,r[r.length-2]==="="&&e--);let A=new ArrayBuffer(e),u=new Uint8Array(A),c=t?p:m;for(n=0;n<o;n+=4)s=c[r.charCodeAt(n)],i=c[r.charCodeAt(n+1)],a=c[r.charCodeAt(n+2)],g=c[r.charCodeAt(n+3)],u[f++]=s<<2|i>>4,u[f++]=(i&15)<<4|a>>2,u[f++]=(a&3)<<6|g&63;return A}function U(r,t){let o=new Uint8Array(r),e,n="",f=o.length,s=t?y:l;for(e=0;e<f;e+=3)n+=s[o[e]>>2],n+=s[(o[e]&3)<<4|o[e+1]>>4],n+=s[(o[e+1]&15)<<2|o[e+2]>>6],n+=s[o[e+2]&63];let i=f%3;return i===2?n=n.substring(0,n.length-1)+(t?"":"="):i===1&&(n=n.substring(0,n.length-2)+(t?"":"==")),n}function d(r,t){return new TextDecoder().decode(h(r,t))}function k(r,t){return U(new TextEncoder().encode(r),t)}function C(r,t){if(!(typeof r=="string"||r instanceof String))return!1;try{return t?w.test(r):B.test(r)}catch{return!1}}var S={toString:d,fromString:k,toArrayBuffer:h,fromArrayBuffer:U,validate:C};export{S as base64,U as fromArrayBuffer,k as fromString,h as toArrayBuffer,d as toString,C as validate};

@@ -1,1 +0,1 @@

var base64=(()=>{var a=Object.defineProperty;var k=Object.getOwnPropertyDescriptor;var B=Object.getOwnPropertyNames;var C=Object.prototype.hasOwnProperty;var x=(n,e)=>{for(var o in e)a(n,o,{get:e[o],enumerable:!0})},S=(n,e,o,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of B(e))!C.call(n,r)&&r!==o&&a(n,r,{get:()=>e[r],enumerable:!(t=k(e,r))||t.enumerable});return n};var T=n=>S(a({},"__esModule",{value:!0}),n);var D={};x(D,{base64:()=>v,fromArrayBuffer:()=>b,fromString:()=>w,toArrayBuffer:()=>A,toString:()=>m,validate:()=>d});var g="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",U="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",p=n=>{let e=typeof Uint8Array>"u"?[]:new Uint8Array(256),o=g.length;for(let t=0;t<o;t++)e[n.charCodeAt(t)]=t;return e},z=p(g),L=p(U),P=/^[-A-Za-z0-9\-_]*$/,Z=/^[-A-Za-z0-9+/]*={0,3}$/;function A(n,e){let o=n.length,t=n.length*.75,r,i=0,s,c,u,y;n[n.length-1]==="="&&(t--,n[n.length-2]==="="&&t--);let h=new ArrayBuffer(t),l=new Uint8Array(h),f=e?L:z;for(r=0;r<o;r+=4)s=f[n.charCodeAt(r)],c=f[n.charCodeAt(r+1)],u=f[n.charCodeAt(r+2)],y=f[n.charCodeAt(r+3)],l[i++]=s<<2|c>>4,l[i++]=(c&15)<<4|u>>2,l[i++]=(u&3)<<6|y&63;return h}function b(n,e){let o=new Uint8Array(n),t,r="",i=o.length,s=e?U:g;for(t=0;t<i;t+=3)r+=s[o[t]>>2],r+=s[(o[t]&3)<<4|o[t+1]>>4],r+=s[(o[t+1]&15)<<2|o[t+2]>>6],r+=s[o[t+2]&63];let c=i%3;return c===2?r=r.substring(0,r.length-1)+(e?"":"="):c===1&&(r=r.substring(0,r.length-2)+(e?"":"==")),r}function m(n,e){return new TextDecoder().decode(A(n,e))}function w(n,e){return b(new TextEncoder().encode(n),e)}function d(n,e){if(!(typeof n=="string"||n instanceof String))return!1;try{return e?P.test(n):Z.test(n)}catch{return!1}}var v={toString:m,fromString:w,toArrayBuffer:A,fromArrayBuffer:b,validate:d};return T(D);})();
var base64=(()=>{var l=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames;var C=Object.prototype.hasOwnProperty;var S=(r,e)=>{for(var o in e)l(r,o,{get:e[o],enumerable:!0})},x=(r,e,o,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of k(e))!C.call(r,n)&&n!==o&&l(r,n,{get:()=>e[n],enumerable:!(t=d(e,n))||t.enumerable});return r};var T=r=>x(l({},"__esModule",{value:!0}),r);var D={};S(D,{base64:()=>Z,fromArrayBuffer:()=>y,fromString:()=>w,toArrayBuffer:()=>A,toString:()=>p,validate:()=>B});var g="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",U="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",m=r=>{let e=typeof Uint8Array>"u"?[]:new Uint8Array(256),o=g.length;for(let t=0;t<o;t++)e[r.charCodeAt(t)]=t;return e},v=m(g),z=m(U),L=/^[-A-Za-z0-9\-_]*$/,P=/^[-A-Za-z0-9+/]*={0,3}$/;function A(r,e){let o=r.length,t=r.length*.75,n,f=0,s,i,a,b;r[r.length-1]==="="&&(t--,r[r.length-2]==="="&&t--);let h=new ArrayBuffer(t),u=new Uint8Array(h),c=e?z:v;for(n=0;n<o;n+=4)s=c[r.charCodeAt(n)],i=c[r.charCodeAt(n+1)],a=c[r.charCodeAt(n+2)],b=c[r.charCodeAt(n+3)],u[f++]=s<<2|i>>4,u[f++]=(i&15)<<4|a>>2,u[f++]=(a&3)<<6|b&63;return h}function y(r,e){let o=new Uint8Array(r),t,n="",f=o.length,s=e?U:g;for(t=0;t<f;t+=3)n+=s[o[t]>>2],n+=s[(o[t]&3)<<4|o[t+1]>>4],n+=s[(o[t+1]&15)<<2|o[t+2]>>6],n+=s[o[t+2]&63];let i=f%3;return i===2?n=n.substring(0,n.length-1)+(e?"":"="):i===1&&(n=n.substring(0,n.length-2)+(e?"":"==")),n}function p(r,e){return new TextDecoder().decode(A(r,e))}function w(r,e){return y(new TextEncoder().encode(r),e)}function B(r,e){if(!(typeof r=="string"||r instanceof String))return!1;try{return e?L.test(r):P.test(r)}catch{return!1}}var Z={toString:p,fromString:w,toArrayBuffer:A,fromArrayBuffer:y,validate:B};return T(D);})();

@@ -52,3 +52,3 @@ {

"name": "@hexagon/base64",
"version": "2.0.2"
"version": "2.0.3"
}

@@ -41,5 +41,5 @@ <p align="center">

Deno (x): `import { base64 } from "https://deno.land/x/b64@2.0.0/src/base64.ts";`
Deno (x): `import { base64 } from "https://deno.land/x/b64@2.0.2/src/base64.ts";`
Deno (jsr.io): `import { base64 } from "jsr:@hexagon/base64@2.0.0";`
Deno (jsr.io): `import { base64 } from "jsr:@hexagon/base64@2.0.2";`

@@ -46,0 +46,0 @@ For browser/cdn usage, refer to the documentation.

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc