4

Is there any function that can be used to list all of the currently defined functions in node.js? I'd like to create a function like this:

function getAllDefinedFunctions(){
    //return all the functions that are currently defined
}
Anderson Green
  • 30,230
  • 67
  • 195
  • 328
  • I realized that I made a duplicate of my own question: http://stackoverflow.com/questions/11279441/return-all-of-the-functions-that-are-defined-in-a-javascript-file – Anderson Green Oct 08 '12 at 02:11

1 Answers1

3

You can use a for / in loop to loop over all properties in this (the global object) and check whether typeof this[name] is 'function'.

SLaks
  • 868,454
  • 176
  • 1,908
  • 1,964