Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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: 24 days ago
JSON representation

Interpret a string literal at the beginning of a function as its documentation.

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