fastestsmallesttextencoderdecoder-encodeinto
Advanced tools
Comparing version
@@ -1,6 +0,6 @@ | ||
'use strict';(function(g){function x(a){var b=a.charCodeAt(0),c=1114112,d=0,e=a.length|0,f="";switch(b>>>4){case 12:case 13:c=(b&31)<<6|a.charCodeAt(1)&63;d=128>c?0:2;break;case 14:c=(b&15)<<12|(a.charCodeAt(1)&63)<<6|a.charCodeAt(2)&63;d=2048>c?0:3;break;case 15:30===b>>>3&&(c=(b&7)<<18|(a.charCodeAt(1)&63)<<12|(a.charCodeAt(2)&63)<<6|a.charCodeAt(3),d=65536>c?0:4)}d&&(e<d?d=0:65536>c?f=h(c):1114112>c?(c=c-65664|0,f=h((c>>>10)+55296|0,(c&1023)+56320|0)):d=0);for(;d<e;d=d+1|0)f+="\ufffd";return f} | ||
function q(){}function r(a){var b=a.charCodeAt(0)|0;if(55296<=b&&56319>=b)if(a=a.charCodeAt(1)|0,56320<=a&&57343>=a){if(b=(b<<10)+a-56613888|0,65535<b)return h(240|b>>>18,128|b>>>12&63,128|b>>>6&63,128|b&63)}else b=65533;return 2047>=b?h(192|b>>>6,128|b&63):h(224|b>>>12,128|b>>>6&63,128|b&63)}function t(){}function u(a,b){var c=void 0===a?"":(""+a).replace(/[\x80-\uD7ff\uDC00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]?/g,r),d=c.length|0,e=0,f=0,l=b.length|0,v=a.length|0;l<d&&(d=l);a:for(;e<d;e=e+1|0){a= | ||
c.charCodeAt(e)|0;switch(a>>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:f=f+1|0;case 8:case 9:case 10:case 11:break;case 12:case 13:if((e+1|0)<l){f=f+1|0;break}case 14:if((e+2|0)<l){f=f+1|0;break}case 15:if((e+3|0)<l){f=f+1|0;break}default:break a}b[e]=a}return{written:e,read:v<f?v:f}}var h=String.fromCharCode,n={}.toString,k=g.SharedArrayBuffer,y=k?n.call(k):"",m=g.Uint8Array,p=m||Array,z=n.call((m?ArrayBuffer:p).prototype),w=t.prototype;k=g.TextEncoder;q.prototype.decode=function(a){var b= | ||
a&&a.buffer||a,c=n.call(b);if(c!==z&&c!==y&&void 0!==a)throw TypeError("Failed to execute 'decode' on 'TextDecoder': The provided value is not of type '(ArrayBuffer or ArrayBufferView)'");a=m?new p(b):b;b="";c=0;for(var d=a.length|0;c<d;c=c+32768|0)b+=h.apply(0,a[m?"subarray":"slice"](c,c+32768|0));return b.replace(/[\xc0-\xff][\x80-\xbf]+|[\x80-\xff]/g,x)};g.TextDecoder||(g.TextDecoder=q);w.encode=function(a){a=void 0===a?"":(""+a).replace(/[\x80-\uD7ff\uDC00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]?/g, | ||
r);for(var b=a.length|0,c=new p(b),d=0;d<b;d=d+1|0)c[d]=a.charCodeAt(d);return c};w.encodeInto=u;if(!k)g.TextEncoder=t;else if(!(g=k.prototype).encodeInto){var A=new k;g.encodeInto=function(a,b){var c=a.length|0,d=b.length|0;if(c<d>>1){var e=A.encode(a);if((e.length|0)<d)return b.set(e),{read:c,written:e.length|0}}return u(a,b)}}})("undefined"==typeof global?"undefined"==typeof self?this:self:global);//AnonyCo | ||
'use strict';(function(m){function x(){}function y(a){var b=a.charCodeAt(0)|0;if(55296<=b&&56319>=b)if(a=a.charCodeAt(1)|0,56320<=a&&57343>=a){if(b=(b<<10)+a-56613888|0,65535<b)return u(240|b>>>18,128|b>>>12&63,128|b>>>6&63,128|b&63)}else b=65533;return 2047>=b?u(192|b>>>6,128|b&63):u(224|b>>>12,128|b>>>6&63,128|b&63)}function z(){}function A(a,b){var e=void 0===a?"":(""+a).replace(B,y),f=e.length|0,d=0,c=0,l=b.length|0,h=a.length|0;l<f&&(f=l);a:for(;d<f;d=d+1|0){a=e.charCodeAt(d)|0;switch(a>>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:c= | ||
c+1|0;case 8:case 9:case 10:case 11:break;case 12:case 13:if((d+1|0)<l){c=c+1|0;break}case 14:if((d+2|0)<l){c=c+1|0;break}case 15:if((d+3|0)<l){c=c+1|0;break}default:break a}b[d]=a}return{written:d,read:h<c?h:c}}var u=String.fromCharCode,v={}.toString,D=v.call(m.SharedArrayBuffer),E=v(),t=m.Uint8Array,w=t||Array,r=t?ArrayBuffer:w,F=r.isView||function(a){return a&&"length"in a},G=v.call(r.prototype),C=z.prototype;r=m.TextEncoder;var B=/[\x80-\uD7ff\uDC00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]?/g,p= | ||
new (t?Uint16Array:w)(8192);x.prototype.decode=function(a){if(!F(a)){var b=v.call(a);if(b!==G&&b!==D&&b!==E)throw TypeError("Failed to execute 'decode' on 'TextDecoder': The provided value is not of type '(ArrayBuffer or ArrayBufferView)'");a=t?new w(a):a||[]}b="";for(var e=0,f=a.length|0,d,c=0,l=31,h=0,q=0,k,g=0,n=0;e<f;){for(;e<f&&8192>g;e=e+1|0,g=g+1|0)switch(d=a[e]&255,d>>>4){case 15:l>>>=1,k=a[e=e+1|0]&255,c=k&63,q=2===k>>>6&&248>d?5:20,h=6;case 14:l>>>=1,k=a[e=e+1|0]&255,c<<=6,c|=k&63,q=2=== | ||
k>>>6?q+4|0:24,h=h+6|0;case 13:case 12:k=a[e=e+1|0]&255,c<<=6,c|=k&63,q=2===k>>>6?q+7|0:31,h=h+6|0,c|=(d&l)<<h,e<f&&c>>>q&&1114112>c?(d=c,65535<c&&(c=c-65536|0,n=(c>>>10)+55296|0,d=(c&1023)+56320|0,8191>g?(p[g]=n,g=g+1|0,n=-1):(k=n,n=d,d=k))):(e=e-(h/6|0)|0,d=65533),l=31,c=q=h=0;case 7:case 6:case 5:case 4:case 3:case 2:case 1:case 0:p[g]=d;continue;case 8:case 9:case 10:case 11:p[g]=65533}b+=u.apply(null,2048===g?p:t?p.subarray(0,g):p.slice(0,g));p[0]=n;g=-1!==n?1:0;n=-1}return b};m.TextDecoder|| | ||
(m.TextDecoder=x);C.encode=function(a){var b;a=(void 0===a?"":""+a).replace(B,y);var e=a.length|0;var f=new w(e);for(b=0;b<e;b=b+1|0)f[b]=a.charCodeAt(b);return f};C.encodeInto=A;if(!r)m.TextEncoder=z;else if(!(m=r.prototype).encodeInto){var H=new r;m.encodeInto=function(a,b){var e=a.length|0,f=b.length|0;if(e<f>>1){var d=H.encode(a);if((d.length|0)<f)return b.set(d),{read:e,written:d.length|0}}return A(a,b)}}})("undefined"==typeof global?"undefined"==typeof self?this:self:global);//AnonyCo | ||
//# sourceMappingURL=https://cdn.jsdelivr.net/gh/AnonyCo/FastestSmallestTextEncoderDecoder/encodeInto/EncoderDecoderTogether.min.js.map |
@@ -1,8 +0,8 @@ | ||
'use strict';(function(h){var k=String.fromCharCode,q={}.toString,m=h.SharedArrayBuffer,H=m?q.call(m):"",l=h.Uint8Array,I=l?q.call(ArrayBuffer.prototype):"",g=h.Buffer;try{!g&&h.require&&(g=h.require("Buffer"));var w=g.prototype;var J=g?q.call(w):""}catch(a){}var x=!!l&&!g,y=!g||!!l&&l.prototype.isPrototypeOf(w),n=h.TextEncoder,u=h.TextDecoder;if(x||g){var t=function(a){a.TextDecoder=u||z;a.TextEncoder=n||A;a!==h&&(a.decode=u?v(new u,"decode"):B,a.encode=n?v(r,"encode"):C,a.encodeInto=D);return a}, | ||
v=function(a,b,c){c=a[b];return function(){return c.apply(a,arguments)}},G=function(a,b){var c=void 0===a?"":(""+a).replace(/[\x80-\uD7ff\uDC00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]?/g,E),d=c.length|0,e=0,f=0,p=b.length|0,F=a.length|0;p<d&&(d=p);a:for(;e<d;e=e+1|0){a=c.charCodeAt(e)|0;switch(a>>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:f=f+1|0;case 8:case 9:case 10:case 11:break;case 12:case 13:if((e+1|0)<p){f=f+1|0;break}case 14:if((e+2|0)<p){f=f+1|0;break}case 15:if((e+3|0)<p){f= | ||
f+1|0;break}default:break a}b[e]=a}return{written:e,read:F<f?F:f}},C=function(a){a=void 0===a?"":(""+a).replace(/[\x80-\uD7ff\uDC00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]?/g,E);for(var b=a.length|0,c=x?new l(b):g.allocUnsafe?g.allocUnsafe(b):new g(b),d=0;d<b;d=d+1|0)c[d]=a.charCodeAt(d)|0;return c},A=function(){},E=function(a){var b=a.charCodeAt(0)|0;if(55296<=b&&56319>=b)if(a=a.charCodeAt(1)|0,56320<=a&&57343>=a){if(b=(b<<10)+a-56613888|0,65535<b)return k(240|b>>>18,128|b>>>12&63,128|b>>>6&63,128| | ||
b&63)}else b=65533;return 2047>=b?k(192|b>>>6,128|b&63):k(224|b>>>12,128|b>>>6&63,128|b&63)},B=function(a){var b=a&&a.buffer||a,c=q.call(b);if(c!==I&&c!==J&&c!==H&&"[object ArrayBuffer]"!==c&&void 0!==a)throw TypeError("Failed to execute 'decode' on 'TextDecoder': The provided value is not of type '(ArrayBuffer or ArrayBufferView)'");a=y?new l(b):b||[];b="";c=0;for(var d=a.length|0;c<d;c=c+32768|0)b+=k.apply(0,a[y?"subarray":"slice"](c,c+32768|0));return b.replace(/[\xc0-\xf7][\x80-\xbf]+|[\x80-\xff]/g, | ||
K)},z=function(){},K=function(a){var b=a.charCodeAt(0),c=1114112,d=0,e=a.length|0,f="";switch(b>>>4){case 12:case 13:c=(b&31)<<6|a.charCodeAt(1)&63;d=128>c?0:2;break;case 14:c=(b&15)<<12|(a.charCodeAt(1)&63)<<6|a.charCodeAt(2)&63;d=2048>c?0:3;break;case 15:30===b>>>3&&(c=(b&7)<<18|(a.charCodeAt(1)&63)<<12|(a.charCodeAt(2)&63)<<6|a.charCodeAt(3),d=65536>c?0:4)}d&&(e<d?d=0:65536>c?f=k(c):1114112>c?(c=c-65664|0,f=k((c>>>10)+55296|0,(c&1023)+56320|0)):d=0);for(;d<e;d=d+1|0)f+="\ufffd";return f};z.prototype.decode= | ||
B;m=A.prototype;m.encode=C;var D=m.encodeInto=G;if(n){var r=new n;D=r.encodeInto?v(r,"encode"):n.prototype.encodeInto=function(a,b){var c=a.length|0,d=b.length|0;if(c<d>>1){var e=r.encode(a);if((e.length|0)<d)return b.set(e),{read:c,written:e.length|0}}return G(a,b)}}"object"===typeof exports&&"undefined"!==typeof module?t(module.exports):typeof define==typeof t&&"function"===typeof define&&define.amd?define(function(){return t({})}):t(h)}})("undefined"==typeof global?"undefined"==typeof self?this|| | ||
{}:self:global);//AnonyCo | ||
'use strict';(function(n){var w=String.fromCharCode,x={}.toString,u=n.SharedArrayBuffer,M=u?x.call(u):"",r=n.Uint8Array,N=r?x.call(ArrayBuffer.prototype):"",l=n.Buffer,C=/[\x80-\uD7ff\uDC00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]?/g,t=new Uint16Array(8192);try{!l&&n.require&&(l=n.require("Buffer"));var D=l.prototype;var O=l?x.call(D):""}catch(a){}var E=!!r&&!l,P=!l||!!r&&r.prototype.isPrototypeOf(D),v=n.TextEncoder,A=n.TextDecoder;if(E||l){var z=function(a){a.TextDecoder=A||F;a.TextEncoder=v||G;a!== | ||
n&&(a.decode=A?B(new A,"decode"):H,a.encode=v?B(y,"encode"):I,a.encodeInto=J);return a},B=function(a,b,c){c=a[b];return function(){return c.apply(a,arguments)}},L=function(a,b){var c=void 0===a?"":(""+a).replace(C,K),f=c.length|0,e=0,d=0,m=b.length|0,h=a.length|0;m<f&&(f=m);a:for(;e<f;e=e+1|0){a=c.charCodeAt(e)|0;switch(a>>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:d=d+1|0;case 8:case 9:case 10:case 11:break;case 12:case 13:if((e+1|0)<m){d=d+1|0;break}case 14:if((e+2|0)<m){d=d+1| | ||
0;break}case 15:if((e+3|0)<m){d=d+1|0;break}default:break a}b[e]=a}return{written:e,read:h<d?h:d}},I=function(a){a=void 0===a?"":(""+a).replace(C,K);for(var b=a.length|0,c=E?new r(b):l.allocUnsafe?l.allocUnsafe(b):new l(b),f=0;f<b;f=f+1|0)c[f]=a.charCodeAt(f)|0;return c},G=function(){},K=function(a){var b=a.charCodeAt(0)|0;if(55296<=b&&56319>=b)if(a=a.charCodeAt(1)|0,56320<=a&&57343>=a){if(b=(b<<10)+a-56613888|0,65535<b)return w(240|b>>>18,128|b>>>12&63,128|b>>>6&63,128|b&63)}else b=65533;return 2047>= | ||
b?w(192|b>>>6,128|b&63):w(224|b>>>12,128|b>>>6&63,128|b&63)},H=function(a){var b=a&&a.buffer||a,c=x.call(b);if(c!==N&&c!==O&&c!==M&&"[object ArrayBuffer]"!==c&&void 0!==a)throw TypeError("Failed to execute 'decode' on 'TextDecoder': The provided value is not of type '(ArrayBuffer or ArrayBufferView)'");a=P?new r(b):b||[];b="";c=0;for(var f=a.length|0,e,d=0,m=31,h=0,q=0,k,g=0,p=0;c<f;){for(;c<f&&8192>g;c=c+1|0,g=g+1|0)switch(e=a[c]&255,e>>>4){case 15:m>>>=1,k=a[c=c+1|0]&255,d=k&63,q=2===k>>>6&&248> | ||
e?5:20,h=6;case 14:m>>>=1,k=a[c=c+1|0]&255,d<<=6,d|=k&63,q=2===k>>>6?q+4|0:24,h=h+6|0;case 13:case 12:k=a[c=c+1|0]&255,d<<=6,d|=k&63,q=2===k>>>6?q+7|0:31,h=h+6|0,d|=(e&m)<<h,c<f&&d>>>q&&1114112>d?(e=d,65535<d&&(d=d-65536|0,p=(d>>>10)+55296|0,e=(d&1023)+56320|0,8191>g?(t[g]=p,g=g+1|0,p=-1):(k=p,p=e,e=k))):(c=c-(h/6|0)|0,e=65533),m=31,d=q=h=0;case 7:case 6:case 5:case 4:case 3:case 2:case 1:case 0:t[g]=e;continue;case 8:case 9:case 10:case 11:t[g]=65533}b+=w.apply(null,8192===g?t:t.subarray(0,g));t[0]= | ||
p;g=-1!==p?1:0;p=-1}return b},F=function(){};F.prototype.decode=H;u=G.prototype;u.encode=I;var J=u.encodeInto=L;if(v){var y=new v;J=y.encodeInto?B(y,"encode"):v.prototype.encodeInto=function(a,b){var c=a.length|0,f=b.length|0;if(c<f>>1){var e=y.encode(a);if((e.length|0)<f)return b.set(e),{read:c,written:e.length|0}}return L(a,b)}}"object"===typeof exports&&"undefined"!==typeof module?z(module.exports):typeof define==typeof z&&"function"===typeof define&&define.amd?define(function(){return z({})}): | ||
z(n)}})("undefined"==typeof global?"undefined"==typeof self?this||{}:self:global);//AnonyCo | ||
//# sourceMappingURL=https://cdn.jsdelivr.net/gh/AnonyCo/FastestSmallestTextEncoderDecoder/encodeInto/NodeJS/EncoderAndDecoderNodeJS.min.js.map |
{ | ||
"name": "fastestsmallesttextencoderdecoder-encodeinto", | ||
"version": "1.0.19", | ||
"version": "1.0.20", | ||
"description": "The fastest smallest Javascript polyfill for the encode of TextEncoder and decode of TextDecoder for UTF-8 only. Made by AnonyCo with ❤️ from 🐕s.", | ||
@@ -42,3 +42,4 @@ "keywords": [ | ||
"prepublishOnly": "if [ -f './encodeInto/package.json' ]; then cd encodeInto; npm publish; cd ..; fi", | ||
"test": "if [ \"${PWD##*/}\" != 'encodeInto' ]; then cd encodeInto/test; node --preserve-symlinks --preserve-symlinks-main -- 'test.js' -test-encode-into; cd ../..; fi; cd test; node --preserve-symlinks --preserve-symlinks-main -- 'test.js'" | ||
"test": "if [ \"${PWD##*/}\" != 'encodeInto' ]; then cd encodeInto/test; node --preserve-symlinks --preserve-symlinks-main -- 'test.js' -test-encode-into; cd ../..; fi; cd test; node --preserve-symlinks --preserve-symlinks-main -- 'test.js'", | ||
"benchmark": "cd test; node --preserve-symlinks --preserve-symlinks-main --expose-gc --max-old-space-size=10240 --max-semi-space-size=8192 --noconcurrent_sweeping --nouse-idle-notification -- 'benchmark.js'" | ||
}, | ||
@@ -45,0 +46,0 @@ "license": "CC0-1.0", |
@@ -1,1 +0,1 @@ | ||
Please see [fastestsmallesttextencoderdecoder](https://www.npmjs.com/package/fastestsmallesttextencoderdecoder) for usage and details | ||
Please see [fastestsmallesttextencoderdecoder](fastestsmallesttextencoderdecoder) for usage and details |
Sorry, the diff of this file is not supported yet
16483
2.49%