I've spent lots of hours trying to figure how to do this, and I'm getting crazy.
I have a repository where I have several npm modules, and I want to document all the code of each module under the same module/namespace.
This would be easy if all my files were classes but it it's being a very hard task because all my files are Factories of objects.
Let me ilustrate this with an example
// Main file
module.exports = () =>{
const method = () => {
return 'stuff'
}
const private_method = () => {
return 'private stuff'
}
return { method } // Expose public methods
}
// DAO file
module.exports = (db) =>{
const findByName = () => {
return db.find();
}
const findByAge = () => {
return db.find();
}
return {
find: { byName: findByName, byAge: findByAge}
}
}
What I want to get is something like this:
# Module name
module description
<static> Factory
<static> DaoFactory
## Members
### Dao
Dao methods....
### Main
main methods...
I tried with several combinations of `@memberof`, `@namespace`, `@name`, and I'm unable to get a satisfactory answer.
I've read several approaches using `@namespaces` that are member of other namespaces. I would love to make this work as good as it does for clases. For example, with a file containing a class all I have to do is:
/**
* @module myModule
*/
/**
* Returns a {@link License} constructor binded to the provided Licenses DAO
*/
module.exports = function ( DAO ) {
/**
* @class
*/
function License() {
this.stuff = 'stuff'
}
}
And the license class will appear as part of the myModule namespace.
EDIT:
However there are some caveats:
- All the methods are being documented as static.
- This is creating lots of namespaces. I would love to have only one root namespace listed under the namespaces menu instead of several namespaces with the sub-namespace attached.