2012-09-11 83 views
2

是否有任何函數可用於列出node.js中所有當前定義的函數?我想創建這樣的函數:獲取node.js中當前定義的函數列表

function getAllDefinedFunctions(){ 
    //return all the functions that are currently defined 
} 
+0

我意識到我做了我自己的問題的副本:http://stackoverflow.com/questions/11279441/return-all-of-the-functions-that-are-defined-in-a-javascript-file –

回答

2

可以在this(全局對象)在所有屬性中使用for/in循環來檢查typeof this[name]是否'function'

+1

你能提供一個例子嗎? –

相關問題