Last Updated: February 25, 2016
·
1.159K
· irakli

Quick Way of Inspecting a Node.js Module

Say you found a Node.js/NPM module that is poorly documented. Following is a quick way of inspecting all exported methods of a module:

> cd /tmp
> npm install badmodule
> node

Once you are in node REPL, type following commands:

> var badmodule = require('badmodule')
> badmodule.<TAB>

Basically if you require a module in Node REPL and then type name of the variable which you required module as, dot and hit "Tab", you will get a list of all exported methods.

Can be extremely handy and a better alternative to sifting through the code (which, granted you may still end up having to do if the module is that poorly documented).

2 Responses
Add your response

This is a really good suggestion! I'd like to make an additional suggestion: open an issue on the module's Github page about the lack of documentation.

over 1 year ago ·

@faceleg ha, touché! :-)

over 1 year ago ·