writer
writer copied to clipboard
JavaScript exported functions get limited results
trafficstars
An exported function simply gets a descriptive comment:
/* Adding a transaction to the database. */
exports.addTransaction = async (data) => {
try {
return await db.addDoc({ collection: 'transactions', data })
} catch (error) {
console.error(error)
return false
}
}
If I don't directly export the function I get a JsDoc result:
/**
* It takes in a data object, and then it returns the result of the db.addDoc function, which is either
* true or false
* @param data - The data to be added to the database.
* @returns The return value of the function is the return value of the db.addDoc function.
*/
const addTransaction = async (data) => {
try {
return await db.addDoc({ collection: 'transactions', data })
} catch (error) {
console.error(error)
return false
}
}
I just heard about this plugin on Medium. I'm very excited to see this because it will definitely save me a TON of time! Thank you so much!!! 👍🏻