Reputation: 2626
I have the following bit of code:
/** @module Array */
/**
* Returns this model's attributes as...
*
* @memberof Array.prototype
* @function
* @name each
**/
Array.prototype.each = function( callback ) {
var context = this;
for( var i = 0; i < context.length; i++ ) {
callback( context[ i ] );
}
}
When I document this with JSDoc, I get:
Why? I am using JSDoc on Gulp.
Upvotes: 5
Views: 1180
Reputation: 1701
I ran into the same problem as the original poster, but I was extending the JSON
global with copy()
and equals()
methods.
(Since there is some debate in the comments above, I will clarify: When I say "having the same problem," I mean that the JSDoc comments I placed before the JSON.copy()
and JSON.equals()
methods did not appear anywhere in my generated documentation, which was a problem not only because that documentation was lost, but also because no other documentation could link to the JSON.copy()
or JSON.equals()
methods.)
Following FreeLightman's suggestion in the comments above, to simply add the following line, solves the problem for me.
/** @class JSON */
And by "solves the problem," I mean that there is now a page in my generated documentation that is specifically for the JSON object, and it contains the desired documentation for the copy()
and equals()
members, and I can link to those members from elsewhere in my documentation.
Since this is many years after the original question, I will point out that I'm using JSDoc version 6.14.12.
Upvotes: 1