This repository has been archived by the owner on Sep 16, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
min.js
1 lines (1 loc) · 2.63 KB
/
min.js
1
!function(){"use strict";!function(){const{assign:t,create:r,defineProperty:e,freeze:n,getOwnPropertyNames:o,keys:s,seal:c,setPrototypeOf:p}=Object,u="object"==typeof self?self:global,i=new Map,y=[];function a(t){return function(){return"function"==typeof this?function(t,r){return function(){return t(r.apply(this,arguments))}}(t,this):t(this)}}function f(t){if(!i.has(t))throw new TypeError("unknown type "+t);return i.get(t)}function h(t){return function(){return this.map(t)}}function g(t){y.includes(t)||(y.push(t),e(Object.prototype,t,{get(){return this}}))}[{boolean:"Boolean"},{number:"Number"},{object:"Object"},{string:"String"}].forEach(t=>{const[r]=s(t),n=u[t[r]],o=t=>typeof t===r?t:n(t);i.set(r,o),e(Array.prototype,r,{get:h(o)}),e(Object.prototype,r,{get:a(o)}),y.push(t)}),[{symbol:"Symbol"}].forEach(t=>{const[r]=s(t),n=t[r];if("function"==typeof u[n]){const o=t=>{if(typeof t===r)return t;throw new TypeError(String(t)+" is not a "+n)};i.set(r,o),e(Array.prototype,r,{get:h(o)}),e(Object.prototype,r,{get:a(o)}),y.push(t)}}),[{f:"Float32Array"},{i:"Int32Array"},{u:"Uint32Array"},{f32:"Float32Array"},{f64:"Float64Array"},{i8:"Int8Array"},{i16:"Int16Array"},{i32:"Int32Array"},{u8:"Uint8Array"},{u16:"Uint16Array"},{u32:"Uint32Array"},{uc8:"Uint8ClampedArray"}].forEach(t=>{const[r]=s(t),n=u[t[r]];if("function"==typeof n){const o=new n(1),s=t=>(o[0]=t,o[0]);i.set(r,s),e(Array.prototype,r,{get(){return new n(this)}}),e(Object.prototype,r,{get:a(s)}),y.push(t)}}),[{i64:"BigInt64Array"},{u64:"BigUint64Array"}].forEach(t=>{const[r]=s(t),n=t[r],o=u[n.slice(0,n.indexOf("64"))];"function"==typeof o&&"function"==typeof u[n]&&(i.set(r,o),e(Array.prototype,r,{get:h(o)}),e(Object.prototype,r,{get:a(o)}),y.push(t))}),[{array:"Array"}].forEach(t=>{const[r]=s(t),n=u[t[r]],o=t=>n.from(t);i.set(r,o),e(Array.prototype,r,{get(){return o(this)}}),e(Object.prototype,r,{get:a(o)}),y.push(t)}),e(Array.prototype,"struct",{get(){const e=r(null),{prototype:o}=p;return this.forEach(t=>{const[r]=s(t),n=t[r],o=f(r),c=new WeakMap;e[n]={enumerable:!0,get(){return c.get(this)},set(t){c.set(this,o(t))}}}),n(o),n(p);function p(n){return c(t(r(o,e),n))}}}),e(Object.prototype,"struct",{get(){const[t]=s(this);return g(t),this[t].struct}}),e(Array.prototype,"enum",{get(){const t=r(null);return this.forEach(r=>{if("string"==typeof r)t[r]=Symbol(r);else{const[e]=s(r),n=[];r[e].forEach(t=>{const[r]=s(t),e=t[r],o=f(r);n.push({name:e,cast:o})});const c=t=>(n.forEach(r=>{const{name:e,cast:n}=r;c[e]=n(t[e])}),c);p(c,null),o(c).forEach(t=>{delete c[t]}),t[e]=c}}),n(t)}}),e(Object.prototype,"enum",{get(){const[t]=s(this);return g(t),this[t].enum}}),e(u,"types",{value:y.map(t=>s(t)[0])})}()}();