-
Notifications
You must be signed in to change notification settings - Fork 55
/
proxy.min.js
1 lines (1 loc) · 3.81 KB
/
proxy.min.js
1
function _typeof(t){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_typeof(t)}!function(t){if(!t.Proxy){var e=null;t.Proxy=function(t,r){if(!n(t)||!n(r))throw new TypeError("Cannot create proxy with a non-object as target or handler");var o=function(){};e=function(){o=function(t){throw new TypeError("Cannot perform '"+t+" on a proxy that has been revoked")}};var l=r;for(var i in r={get:null,set:null,deleteProperty:null,apply:null,construct:null},l){if(!(i in r))throw new TypeError("Proxy polyfill does not support trap '"+i+"'");r[i]=l[i]}"function"==typeof l&&(r.apply=l.apply.bind(l));var p=this,a=!1,c=!1;"function"==typeof t?(p=function(){var e=this&&this.constructor===p,n=Array.prototype.slice.call(arguments);if(o(e?"construct":"apply"),e&&r.construct)return r.construct.call(this,t,n);if(!e&&r.apply)return r.apply(t,this,n);if(e){n.unshift(t);var l=t.bind.apply(t,n);return new l}return t.apply(this,n)},a=!0):t instanceof Array&&(p=[],c=!0);var f=r.get?function(t){return o("get"),r.get(this,t,p)}:function(t){return o("get"),this[t]},y=r.set?function(t,e){o("set");r.set(this,t,e,p)}:function(t,e){o("set"),this[t]=e},h=r.deleteProperty?function(t){return o("deleteProperty"),r.deleteProperty(this,t)}:function(t){o("get"),delete this[t]},u=Object.getOwnPropertyNames(t),g={};u.forEach((function(e){if(!a&&!c||!(e in p)){var n=Object.getOwnPropertyDescriptor(t,e),r={enumerable:!!n.enumerable,configurable:!!n.configurable,get:f.bind(t,e),set:y.bind(t,e)};Object.defineProperty(p,e,r),g[e]=!0}}));var s=!0;if(Object.setPrototypeOf?Object.setPrototypeOf(p,Object.getPrototypeOf(t)):p.__proto__?p.__proto__=t.__proto__:s=!1,r.get||!s)for(var b in t)g[b]||Object.defineProperty(p,b,{get:f.bind(t,b)});p.__isProxy=!0,p.__getTarget=t;var v=function(t,e){return{enumerable:!0,configurable:!0,get:f.bind(t,e),set:y.bind(t,e)}};return p instanceof Array?(p.unshift=function(){var e=p.length;t.length=p.length=t.length+arguments.length;for(var n=0;n<arguments.length;n++){var r=(n+e).toString();Object.defineProperty(p,r,v(t,r))}var o=Array.prototype.unshift.apply(this,arguments);return p.length=o=t.length,o},p.push=function(){t.length=p.length=t.length+1;var e=(t.length-1).toString();Object.defineProperty(p,e,v(t,e));var n=Array.prototype.push.apply(this,arguments);return p[p.length-2]=p[p.length-1],p.length=t.length,n},p.pop=function(){var e=(t.length-1).toString(),n=Array.prototype.pop.apply(this,arguments);return h.call(t,e),p.length=t.length,y.call(t,"length",t.length-1),p.length=t.length,n},p.splice=function(e,n,r){if(n<0&&(n=0),n>0){if(void 0!==r)var o=e+1,l=n-1;else o=e,l=n;for(var i=[],a=e+n-1;a>=o;a--){var c=a.toString();i.unshift(t[c]),h.call(t,c)}var f=Array.prototype.splice.apply(this,arguments);if(void 0!==r)for(a=1;a<f.length;a++)f[a]=i[a-1];else for(a=0;a<f.length;a++)f[a]=i[a];return p.length=t.length,y.call(t,"length",t.length-l),p.length=t.length,f}if(void 0!==r){t.length=p.length=t.length+1;var u=(t.length-1).toString();Object.defineProperty(p,u,v(t,u));f=Array.prototype.splice.apply(this,arguments);return p.length=t.length,f}return[]},p.shift=function(){for(var e=t[0],n=0;n<t.length-1;n++)y.call(t,n.toString(),t[n+1]);return h.call(t,(t.length-1).toString()),p.length=t.length,y.call(t,"length",t.length-1),p.length=t.length,e}):p instanceof Date?Object.getOwnPropertyNames(Date.prototype).forEach((function(e){Object.defineProperty(p,e,{get:f.bind(t,e)})})):(Object.seal(t),Object.seal(p)),p},t.Proxy.revocable=function(n,r){return{proxy:new t.Proxy(n,r),revoke:e}},t.Proxy.revocable=t.Proxy.revocable,t.Proxy=t.Proxy}function n(t){return!!t&&("object"===_typeof(t)||"function"==typeof t)}}("undefined"!=typeof process&&"[object process]"==={}.toString.call(process)?global:self);