1
0
mirror of https://github.com/JKorf/CryptoExchange.Net synced 2025-06-10 01:16:24 +00:00
Jan Korf d533557324
Websocket refactoring (#190)
Websocket refactoring
2024-02-24 19:21:47 +01:00

21 lines
650 B
JavaScript

// https://github.com/substack/deep-freeze/blob/master/index.js
export default function deepFreeze (o) {
Object.freeze(o);
var objIsFunction = typeof o === 'function';
Object.getOwnPropertyNames(o).forEach(function (prop) {
if (o.hasOwnProperty(prop)
&& o[prop] !== null
&& (typeof o[prop] === "object" || typeof o[prop] === "function")
// IE11 fix: https://github.com/highlightjs/highlight.js/issues/2318
// TODO: remove in the future
&& (objIsFunction ? prop !== 'caller' && prop !== 'callee' && prop !== 'arguments' : true)
&& !Object.isFrozen(o[prop])) {
deepFreeze(o[prop]);
}
});
return o;
};