# self-doc

> Self document library for node 5+

Latest version **1.0.0** (published 2016-03-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install self-doc
pnpm add self-doc
yarn add self-doc
bun add self-doc
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2016-03-24 |
| First published | 2016-03-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Connor McCutcheon |
| Maintainers | ccutch |

## Links

- npm: https://www.npmjs.com/package/self-doc
- Repository: git@github.com/ccutch/self-doc
- npm.io page: https://npm.io/package/self-doc

## Dependencies (5)

- [bluebird](https://npm.io/package/bluebird.md) ^3.3.4
- [babel-core](https://npm.io/package/babel-core.md) ^6.7.4
- [fs-promise](https://npm.io/package/fs-promise.md) ^0.5.0
- [babel-preset-es2016-node5](https://npm.io/package/babel-preset-es2016-node5.md) ^1.1.2
- [babel-preset-async-to-bluebird](https://npm.io/package/babel-preset-async-to-bluebird.md) ^1.0.0

## Recent versions

- 1.0.0 (latest) — 2016-03-24

## README

# Self Doc

This is a self documenting library build for documenting and testing Node applications, based on golang's [godoc](https://godoc.org/golang.org/x/tools/cmd/godoc). I was inspired to start this project after not being unimpressed by other documentation tools such as jsdoc. This library is meant to run in a Node 5+ environment.

## Installation

`npm install -g self-doc`


### Usage
Generate documentation for given files to docs directory
<br>
`self-doc doc -o docs <input>`

Generate tests for given files to tests directory
<br>
`self-doc test -o tests <input>`


### Expected Behavior
For a more detailed description of expect outputs reference specs directory
<br>
This example is for a public function.

**Input:**
```javascript
// ====
// @name Validate Name
// validateName(string) => boolean
// Validates the name of a person.
// @run
//  const name = "Connor McCutcheon"
//  assert(validateName(name), true)
//  assert(validateName("0$!@#"), false)
export function validateName(input) {
  return /^[a-zA-Z ]+$/.test(input)
}
```

<br>
**Output Documentation:**
```html
...
<section id="validateName">
  <h2>Validate Name</h2>
  <code>validateName(input: string): boolean</code>
  <p>
    Validates the name of a person.
  </p>
  <h4>Example:</h4>
  <pre>
    <code>
import { validateName } from "base-file"

const name = "Connor McCutcheon"
assert(validateName(name) === true)
assert(validateName("0$!@#") === false)
    </code>
  </pre>
</section>
...
```

<br>
**Output Test:**
```javascript
// Test imports and setup above ...
import { validateName } from "base-file"
const tester = {}

describe("#validateName", () => {
  it("should run basic use case", () => {
    const name = "Connor McCutcheon"
    assert(validateName(name) === true)
    assert(validateName("0$!@#") === false)
  })
})
```

### Contributing
If you would like to contribute to this project all help is welcome please just fork this and make a pull request. Please follow this the git naming convension below and use eslint (config file provided) for code styling. If you run into an issue report in this repositories issues and I will respond as soon as posible.

**Git branch naming**
 + Feature branch: `feature/<name>`
 + Hotfix branch: `hotfix/<name>`
 + Refactoring/Cleaning: `refactoring/<name>`

---
_Source: https://npm.io/package/self-doc · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
