/** * getUrlParameter * @param {string} arg_key * @returns {string | TRUE} */ export function getUrlParameter(arg_key) { let searchStr = window.location.search.substring(1), paramList = searchStr.split('&'); for (let i = 0; i < paramList.length; i++) { let paramPair = paramList[i].split('='); if (paramPair[0] === arg_key) { return paramPair[1] === undefined ? true : decodeURIComponent(paramPair[1]); } } } /** * 深冻结函数 */ export function deepFreeze(o) { const oIsFunction = typeof o === 'function'; const hasOwnProp = Object.prototype.hasOwnProperty; Object.getOwnPropertyNames(o).forEach(function(name) { const prop = o[name]; if ( hasOwnProp.call(o, name) && (oIsFunction ? name !== 'caller' && name !== 'callee' && name !== 'arguments' : true) && prop !== null && (typeof prop === 'object' || typeof prop === 'function') && !Object.isFrozen(prop) ) { deepFreeze(prop); } }); return Object.freeze(o); }