The more "magic" your JavaScript library is, the less likely it is that you're able to use a documentation generator.
Is anyone aware of a documentation generator that allows documentation of functions with parameter shifting/parametric polymorphism?
function example(required, optional, callback) {
if(typeof optional === 'function' && typeof callback === 'undefined') {
callback = optional;
optional = 'DEFAULT VALUE';
}
// do work here
}
Which can be called as follows:
example(required, optional, function() {
// do work
});
example(required, function() {
// do work
});
Any suggestions are appreciated, with the exception of "use a generic comment/documentation block".
This is related, but not a duplicate of: Document generic type parameters in JSDOC