You can get the source of the current scope, for example:
arguments.callee.toString()
So, I assume that you can parse this line by matching things like "var" and "function", corresponding from then to ";" or "}"
But that would be a very dirty, rude approach! If you really need to get such information, you better not create variables at all - define each value and function as a property of an object, then you can just iterate over them with (key in obj)
source share