Closed LeonMarchetti closed 5 months ago
Función global para encontrar variables globales:
/** * Searches global variables and prints results in console * * @param {string} [text=""] Search text of the variable's name * @param {string} [type=""] Type of variable to search, empty returns all types */ function searchVariable(text = "", type = "") { // console.debug(`text = "${text}"\ntipo = "${type}"`); var variables; var sortedKeys = Object.keys(unsafeWindow).sort(); if (type) { variables = sortedKeys.filter(v => v.indexOf(text) >= 0 && (typeof unsafeWindow[v] == type)); } else { variables = sortedKeys.filter(v => v.indexOf(text) >= 0); } var table = variables.map(v => ({ "variable": v, "type": typeof unsafeWindow[v] })); console.table(table); } unsafeWindow.searchVariable = searchVariable;
Función global para encontrar variables globales: