如何在javascript中评论对象结构?

use*_*919 3 javascript comments

我使用以下语法来评论我的代码,

/*
 * @param variableName {variableType} Description
 * @return {returnType} Description
 */
Run Code Online (Sandbox Code Playgroud)

但我现在不知道如何为我的一个对象的构造函数注释我的代码,因为参数是一个对象,该对象的字典键本身就是一个参数以及该键的值.

我的参数结构如下;

assets: {

    fruits: {

        rootPath: "files/fruits/",

        images: {

            apple: "apple.png",
            kiwi: "kiwi.png",
            orange: "orange.png",
            peach: "peach.png",
            pear: "pear.png",
            strawberry: "strawberry.png",
            watermelon: "watermelon.png"
        }
    },
    humans: {

        audio: {

            atari: "http://www.universal-soundbank.com/mp3/sounds/18534.mp3"
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

我首先评论资产是一个对象

@param assets {Object}
Run Code Online (Sandbox Code Playgroud)

但是,我如何继续评论资产的属性本身就是一个价值.我理解这个问题可能有些偏离主题,但我只是想确保我的代码注释符合某种语法规则,而我无法在此问题上找到任何内容.

pai*_*lee 7

最有用的是将所有对象属性枚举为单独的参数.[Bracket]可选属性,例如:

/**
 *
 * @param {Object} assets Description
 * @param {Object} assets.fruits Description
 * @param {Object} assets.fruits.rootPath Description
 * @param {Object} assets.fruits.images Description
 * @param {Object} [assets.humans] Description
 *
 */
Run Code Online (Sandbox Code Playgroud)

请参阅JSDoc中的 "带属性的参数" .另外如何在jsdoc中描述"对象"参数?.