Menu
  • HOME
  • TAGS

JsDoc: Remove “static” tag from property

javascript,jsdoc

There is @instance, see the documentation // Edit: Working example /** * @constructor */ function Graph() { var nodes = []; Object.defineProperties(this, { /** * An array of all node handles in the graph * @return {Array} * @memberof Graph * @instance */ nodes: { get: function() { var ids...

JSDoc: Annotating an exported method

javascript,annotations,documentation-generation,jsdoc

I would reduce it to: /** * My Cool Object * @constructor */ function MyCoolObject() { /** * Cool Method, private * @param {!string} parameter */ this.exportedMethod = function (parameter) { // do stuff }; } You can do var localMethod = this.exportedMethod right after if you want a local...

jsdoc doesn't trust @param declarations

jsdoc

Apparently jsdoc will only include @param and @return docs if it considers the documented item to be a function. You can force this behavior by specifying @function in the doc comment. So this worked: /** @namespace */ var util = { /** * Repeat <tt>str</tt> several times. * @function <----...

JSDoc - Correct way to document a method which potentially returns any type?

javascript,jsdoc

You may use asterisk in JSDoc @returns {*} Or also, if you know all possible types, you can separate them by pipes @returns {String|Number|Boolean} ...

Famo.us - Documenting a 'curve' function

javascript,documentation,javadoc,jsdoc,famo.us

Looking at Lightbox.js, it looks like the type for transitions is just Transition.. eg. line 32 of Lightbox.js * @param {Transition} [options.inTransition=true] The transition in charge of showing a renderable. If you are animating opacity, I am assuming you want the user or OP (or yourself ;)) to interact as...

Angular parameter types on jsdoc

angularjs,ide,phpstorm,webstorm,jsdoc

Jetbrains products cannot do this by analyzing the code, there's too much magic in Angular's dependency injection system. However, you can do it by installing a typed library in at least Webstorm and PyCharm (probably PHPStorm and other Jetbrains products as well): Go to Preferences > Languages & Frameworks >...

Reuse documentation from another namespace

jsdoc

Right now, JSDoc doesn't provide a way to inherit another symbol's documentation. For JSDoc 3.3.0 (the next major version), I plan to implement this feature by adding support for an @inheritdoc tag. This feature is tracked as issue #53 in JSDoc's GitHub repo....

How to parse JSDoc

java,javascript,parsing,polymer,jsdoc

There are several JSDoc parsers out there. Take a look into doctrine and jsdoc-parse for example.

Syntax highlight feature for Grunt-ngdocs

angularjs,syntax-highlighting,jsdoc

Workaround: marked module is used in grunt-ngdocs (grunt-ngdocs\node_modules\marked\lib). Since grunt-ngdocs uses angular-bootstrap-prettify (which BTW uses google-code-prettify), it's enough to tweak marked a little in order to produce <pre class="prettyprint linenums">...</pre> instead of <pre>...</pre>. So at Renderer.prototype.code function (line 757 at my version), return statements can change like this: return '<pre...

What is the proper/canonical formatting of long JSDoc lines?

jsdoc

There are two proper ways of dealing with line breaks in JSDoc. The first, apparently used by Google, is to indent the lines after the first: /** * @param {string} author - The author of the book, presumably some * person who writes well and does so for a living....

How do document a class that is returned from a function call with jsDoc

jsdoc

It turns out that using the latest version of jsdoc from npm solved the problem, and it recognizes that these methods are part of the given class if properly annotated with @function

Syntax to use to document the fields of a function parameter which is an object

javascript,jsdoc,jsdoc3

If I understood correctly square brackets mean "optional", is that right? You understood correctly. Is the syntax I used to describe the object properties valid? jsdoc understands your syntax so I would call it "valid". The reqSettings.retryInterval property is a number, but I was unable to find a way...

Documenting an array of objects as a parameter of callback function in JSDoc

javascript,callback,jsdoc

Try: /**@param {string[]} callback.rows*/ Note that you can put any type there, not just string... Such as /**@param {{field1: string}[]} callback.rows */ ...

How do I define the @param callback {Function}'s expected parameters in IntelliJ?

intellij-idea,jsdoc

Intellij (and the family of editors) support the Google Closure Compiler syntax. So you'd do something like this: /** * @param {function(Number, String)} bar */ function foo(bar) {}; Note the lowercase f in function....

Is there an official order for JSDoc tags in documentation?

javascript,tags,order,jsdoc,google-style-guide

There's no official order for JSDoc tags. I tend to put more general tags first, followed by more specific tags, similar to your first example. In general, JSDoc doesn't care about the tag order, but there are a few notable exceptions: Any text before the first tag will be used...

JSDoc, referring to identifiers in a function description

javascript,jsdoc

You have to mark them up yourself. The basic way to do this is to use HTML markup: <code>page</code> If you are using jsdoc 3.x, it is also possible to turn on the Markdown plugin and use Markdown markup `page`....

Document mid-function optional parameters

javascript,google-closure,jsdoc,jsdoc3

Annotating optional parameters in the middle of a function's parameter list are almost as challenging as maintaining code that uses this type of method signature. Javascript doesn't truly support optional parameters in the middle of a function's argument list (to do that you need named parameters). Instead, functions that advertise...

Define same type for multiple variables, recognition in Webstorm

javascript,webstorm,jsdoc

Please vote for WEB-12376 to be notified on updates. I'd suggest using inline docs (https://code.google.com/p/jsdoc-toolkit/wiki/InlineDocs) as a workaround: var /** String*/ foo, /**String*/ bar; ...

Default “Home” text and content for JSDoc

javascript,jsdoc,jsdoc3

Generate Home page Create markdown file README.md Generating jsdoc: $ jsdoc path/to/js path/to/readme/README.md To read more about this visit official documentation Change 'Home' text I don't think this is a proper way to do it but this works. If you have jsdoc installed in your project find template file in...

Closure annotation for variadic function

javascript,annotations,google-closure-compiler,jsdoc,variadic-functions

"f5" is the expected pattern. /** * @param {...*} var_args * @return {number} */ function f5(var_args) { return arguments.length; } An alternative is: /** @type {function(...*):number} */ function f5() { return arguments.length; } ...

Confusion of WebStorm type recognition of function return types

javascript,webstorm,jsdoc

It's a bug. WEB-13724 is fixed, fix will be included in WebStorm 10

How to document a function returned by a function using JSDoc

javascript,jsdoc,jsdoc3

You can document the inner function and then reference it like so /** * @param {Number} - number of times to prompt * @return {many_prompts~inner} - the returned function * / function many_prompts(count){ /** * My inner function * * @param {object} prompt Some parameter */ var inner = function(prompt){...

Documenting mongoose model methods with jsdoc

mongoose,jsdoc,jsdoc3

You have to be explicit about the module: @memberof module:models~MySchema The fact is that jsdoc is not going to infer that when you specify MySchema you mean the MySchema entity which is in the current module. Same with @this, actually. If you modify it to have the module name, then...