fastestsmallesttextencoderdecoder
Advanced tools
Comparing version 1.0.8 to 1.0.9
@@ -8,5 +8,7 @@ (function(window){ | ||
var Object_prototype_toString = ({}).toString; | ||
var NativeSharedArrayBuffer = global.NativeSharedArrayBuffer; | ||
var sharedArrayBufferString = NativeSharedArrayBuffer ? Object_prototype_toString.call(NativeSharedArrayBuffer) : ""; | ||
var NativeUint8Array = window.Uint8Array; | ||
var patchedU8Array = NativeUint8Array || Array; | ||
var ArrayBufferString = Object_prototype_toString.call((window.ArrayBuffer || patchedU8Array).prototype); | ||
var ArrayBufferString = Object_prototype_toString.call((NativeUint8Array ? ArrayBuffer : patchedU8Array).prototype); | ||
function decoderReplacer(encoded){ | ||
@@ -38,3 +40,4 @@ var codePoint = encoded.charCodeAt(0) << 24; | ||
var buffer = (inputArrayOrBuffer && inputArrayOrBuffer.buffer) || inputArrayOrBuffer; | ||
if (Object_prototype_toString.call(buffer) !== ArrayBufferString) | ||
var asObjectString = Object_prototype_toString.call(buffer); | ||
if (asObjectString !== arrayBufferString && asObjectString !== sharedArrayBufferString) | ||
throw Error("Failed to execute 'decode' on 'TextDecoder': The provided value is not of type '(ArrayBuffer or ArrayBufferView)'"); | ||
@@ -41,0 +44,0 @@ var inputAs8 = NativeUint8Array ? new patchedU8Array(buffer) : buffer; |
@@ -1,5 +0,5 @@ | ||
'use strict';(function(f){var v=Math.log,w=Math.LN2,x=Math.clz32||function(b){return 31-v(b>>>0)/w|0},g=String.fromCharCode,m={}.toString,e=f.Buffer;if(!e&&f.require)try{e=f.require("Buffer")}catch(b){}var y=e&&m.call(e.prototype),k=f.Uint8Array,h=k&&(!e||k.prototype.isPrototypeOf(e)),z=h&&m.call(f.ArrayBuffer.prototype);if(h||e){var n=function(b){b.TextDecoder||(b.TextDecoder=p);b.TextEncoder||(b.TextEncoder=q);b!==f&&(b.decode=r,b.encode=t);return b},t=function(b){b=void 0===b?"":(""+b).replace(/[\x80-\uD7ff\uDC00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]?/g, | ||
A);for(var a=b.length|0,c=new (h?k:e)(a),d=0;d<a;d=d+1|0)c[d]=b.charCodeAt(d)|0;return c},q=function(){},A=function(b){var a=b.charCodeAt(0)|0;if(55296<=a&&56319>=a){var c=b.charCodeAt(1)|0;if(c===c&&56320<=c&&57343>=c){if(a=(a-55296<<10)+c-56320+65536|0,65535<a)return g(240|a>>>18,128|a>>>12&63,128|a>>>6&63,128|a&63)}else return g(239,191,189)}return 127>=a?b:2047>=a?g(192|a>>>6,128|a&63):g(224|a>>>12,128|a>>>6&63,128|a&63)},r=function(b){b=b&&b.buffer||b;var a=m.call(b);if(a!==z&&a!==y)throw Error("Failed to execute 'decode' on 'TextDecoder': The provided value is not of type '(ArrayBuffer or ArrayBufferView)'"); | ||
b=h?new k(b):b;a="";for(var c=0,d=b.length|0;c<d;c=c+32768|0)a+=g.apply(0,b[h?"subarray":"slice"](c,c+32768|0));return a.replace(/[\xc0-\xff][\x80-\xbf]*/g,B)},p=function(){},B=function(b){var a=b.charCodeAt(0)<<24,c=x(~a)|0,d=0,u=b.length|0,l="";if(5>c&&u>=c){a=a<<c>>>24+c;for(d=1;d<c;d=d+1|0)a=a<<6|b.charCodeAt(d)&63;65535>=a?l+=g(a):1114111>=a?(a=a-65536|0,l+=g((a>>10)+55296|0,(a&1023)+56320|0)):d=0}for(;d<u;d=d+1|0)l+="\ufffd";return l};p.prototype.decode=r;q.prototype.encode=t;typeof define== | ||
typeof n&&define.amd?define(function(){return n({})}):n("object"==typeof exports?exports:f)}})("undefined"==typeof global?"undefined"==typeof self?this:self:global);//AnonyCo | ||
'use strict';(function(f){var y=Math.log,z=Math.LN2,A=Math.clz32||function(b){return 31-y(b>>>0)/z|0},g=String.fromCharCode,k={}.toString,n=f.b,B=n?k.call(n):"",h=f.Uint8Array,C=h?k.call(ArrayBuffer.prototype):"",e=f.Buffer;try{!e&&f.require&&(e=f.require("Buffer"));var p=e.prototype,D=e?k.call(p):""}catch(b){}var q=!!h&&!e,r=!e||!!h&&h.prototype.isPrototypeOf(p);if(q||e){var m=function(b){b.TextDecoder||(b.TextDecoder=t);b.TextEncoder||(b.TextEncoder=u);b!==f&&(b.decode=v,b.encode=w);return b},w= | ||
function(b){b=void 0===b?"":(""+b).replace(/[\x80-\uD7ff\uDC00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]?/g,E);for(var a=b.length|0,c=q?new h(a):e.a?e.a(a):new e(a),d=0;d<a;d=d+1|0)c[d]=b.charCodeAt(d)|0;return c},u=function(){},E=function(b){var a=b.charCodeAt(0)|0;if(55296<=a&&56319>=a){var c=b.charCodeAt(1)|0;if(c===c&&56320<=c&&57343>=c){if(a=(a-55296<<10)+c-56320+65536|0,65535<a)return g(240|a>>>18,128|a>>>12&63,128|a>>>6&63,128|a&63)}else return g(239,191,189)}return 127>=a?b:2047>=a?g(192|a>>> | ||
6,128|a&63):g(224|a>>>12,128|a>>>6&63,128|a&63)},v=function(b){b=b&&b.buffer||b;var a=k.call(b);if(a!==C&&a!==D&&a!==B)throw Error("Failed to execute 'decode' on 'TextDecoder': The provided value is not of type '(ArrayBuffer or ArrayBufferView)'");b=r?new h(b):b;a="";for(var c=0,d=b.length|0;c<d;c=c+32768|0)a+=g.apply(0,b[r?"subarray":"slice"](c,c+32768|0));return a.replace(/[\xc0-\xff][\x80-\xbf]*/g,F)},t=function(){},F=function(b){var a=b.charCodeAt(0)<<24,c=A(~a)|0,d=0,x=b.length|0,l="";if(5>c&& | ||
x>=c){a=a<<c>>>24+c;for(d=1;d<c;d=d+1|0)a=a<<6|b.charCodeAt(d)&63;65535>=a?l+=g(a):1114111>=a?(a=a-65536|0,l+=g((a>>10)+55296|0,(a&1023)+56320|0)):d=0}for(;d<x;d=d+1|0)l+="\ufffd";return l};t.prototype.decode=v;u.prototype.encode=w;typeof define==typeof m&&define.amd?define(function(){return m({})}):m("object"==typeof exports?exports:f)}})("undefined"==typeof global?"undefined"==typeof self?this:self:global);//AnonyCo | ||
//# sourceMappingURL=EncoderAndDecoderNodeJS.min.js.map |
@@ -1,6 +0,6 @@ | ||
'use strict';var e="undefined"==typeof global?self:global,f=Math.log,g=Math.LN2,h=Math.clz32||function(b){return 31-f(b>>>0)/g|0},l=String.fromCharCode,m={}.toString,p=e.Buffer,q=p&&m.call(p.prototype),r=e.Uint8Array,t=r&&(!p||r.prototype.isPrototypeOf(p)),u=t&&m.call(e.ArrayBuffer.prototype); | ||
function v(b){var a=b.charCodeAt(0)<<24,c=h(~a)|0,d=0,n=b.length|0,k="";if(5>c&&n>=c){a=a<<c>>>24+c;for(d=1;d<c;d=d+1|0)a=a<<6|b.charCodeAt(d)&63;65535>=a?k+=l(a):1114111>=a?(a=a-65536|0,k+=l((a>>10)+55296|0,(a&1023)+56320|0)):d=0}for(;d<n;d=d+1|0)k+="\ufffd";return k}function w(){} | ||
function x(b){b=b&&b.buffer||b;var a=m.call(b);if(a!==u&&a!==q)throw Error("Failed to execute 'decode' on 'TextDecoder': The provided value is not of type '(ArrayBuffer or ArrayBufferView)'");b=t?new r(b):b;a="";for(var c=0,d=b.length|0;c<d;c=c+32768|0)a+=l.apply(0,b[t?"subarray":"slice"](c,c+32768|0));return a.replace(/[\xc0-\xff][\x80-\xbf]*/g,v)}w.prototype.decode=x; | ||
function y(b){var a=b.charCodeAt(0)|0;if(55296<=a&&56319>=a){var c=b.charCodeAt(1)|0;if(c===c&&56320<=c&&57343>=c){if(a=(a-55296<<10)+c-56320+65536|0,65535<a)return l(240|a>>>18,128|a>>>12&63,128|a>>>6&63,128|a&63)}else return l(239,191,189)}return 127>=a?b:2047>=a?l(192|a>>>6,128|a&63):l(224|a>>>12,128|a>>>6&63,128|a&63)}function z(){} | ||
function A(b){b=void 0===b?"":(""+b).replace(/[\x80-\uD7ff\uDC00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]?/g,y);for(var a=b.length|0,c=new (t?r:p)(a),d=0;d<a;d=d+1|0)c[d]=b.charCodeAt(d)|0;return c}z.prototype.encode=A;export var TextDecoder=w;export var TextEncoder=z;export var decode=x;export var encode=A;//AnonyCo | ||
'use strict';var e="undefined"==typeof global?self:global,f=Math.log,g=Math.LN2,h=Math.clz32||function(b){return 31-f(b>>>0)/g|0},k=String.fromCharCode,m={}.toString,n=e.b,p=n?m.call(n):"",q=e.Uint8Array,r=q?m.call(ArrayBuffer.prototype):"",t=e.Buffer;try{!t&&e.require&&(t=e.require("Buffer"));var u=t.prototype,w=m.call(u)}catch(b){}var x=!!q&&!t,y=!t||!!q&&q.prototype.isPrototypeOf(u); | ||
function z(b){var a=b.charCodeAt(0)<<24,c=h(~a)|0,d=0,v=b.length|0,l="";if(5>c&&v>=c){a=a<<c>>>24+c;for(d=1;d<c;d=d+1|0)a=a<<6|b.charCodeAt(d)&63;65535>=a?l+=k(a):1114111>=a?(a=a-65536|0,l+=k((a>>10)+55296|0,(a&1023)+56320|0)):d=0}for(;d<v;d=d+1|0)l+="\ufffd";return l}function A(){} | ||
function B(b){b=b&&b.buffer||b;var a=m.call(b);if(a!==r&&a!==w&&a!==p)throw Error("Failed to execute 'decode' on 'TextDecoder': The provided value is not of type '(ArrayBuffer or ArrayBufferView)'");b=y?new q(b):b;a="";for(var c=0,d=b.length|0;c<d;c=c+32768|0)a+=k.apply(0,b[y?"subarray":"slice"](c,c+32768|0));return a.replace(/[\xc0-\xff][\x80-\xbf]*/g,z)}A.prototype.decode=B; | ||
function C(b){var a=b.charCodeAt(0)|0;if(55296<=a&&56319>=a){var c=b.charCodeAt(1)|0;if(c===c&&56320<=c&&57343>=c){if(a=(a-55296<<10)+c-56320+65536|0,65535<a)return k(240|a>>>18,128|a>>>12&63,128|a>>>6&63,128|a&63)}else return k(239,191,189)}return 127>=a?b:2047>=a?k(192|a>>>6,128|a&63):k(224|a>>>12,128|a>>>6&63,128|a&63)}function D(){} | ||
function E(b){b=void 0===b?"":(""+b).replace(/[\x80-\uD7ff\uDC00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]?/g,C);for(var a=b.length|0,c=x?new q(a):t.a?t.a(a):new t(a),d=0;d<a;d=d+1|0)c[d]=b.charCodeAt(d)|0;return c}D.prototype.encode=E;var F=e.TextDecoder||A,G=e.TextEncoder||D;export var TextDecoder=F;export var TextEncoder=G;export var decode=F===A?B:new F.decode;export var encode=G===D?E:new G.encode;//AnonyCo | ||
//# sourceMappingURL=EncoderAndDecoderNodeJS.min.module.js.map |
{ | ||
"name": "fastestsmallesttextencoderdecoder", | ||
"version": "1.0.8", | ||
"version": "1.0.9", | ||
"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.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
37204
115