在 Javascript 中,我有两个名称相同但参数不同的函数。代码工作正常,但是当我尝试这样做时,jsdoc file.js
或者jsdoc2md file.js
我得到一个错误Identifier 'info' has already been declared
。
解决方案是什么?
/**
* Emits a log message with the added message. Level: 'info' (Same as log)
* @function
* @param {String} message The message.
*/
async function info(message) {
winstonLogger.log('info', message);
}
/**
* Emits a log message with the added message and title. Level: 'info'
*
* Example: Thu, 19 Nov 2020 13:08:54 GMT | title | message |
* @function
* @param {String} message The message.
* @param {String} title A title that will appear in the first seaction as an event definer.
*/
async function info(message, title) {
winstonLogger.log('info', message, {title});
}