In Javascript I have two functions with the same name but with different params. The code working properly but when I try to do jsdoc file.js
or jsdoc2md file.js
I get an error that Identifier 'info' has already been declared
.
What would be the solution for this?
/**
* 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});
}
although technically valid, this Javascript should be considered broken as the second info
function overwrites the first.. this is not a bug with either jsdoc or jsdoc2md.