How should I document nodejs modules

1,181 views
Skip to first unread message

kuebk

unread,
Apr 25, 2012, 5:41:15 AM4/25/12
to jsdoc...@googlegroups.com
Let's say that my module consists of 3 following files:

If I do it that way, jsdoc generates a documentantion in which I have a module named exampleModule, which will have static property named x which will have my classes.
How should I write documentation in index.js file to avoid getting my classes under other property?
I've tried many times many different approaches with no acceptable results.

Michael Mathews

unread,
Apr 25, 2012, 5:13:55 PM4/25/12
to kuebk, jsdoc...@googlegroups.com
An easy way to remember the correct way to document `x`, is to say to yourself "the script exports x as myModule". Then you should see that what you need is a doclet for x with a tag that says "@exports myModule". This is shown on the (still incomplete) user guide here: http://usejsdoc.org/howto-commonjs-modules.html


```` index.js
/** 
 * @exports exampleModule
 * @property {classA} classA - sample class A
 * @property {classB} classB - sample class B
 */
var x = {
    classA: require('./classA.js').classA,
    classB: require('./classB.js').classB
};

module.exports = x;
````

Michael Mathews
mic...@gmail.com



--
You received this message because you are subscribed to the Google Groups "JSDoc Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/jsdoc-users/-/p95zrhhdjw4J.
To post to this group, send email to jsdoc...@googlegroups.com.
To unsubscribe from this group, send email to jsdoc-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/jsdoc-users?hl=en.

Reply all
Reply to author
Forward
0 new messages