如何用JSDoc编写函数文档

How to document functions with JSDoc

本文关键字:函数 文档 何用 JSDoc      更新时间:2023-09-26

JSDoc似乎没有选择我的大多数功能。下面是一个例子:

/**
 * Function one.
 */
(function one() {
    /**
     * Function two.
     */
    function two() {
        /**
         * Function three.
         */
        function three() {
        }
    }
})();
var four = {
    /**
     * Function five/six.
     */
    five: function six() {
    },
    /**
     * Function seven/eight.
     */
    seven: function eight() {
    },
};
nine.ten = {
    /**
     * Function eleven/twelve.
     */
    eleven: function twelve() {
        /**
         * Function thirteen/fourteen.
         */
        var thirteen = function fourteen() {
        };
    },
    /**
     * Function fifteen/sixteen.
     */
    fifteen: function sixteen() {
    },
};
/**
 * Function eighteen
 */
seventeen(function eighteen() {
});
/**
 * Function twenty.
 */
nineteen(function twenty() {
    /**
     * Function twentyTwo.
     */
    twentyOne(function twentyTwo() {
    });
});
/**
 * Function twentyThree.
 */
function twentyThree() {
}

JSDoc只拾取函数23。

我做错了什么?

这是一个将从JSDoc(3)获得更多输出的示例:

/**
 * Function one.
 * @namespace one
 */
(function one() {
    /**
     * Function two.
     * @namespace two
     * @memberof one
     */
    function two() {
        /**
         * Function three.
         * @memberof one.two
         */
        function three() {
        }
    }
})();