Questions tagged [jsdoc3]

JSDoc3 is an API documentation generator for JavaScript. It can be customised via a plugin mechanism and the output can be controlled via templates. It is written in Javascript and can be run with Node.js or Rhino.

JSDoc 3

JSDoc3 is an API documentation generator for JavaScript. It can be customised via a plugin mechanism and the output can be controlled via templates.

It is written in Javascript and can be run with Node.js or Rhino.

The tool can be found at https://github.com/jsdoc3/jsdoc

The documentation can be found at http://usejsdoc.org/

294 questions
244
votes
3 answers

JSDoc: Return object structure

How can I tell JSDoc about the structure of an object that is returned. I have found the @return {{field1: type, field2: type, ...}} description syntax and tried it: /** * Returns a coordinate from a given mouse or touch event * @param …
103
votes
5 answers

What's the proper way to document callbacks with jsdoc?

I've spent quite a while scouring the internet looking for the best way to properly document callbacks with jsdoc, but unfortunately, I haven't found a great one yet. Here's my question: I'm writing a Node.js library for developers. This library…
rdegges
  • 32,786
  • 20
  • 85
  • 109
73
votes
5 answers

Enum as @param type in JSDoc

Is it possible to use an enum for the JSDoc @param type declaration like in the following example? /** * @enum { Number } */ const TYPES = { TYPE_A: 1, TYPE_B: 2 } /** * @param { TYPES } type */ function useTypesEnum( type ) { …
BuZZ-dEE
  • 6,075
  • 12
  • 66
  • 96
55
votes
4 answers

How to document a function returned by a function using JSDoc

I am using JSDoc for parameter documentation. It is clear how to document the parameter types for many_prompts, but what is the right way to document the function it returns? /** * @param {Number} - number of times to prompt * @return…
Aminadav Glickshtein
  • 23,232
  • 12
  • 77
  • 117
50
votes
5 answers

What is the correct JSDoc syntax for a local variable?

For a function like this... function example() { var X = 100; ... var Y = 'abc'; ... return Z; } I need to explain the purpose of some of the local variables. Adding a description like this... function example() { /** *…
Kirkland
  • 2,319
  • 4
  • 20
  • 27
48
votes
4 answers

How do I JSDoc A Nested Object's Methods?

I've been trying to use JSDoc3 to generate documentation on a file, but I'm having some difficulty. The file (which is a Require.js module) basically looks like this: define([], function() { /* * @exports mystuff/foo */ var foo =…
machineghost
  • 33,529
  • 30
  • 159
  • 234
33
votes
2 answers

JSDoc with AngularJS

Currently within my Project we are using JSDoc, we have recently started to implement Angular and I want to continue using JSDoc to ensure that all the documentation is within the same place. I have taken a look at people mainly just saying to use…
Nick White
  • 1,602
  • 4
  • 20
  • 35
31
votes
3 answers

JSDocs: Documenting Node.js express routes

I am struggling documenting router.get calls with JSDocs. I am unable to get the documentation to display correctly on the page if I try to append it to my router call itself. /** * Health check * @memberof health */ router.get('/happy',…
Soatl
  • 10,224
  • 28
  • 95
  • 153
29
votes
1 answer

Nested Methods in sidebar of JSDoc

Thanks to the answer found here: https://stackoverflow.com/a/19336366/592495 My JavaScript documentation is well-organized and well-formatted. Each namespace is a "parent" of methods contained within. However, navigation is not quite as granular as…
Greg Pettit
  • 10,749
  • 5
  • 53
  • 72
27
votes
5 answers

Default "Home" text and content for JSDoc

After running a basic JSDoc compile/render from Node.js: jsdoc file1.js file2.js I get a well-formatted document using the default template inside a directory "out". Almost all is as expected! But when opening the document, it always says "Home" on…
Greg Pettit
  • 10,749
  • 5
  • 53
  • 72
26
votes
2 answers

JsDoc: How do I document that an object can have arbritrary (unknown) properties but with a particular type?

This is a similar to question 30360391. I want to express that the parameter of a function is a plain JS object that can have arbitrary properties (with unknown) names but all properties are objects themselves with fixed properties. An example: The…
user2690527
  • 1,729
  • 1
  • 22
  • 38
26
votes
1 answer

Do primitive type names need to be uppercase or lowercase?

/** * @param {String} foo * @param {Number} bar */ or /** * @param {string} foo * @param {number} bar */ JSDoc @type documentation is not being explicit about it. I always uppercase String and Number because it is my understanding that I…
Gajus
  • 69,002
  • 70
  • 275
  • 438
24
votes
1 answer

How to document an array of objects in JSDOC

I have a function with an array of objects as parameter and would like to describe the parameter (including the properties of the objects in the array) using JSDOC like in this example: /** * @param {Array.} filter - array of filter…
doberkofler
  • 9,511
  • 18
  • 74
  • 126
23
votes
5 answers

JSDoc - how to document prototype methods

I've been trying to document the following code using JSDoc: /** * @module person */ /** * A human being. * @class * @param {string} name */ function Person(name){ this.name = name } Person.prototype = new function(){ var…
20
votes
4 answers

jsdoc: multiline description @property

I am documenting my code using jsdoc, so far so good, I have a comment like below ... * @property {string} mode - mode of display 'video' - display video or 'audio' - play only the audio. * @property... and it comes in html document like | ... …
mido
  • 24,198
  • 15
  • 92
  • 117
1
2 3
19 20