Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get a list of currently defined functions in node.js

Tags:

node.js

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
}
like image 552
Anderson Green Avatar asked Oct 25 '25 04:10

Anderson Green


1 Answers

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'.

like image 82
SLaks Avatar answered Oct 27 '25 21:10

SLaks