如何记录module.exports是函数的模块?

时间:2016-06-02 17:01:27

标签: jsdoc jsdoc3

我试图记录导出函数的节点模块,但是我没有在jsdocs输出中获得对该函数的任何引用。

输出,使用默认模板,看起来像这样:

  

模块:testModule

     

标题下没有任何内容。

这是我迄今为止所做的尝试:

尝试1

/**
 * @module testModule
 */
'use strict';

/**
 * @function module:testModule
 * @param {String} x Log string
 */
module.exports = function(x) {
    console.log(x);
};

尝试2

/**
 * @module testModule
 */
'use strict';

/**
 * @param {String} x Log string
 */
module.exports = function(x) {
    console.log(x);
};

1 个答案:

答案 0 :(得分:0)

嗯,这看起来像个错误,但我找到了解决办法。

仅当您包含说明时才会有效。像这样:

/**
 * @module testModule
 */
'use strict';

/**
 * Some Description
 *
 * @function module:testModule
 * @param {String} x Log string
 */
module.exports = function(x) {
    console.log(x);
};