Custom tags for objects in jsdoc

How can objects of this style be documented in jsdoc:

/**

*/

var strings = 
{
    /**

    */  
    stripHTML: function(html)
    {
        //does something
    },
    /**

    */
    validHTML: function(html)
    {
        //does something else
    }
}

Namely, the correct parameter for determining the object and recognition of subfunctions as part of the "lines". I know about @param, @return, etc., I just don’t know the basic definition for this type of object.

+3
source share
2 answers

I would use @namespace for "strings"

methods will just use @function (although for jsdoc it’s obvious that they

Edit In your specific example, you can use something like:

/**
    describe purpose
*/
String.prototype.stripHTML = function()
{
    //does something with this
}

/**
    describe purpose
*/
String.prototype.validHTML = function()
{
    //does something else with this
}

then used as follows:

var str = "bob<br/>";
str = str.stripHTML();
+2
source

- , . , , . , @Jonathan.

/**
 * @namespace
 * Custom String functions
 */
var strings = 
{
    /**
     * Strips the HTML away
     */  
    stripHTML: function(html)
    {
        //does something
    },

    /**
     * Ensures the HTML is valid
     */
    validHTML: function(html)
    {
        //does something else
    }
}

JSDoc-Toolkit , .

+2

Source: https://habr.com/ru/post/1710382/


All Articles