Socket
Socket
Sign inDemoInstall

uint8arrays

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

uint8arrays - npm Package Compare versions

Comparing version 2.1.0 to 2.1.1

4

CHANGELOG.md

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

## [2.1.1](https://github.com/achingbrain/uint8arrays/compare/v2.1.0...v2.1.1) (2021-02-04)
# [2.1.0](https://github.com/achingbrain/uint8arrays/compare/v2.0.5...v2.1.0) (2021-02-04)

@@ -2,0 +6,0 @@

@@ -6,2 +6,3 @@ export const compare: typeof import("./compare");

export const toString: typeof import("./to-string");
export const xor: typeof import("./xor");
//# sourceMappingURL=index.d.ts.map

2

dist/index.min.js

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

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Uint8arrays=t():e.Uint8arrays=t()}(self,(function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=3)}([function(e,t,r){"use strict";const{TextEncoder:n,TextDecoder:o}=r(1),c=new o,i=new n;e.exports={decodeText:e=>c.decode(e),encodeText:e=>i.encode(e),concat:function(e,t){const r=new Uint8Array(t);let n=0;for(const o of e)r.set(o,n),n+=o.length;return r}}},function(e,t,r){"use strict";t.TextEncoder=TextEncoder,t.TextDecoder=TextDecoder},function(e,t,r){"use strict";const n=r(8),{encodeText:o,decodeText:c,concat:i}=r(0);function f(e){if(n.names[e])return n.names[e];if(n.codes[e])return n.codes[e];throw new Error("Unsupported encoding: "+e)}(t=e.exports=function(e,t){if(!t)throw new Error("requires an encoded Uint8Array");const{name:r,codeBuf:n}=f(e);return function(e,t){f(e).decode(c(t))}(r,t),i([n,t],n.length+t.length)}).encode=function(e,t){const r=f(e),n=o(r.encode(t));return i([r.codeBuf,n],r.codeBuf.length+n.length)},t.decode=function(e){e instanceof Uint8Array&&(e=c(e));const t=e[0];return["f","F","v","V","t","T","b","B","c","C","h","k","K"].includes(t)&&(e=e.toLowerCase()),f(e[0]).decode(e.substring(1))},t.isEncoded=function(e){if(e instanceof Uint8Array&&(e=c(e)),"[object String]"!==Object.prototype.toString.call(e))return!1;try{return f(e[0]).name}catch(t){return!1}},t.encoding=f,t.encodingFromData=function(e){return e instanceof Uint8Array&&(e=c(e)),f(e[0])},t.names=Object.freeze(n.names),t.codes=Object.freeze(n.codes)},function(e,t,r){"use strict";e.exports={compare:r(4),concat:r(5),equals:r(6),fromString:r(7),toString:r(12)}},function(e,t,r){"use strict";e.exports=function(e,t){for(let r=0;r<e.byteLength;r++){if(e[r]<t[r])return-1;if(e[r]>t[r])return 1}return e.byteLength>t.byteLength?1:e.byteLength<t.byteLength?-1:0}},function(e,t,r){"use strict";e.exports=function(e,t){t||(t=e.reduce((e,t)=>e+t.length,0));const r=new Uint8Array(t);let n=0;for(const o of e)r.set(o,n),n+=o.length;return r}},function(e,t,r){"use strict";e.exports=function(e,t){if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0}},function(e,t,r){"use strict";const{encoding:n}=r(2),{TextEncoder:o}=r(1),c=new o;e.exports=function(e,t="utf8"){return"utf8"===t||"utf-8"===t?c.encode(e):"ascii"===t?function(e){const t=new Uint8Array(e.length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}(e):n(t).decode(e)}},function(e,t,r){"use strict";const n=r(9),o=r(10),{rfc4648:c}=r(11),{decodeText:i,encodeText:f}=r(0),a=[["identity","\0",()=>({encode:i,decode:f}),""],["base2","0",c(1),"01"],["base8","7",c(3),"01234567"],["base10","9",n,"0123456789"],["base16","f",c(4),"0123456789abcdef"],["base16upper","F",c(4),"0123456789ABCDEF"],["base32hex","v",c(5),"0123456789abcdefghijklmnopqrstuv"],["base32hexupper","V",c(5),"0123456789ABCDEFGHIJKLMNOPQRSTUV"],["base32hexpad","t",c(5),"0123456789abcdefghijklmnopqrstuv="],["base32hexpadupper","T",c(5),"0123456789ABCDEFGHIJKLMNOPQRSTUV="],["base32","b",c(5),"abcdefghijklmnopqrstuvwxyz234567"],["base32upper","B",c(5),"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"],["base32pad","c",c(5),"abcdefghijklmnopqrstuvwxyz234567="],["base32padupper","C",c(5),"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567="],["base32z","h",c(5),"ybndrfg8ejkmcpqxot1uwisza345h769"],["base36","k",n,"0123456789abcdefghijklmnopqrstuvwxyz"],["base36upper","K",n,"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"],["base58btc","z",n,"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"],["base58flickr","Z",n,"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"],["base64","m",c(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"],["base64pad","M",c(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="],["base64url","u",c(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"],["base64urlpad","U",c(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_="]],u=a.reduce((e,t)=>(e[t[0]]=new o(t[0],t[1],t[2],t[3]),e),{}),s=a.reduce((e,t)=>(e[t[1]]=u[t[0]],e),{});e.exports={names:u,codes:s}},function(e,t,r){"use strict";e.exports=function(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),r=0;r<t.length;r++)t[r]=255;for(var n=0;n<e.length;n++){var o=e.charAt(n),c=o.charCodeAt(0);if(255!==t[c])throw new TypeError(o+" is ambiguous");t[c]=n}var i=e.length,f=e.charAt(0),a=Math.log(i)/Math.log(256),u=Math.log(256)/Math.log(i);function s(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;var r=0;if(" "!==e[r]){for(var n=0,o=0;e[r]===f;)n++,r++;for(var c=(e.length-r)*a+1>>>0,u=new Uint8Array(c);e[r];){var s=t[e.charCodeAt(r)];if(255===s)return;for(var d=0,h=c-1;(0!==s||d<o)&&-1!==h;h--,d++)s+=i*u[h]>>>0,u[h]=s%256>>>0,s=s/256>>>0;if(0!==s)throw new Error("Non-zero carry");o=d,r++}if(" "!==e[r]){for(var l=c-o;l!==c&&0===u[l];)l++;for(var p=new Uint8Array(n+(c-l)),b=n;l!==c;)p[b++]=u[l++];return p}}}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var r=0,n=0,o=0,c=t.length;o!==c&&0===t[o];)o++,r++;for(var a=(c-o)*u+1>>>0,s=new Uint8Array(a);o!==c;){for(var d=t[o],h=0,l=a-1;(0!==d||h<n)&&-1!==l;l--,h++)d+=256*s[l]>>>0,s[l]=d%i>>>0,d=d/i>>>0;if(0!==d)throw new Error("Non-zero carry");n=h,o++}for(var p=a-n;p!==a&&0===s[p];)p++;for(var b=f.repeat(r);p<a;++p)b+=e.charAt(s[p]);return b},decodeUnsafe:s,decode:function(e){var t=s(e);if(t)return t;throw new Error("Non-base"+i+" character")}}}},function(e,t,r){"use strict";const{encodeText:n}=r(0);e.exports=class{constructor(e,t,r,o){this.name=e,this.code=t,this.codeBuf=n(this.code),this.alphabet=o,this.codec=r(o)}encode(e){return this.codec.encode(e)}decode(e){for(const t of e)if(this.alphabet&&this.alphabet.indexOf(t)<0)throw new Error(`invalid character '${t}' in '${e}'`);return this.codec.decode(e)}}},function(e,t,r){"use strict";e.exports={rfc4648:e=>t=>({encode:r=>((e,t,r)=>{const n="="===t[t.length-1],o=(1<<r)-1;let c="",i=0,f=0;for(let a=0;a<e.length;++a)for(f=f<<8|e[a],i+=8;i>r;)i-=r,c+=t[o&f>>i];if(i&&(c+=t[o&f<<r-i]),n)for(;c.length*r&7;)c+="=";return c})(r,t,e),decode:r=>((e,t,r)=>{const n={};for(let u=0;u<t.length;++u)n[t[u]]=u;let o=e.length;for(;"="===e[o-1];)--o;const c=new Uint8Array(o*r/8|0);let i=0,f=0,a=0;for(let u=0;u<o;++u){const t=n[e[u]];if(void 0===t)throw new SyntaxError("Invalid character "+e[u]);f=f<<r|t,i+=r,i>=8&&(i-=8,c[a++]=255&f>>i)}if(i>=r||255&f<<8-i)throw new SyntaxError("Unexpected end of data");return c})(r,t,e)})}},function(e,t,r){"use strict";const{encoding:n}=r(2),{TextDecoder:o}=r(1),c=new o("utf8");e.exports=function(e,t="utf8"){return"utf8"===t||"utf-8"===t?c.decode(e):"ascii"===t?function(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t}(e):n(t).encode(e)}}])}));
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Uint8arrays=t():e.Uint8arrays=t()}(self,(function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=3)}([function(e,t,r){"use strict";const{TextEncoder:n,TextDecoder:o}=r(1),c=new o,i=new n;e.exports={decodeText:e=>c.decode(e),encodeText:e=>i.encode(e),concat:function(e,t){const r=new Uint8Array(t);let n=0;for(const o of e)r.set(o,n),n+=o.length;return r}}},function(e,t,r){"use strict";t.TextEncoder=TextEncoder,t.TextDecoder=TextDecoder},function(e,t,r){"use strict";const n=r(8),{encodeText:o,decodeText:c,concat:i}=r(0);function f(e){if(n.names[e])return n.names[e];if(n.codes[e])return n.codes[e];throw new Error("Unsupported encoding: "+e)}(t=e.exports=function(e,t){if(!t)throw new Error("requires an encoded Uint8Array");const{name:r,codeBuf:n}=f(e);return function(e,t){f(e).decode(c(t))}(r,t),i([n,t],n.length+t.length)}).encode=function(e,t){const r=f(e),n=o(r.encode(t));return i([r.codeBuf,n],r.codeBuf.length+n.length)},t.decode=function(e){e instanceof Uint8Array&&(e=c(e));const t=e[0];return["f","F","v","V","t","T","b","B","c","C","h","k","K"].includes(t)&&(e=e.toLowerCase()),f(e[0]).decode(e.substring(1))},t.isEncoded=function(e){if(e instanceof Uint8Array&&(e=c(e)),"[object String]"!==Object.prototype.toString.call(e))return!1;try{return f(e[0]).name}catch(t){return!1}},t.encoding=f,t.encodingFromData=function(e){return e instanceof Uint8Array&&(e=c(e)),f(e[0])},t.names=Object.freeze(n.names),t.codes=Object.freeze(n.codes)},function(e,t,r){"use strict";e.exports={compare:r(4),concat:r(5),equals:r(6),fromString:r(7),toString:r(12),xor:r(13)}},function(e,t,r){"use strict";e.exports=function(e,t){for(let r=0;r<e.byteLength;r++){if(e[r]<t[r])return-1;if(e[r]>t[r])return 1}return e.byteLength>t.byteLength?1:e.byteLength<t.byteLength?-1:0}},function(e,t,r){"use strict";e.exports=function(e,t){t||(t=e.reduce((e,t)=>e+t.length,0));const r=new Uint8Array(t);let n=0;for(const o of e)r.set(o,n),n+=o.length;return r}},function(e,t,r){"use strict";e.exports=function(e,t){if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0}},function(e,t,r){"use strict";const{encoding:n}=r(2),{TextEncoder:o}=r(1),c=new o;e.exports=function(e,t="utf8"){return"utf8"===t||"utf-8"===t?c.encode(e):"ascii"===t?function(e){const t=new Uint8Array(e.length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}(e):n(t).decode(e)}},function(e,t,r){"use strict";const n=r(9),o=r(10),{rfc4648:c}=r(11),{decodeText:i,encodeText:f}=r(0),u=[["identity","\0",()=>({encode:i,decode:f}),""],["base2","0",c(1),"01"],["base8","7",c(3),"01234567"],["base10","9",n,"0123456789"],["base16","f",c(4),"0123456789abcdef"],["base16upper","F",c(4),"0123456789ABCDEF"],["base32hex","v",c(5),"0123456789abcdefghijklmnopqrstuv"],["base32hexupper","V",c(5),"0123456789ABCDEFGHIJKLMNOPQRSTUV"],["base32hexpad","t",c(5),"0123456789abcdefghijklmnopqrstuv="],["base32hexpadupper","T",c(5),"0123456789ABCDEFGHIJKLMNOPQRSTUV="],["base32","b",c(5),"abcdefghijklmnopqrstuvwxyz234567"],["base32upper","B",c(5),"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"],["base32pad","c",c(5),"abcdefghijklmnopqrstuvwxyz234567="],["base32padupper","C",c(5),"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567="],["base32z","h",c(5),"ybndrfg8ejkmcpqxot1uwisza345h769"],["base36","k",n,"0123456789abcdefghijklmnopqrstuvwxyz"],["base36upper","K",n,"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"],["base58btc","z",n,"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"],["base58flickr","Z",n,"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"],["base64","m",c(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"],["base64pad","M",c(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="],["base64url","u",c(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"],["base64urlpad","U",c(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_="]],a=u.reduce((e,t)=>(e[t[0]]=new o(t[0],t[1],t[2],t[3]),e),{}),s=u.reduce((e,t)=>(e[t[1]]=a[t[0]],e),{});e.exports={names:a,codes:s}},function(e,t,r){"use strict";e.exports=function(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),r=0;r<t.length;r++)t[r]=255;for(var n=0;n<e.length;n++){var o=e.charAt(n),c=o.charCodeAt(0);if(255!==t[c])throw new TypeError(o+" is ambiguous");t[c]=n}var i=e.length,f=e.charAt(0),u=Math.log(i)/Math.log(256),a=Math.log(256)/Math.log(i);function s(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;var r=0;if(" "!==e[r]){for(var n=0,o=0;e[r]===f;)n++,r++;for(var c=(e.length-r)*u+1>>>0,a=new Uint8Array(c);e[r];){var s=t[e.charCodeAt(r)];if(255===s)return;for(var d=0,h=c-1;(0!==s||d<o)&&-1!==h;h--,d++)s+=i*a[h]>>>0,a[h]=s%256>>>0,s=s/256>>>0;if(0!==s)throw new Error("Non-zero carry");o=d,r++}if(" "!==e[r]){for(var l=c-o;l!==c&&0===a[l];)l++;for(var p=new Uint8Array(n+(c-l)),b=n;l!==c;)p[b++]=a[l++];return p}}}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var r=0,n=0,o=0,c=t.length;o!==c&&0===t[o];)o++,r++;for(var u=(c-o)*a+1>>>0,s=new Uint8Array(u);o!==c;){for(var d=t[o],h=0,l=u-1;(0!==d||h<n)&&-1!==l;l--,h++)d+=256*s[l]>>>0,s[l]=d%i>>>0,d=d/i>>>0;if(0!==d)throw new Error("Non-zero carry");n=h,o++}for(var p=u-n;p!==u&&0===s[p];)p++;for(var b=f.repeat(r);p<u;++p)b+=e.charAt(s[p]);return b},decodeUnsafe:s,decode:function(e){var t=s(e);if(t)return t;throw new Error("Non-base"+i+" character")}}}},function(e,t,r){"use strict";const{encodeText:n}=r(0);e.exports=class{constructor(e,t,r,o){this.name=e,this.code=t,this.codeBuf=n(this.code),this.alphabet=o,this.codec=r(o)}encode(e){return this.codec.encode(e)}decode(e){for(const t of e)if(this.alphabet&&this.alphabet.indexOf(t)<0)throw new Error(`invalid character '${t}' in '${e}'`);return this.codec.decode(e)}}},function(e,t,r){"use strict";e.exports={rfc4648:e=>t=>({encode:r=>((e,t,r)=>{const n="="===t[t.length-1],o=(1<<r)-1;let c="",i=0,f=0;for(let u=0;u<e.length;++u)for(f=f<<8|e[u],i+=8;i>r;)i-=r,c+=t[o&f>>i];if(i&&(c+=t[o&f<<r-i]),n)for(;c.length*r&7;)c+="=";return c})(r,t,e),decode:r=>((e,t,r)=>{const n={};for(let a=0;a<t.length;++a)n[t[a]]=a;let o=e.length;for(;"="===e[o-1];)--o;const c=new Uint8Array(o*r/8|0);let i=0,f=0,u=0;for(let a=0;a<o;++a){const t=n[e[a]];if(void 0===t)throw new SyntaxError("Invalid character "+e[a]);f=f<<r|t,i+=r,i>=8&&(i-=8,c[u++]=255&f>>i)}if(i>=r||255&f<<8-i)throw new SyntaxError("Unexpected end of data");return c})(r,t,e)})}},function(e,t,r){"use strict";const{encoding:n}=r(2),{TextDecoder:o}=r(1),c=new o("utf8");e.exports=function(e,t="utf8"){return"utf8"===t||"utf-8"===t?c.decode(e):"ascii"===t?function(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t}(e):n(t).encode(e)}},function(e,t,r){"use strict";e.exports=function(e,t){if(e.length!==t.length)throw new Error("Inputs should have the same length");const r=new Uint8Array(e.length);for(let n=0;n<e.length;n++)r[n]=e[n]^t[n];return r}}])}));

@@ -8,3 +8,4 @@ 'use strict'

fromString: require('./from-string'),
toString: require('./to-string')
toString: require('./to-string'),
xor: require('./xor')
}
{
"name": "uint8arrays",
"version": "2.1.0",
"version": "2.1.1",
"description": "Utility functions to make dealing with Uint8Arrays easier",

@@ -5,0 +5,0 @@ "main": "index.js",

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