【问题标题】:How do I document a module where module.exports is a function?如何记录 module.exports 是函数的模块?
【发布时间】:2016-06-03 03:07:30
【问题描述】:

我正在尝试记录导出函数的节点模块,但在我的 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);
};

【问题讨论】:

    标签: jsdoc jsdoc3


    【解决方案1】:

    嗯,这似乎是一个错误,但我找到了解决方法。

    只有在您包含描述时才会起作用。像这样:

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

    【讨论】:

      猜你喜欢
      • 2017-11-05
      • 2014-07-12
      • 1970-01-01
      • 1970-01-01
      • 2015-03-24
      • 2020-07-19
      • 2015-06-21
      • 1970-01-01
      • 2016-07-20
      相关资源
      最近更新 更多