https://github.com/hackergrrl/docstrings
Interpret a string literal at the beginning of a function as its documentation.
https://github.com/hackergrrl/docstrings
Last synced: 4 months ago
JSON representation
Interpret a string literal at the beginning of a function as its documentation.
- Host: GitHub
- URL: https://github.com/hackergrrl/docstrings
- Owner: hackergrrl
- Created: 2016-08-13T17:40:45.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2016-08-15T17:28:48.000Z (about 9 years ago)
- Last Synced: 2025-06-18T21:18:10.366Z (5 months ago)
- Language: JavaScript
- Homepage:
- Size: 5.86 KB
- Stars: 16
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# docstrings
> Interpret a string literal at the beginning of a function as its
> documentation.
## Usage
```js
var doc = require('docstrings')
function foo () {
"returns foo"
return 'foo'
}
console.log(doc(foo))
```
This will output
```
returns foo
```
## API
```js
var doc = require('docstrings')
```
### doc(func)
Returns a string matching the string literal at the beginning of a function.
Matches `""` and `''` literals as well as template strings.
## Install
With [npm](https://npmjs.org/) installed, run
```
$ npm install docstrings
```
## Acknowledgments
docstrings was inspired by clojure's approach to documenting functions.
## License
ISC