mirror of
				https://github.com/JKorf/CryptoExchange.Net
				synced 2025-10-31 10:27:48 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			21 lines
		
	
	
		
			650 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			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;
 | |
| };
 |