Created
July 7, 2011 15:11
-
-
Save asawilliams/1069724 to your computer and use it in GitHub Desktop.
Finds all the global functions and variables. Tries to not count the native browser functions and variables but does not catch all of them
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var numf=0; var nump=0; | |
for(var p in this) { | |
if(typeof(this[p]) == "function" && this[p].toString().indexOf('[native code]') === -1 ){ | |
numf+=1; | |
console.log(p+"()"); | |
} else if(typeof this[p] != 'undefined' && this[p] && this[p].toString().indexOf('[native code]') === -1){ | |
var cont = false; | |
if(typeof this[p] === 'object') { | |
for(op in this[p]) { | |
if(p[op] && p[op].toString().indexOf('[native code]') === -1){ | |
cont = true; | |
break; | |
} | |
} | |
} | |
if(cont) continue; | |
nump+=1; | |
console.log(p); | |
} | |
} | |
console.log("functions: "+numf+" properties: "+nump); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment