Interpret a string literal at the beginning of a function as its documentation.
var doc = require('docstrings')
function foo () {
"returns foo"
return 'foo'
}
console.log(doc(foo))
This will output
returns foo
var doc = require('docstrings')
Returns a string matching the string literal at the beginning of a function.
Matches ""
and ''
literals as well as template strings.
With npm installed, run
$ npm install docstrings
docstrings was inspired by clojure's approach to documenting functions.
ISC