3 points · by tfb · 11y ago · 3 comments
/**
* Adds `b` to `a`.
*
* @param a {Number}
* @param b {Number}
* @return {Number}
* @api public
*/
function add (a, b) {
return a + b;
}
Obviously there are libraries that can do what I'm asking, but I'm having trouble finding the best one(s), so I figured I'd just ask here. :)Now what you might want is something like:
/**
* Adds `b` to `a`.
*
* @param a {Number}
* @param b {Number}
* @return {Number}
* @api public
* @test https://github.com/blah/something/blob/master/test/add_test.js#L53
*
*/
Then the documentation could link out to the specific test or tests for this method. Though if you are going to go this route you will probably want some sort of automated code analysis to find the test locations and link them in. Creating rudimentary documentation from these comments should be trivial.Edit: Found https://github.com/tj/dox, but surely there's a way to convert these comments (with maybe a little extra info) to tests?