12

Is there are possibility to 'group' functions within a class (AMD/RequireJS Module) ? My classes have sometimes over 20+ functions which actually belong to a specific 'interface implementation' and sometimes they just need to be grouped for better readability.

I checked the available jsDoc tags but none of them seem to provide this, in Doxygen there are number of tags...

Any ideas?

1 Answer 1

6

this is one way to do it, your module shape may very, but this works with classes and modules:

/**
* @module foobar
*
* @memberof module:foobar
* @param {string} arg an argument
**/
function one (arg) {
    console.log(arg)
}
module.exports = {
    one: one
}

the key is to use @memberof, documented here.

you can use it with @class documentation, or @module documentation, so it can work with any variety of ES5, ES6, or TypeScript Class or Module shapes, so long as you document the container object (class or module) with @class or @module.

result: enter image description here

1
  • 2
    acceptable workaround for now, but waiting for real grouping feature in jsdoc ;)
    – Luckylooke
    Commented Oct 5, 2016 at 7:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.