-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.min.js
1 lines (1 loc) · 2.17 KB
/
index.min.js
1
"use strict";function isBrowser(){return("object"!=typeof process||"function"!=typeof require)&&"function"!=typeof importScripts&&("object"==typeof window||void 0)}const ReflectApply=Reflect.apply;function copyProps(e,t,o=!1){o&&(e=Object.getOwnPropertyDescriptors(e),t=Object.getOwnPropertyDescriptors(t));for(const p of Reflect.ownKeys(e))Reflect.getOwnPropertyDescriptor(t,p)||Reflect.defineProperty(t,p,Reflect.getOwnPropertyDescriptor(e,p))}function deepSafe(e,t=!1){t&&(e=Object.getOwnPropertyDescriptors(e));for(const p of Object.keys(e)){var o=e[p];(o&&"object"==typeof o||"function"==typeof o)&&deepSafe(o,!1)}return Object.freeze(e)}function deepSafeAll(e,t=["preventExtensions","seal","freeze"],o=!1){o&&(e=Object.getOwnPropertyDescriptors(e));for(const r of Object.keys(e)){var p=e[r];(p&&"object"==typeof p||"function"==typeof p)&&deepSafeAll(p,t,!1)}return t.includes("preventExtensions")&&Object.preventExtensions(e),t.includes("seal")&&Object.seal(e),t.includes("freeze")&&Object.freeze(e),e}function makeSafe(e,t){return copyProps(e.__proto__,t.__proto__,!0),copyProps(e,t),Object.setPrototypeOf(t.__proto__||Object.getPrototypeOf(t),null),Object.freeze(t.prototype),Object.freeze(t),t}function makeSafeDeep(e,t){return copyProps(e.__proto__,t.__proto__,!0),copyProps(e,t),Object.setPrototypeOf(t.__proto__,null),t.prototype=deepSafe(t.__proto__||Object.getPrototypeOf(t),!0),t=deepSafe(t)}function makeSafeDeepAll(e,t,o=["preventExtensions","seal","freeze"]){return copyProps(e.__proto__?Object.getPrototypeOf(e):void 0,t.__proto__?Object.getPrototypeOf(e):void 0,!0),copyProps(e,t),Object.setPrototypeOf(t.__proto__,null),t.prototype=deepSafeAll(t.__proto__||Object.getPrototypeOf(t),o,!0),t=deepSafeAll(t,o)}if(!isBrowser()){let e=makeSafeDeepAll;module.exports.makeSafe=makeSafe,module.exports.makeSafeDeep=makeSafeDeep,module.exports.makeSafeDeepAll=makeSafeDeepAll,module.exports.preventSealFreeze=makeSafeDeepAll,module.exports.deepSafe=deepSafe,module.exports.deepSafeAll=deepSafeAll,module.exports.copyProps=copyProps,module.exports.default={makeSafe:makeSafe,makeSafeDeep:makeSafeDeep,makeSafeDeepAll:makeSafeDeepAll,preventSealFreeze:e,deepSafe:deepSafe,deepSafeAll:deepSafeAll,copyProps:copyProps}}