Anytime you find yourself battling to get the documentation to say something that your code doesn't, as in a method of exports that is really a global function, you should switch yourself into a mode where you just plan to provide a @name for all your doclets. You might find you can get away without a @name once in a while and that would be a bonus, but don't waste so much effort trying to avoid just writing what you want in your output.
// functions.js
/**
* @function someFunction
* @returns {string} foo
*/
var a = exports.someFunction = function() {
return "foo";
};
/**
* @function someOtherFunction
* @returns {string} bar
*/
var b = exports.someOtherFunction = function(){
return "bar";
};
Note that in JSDoc 3 you can either use a separate @name tag or put the @name after a tag that identifiers the @kind of thing you are documenting, so @function foo, @class foo, @method foo.qaz, @member foo.blat etc.
Michael Mathews
micm...@gmail.com
On 30 Mar 2012, at 01:11, Tim Statler wrote:
> Hi,
> I need to document several functions defined in a single JS file. Each
> has the following pattern:
> // functions.js
> /**
> * A function
> */
> var a = exports.someFunction = function() {
> return "foo";
> };
> /**
> * Another function
> */
> var b = exports.someOtherFunction = function(){
> return "bar";
> };
> These are coded as modules, but they will be consumed as global
> functions, not as required modules. I looked at the JSDoc3 modules
> pattern page for inspiration
> (http://usejsdoc.org/howto-commonjs-modules.html). The patterns there
> generated prototypes in the output, which I don't want in this case.
> Rather, I want to list each function under the global namespace.
> This seems pretty basic so I'm probably missing something obvious.
> Thanks for any help.
> Tim
> --
> You received this message because you are subscribed to the Google Groups "JSDoc Users" group.
> To post to this group, send email to jsdoc-users@googlegroups.com.
> To unsubscribe from this group, send email to jsdoc-users+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/jsdoc-users?hl=en.