# js-comments

> Parse JavaScript code comments and generate API documentation.

Latest version **0.5.4** (published 2015-05-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install js-comments
pnpm add js-comments
yarn add js-comments
bun add js-comments
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.5.4 |
| Published | 2015-05-30 |
| First published | 2014-05-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.8 |
| Dependencies | 7 |
| Known vulnerabilities | 0 (+6 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 30 |
| Author | Jon Schlinkert |
| Maintainers | jonschlinkert, doowb |
| Keywords | api, code, comment, comments, doc, docs, document, documentation, javascript, js, markdown, md, parse, readme, repo, verb |

## Links

- npm: https://www.npmjs.com/package/js-comments
- Repository: https://github.com/jonschlinkert/js-comments
- Issues: https://github.com/jonschlinkert/js-comments/issues
- npm.io page: https://npm.io/package/js-comments

## Dependencies (7)

- [write](https://npm.io/package/write.md) ^0.2.0
- [lodash](https://npm.io/package/lodash.md) ^3.7.0
- [relative](https://npm.io/package/relative.md) ^3.0.0
- [arr-union](https://npm.io/package/arr-union.md) ^2.0.1
- [parse-comments](https://npm.io/package/parse-comments.md) ^0.4.1
- [logging-helpers](https://npm.io/package/logging-helpers.md) ^0.4.0
- [js-comments-template](https://npm.io/package/js-comments-template.md) ^0.7.0

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 0.5.4 (latest) — 2015-05-30
- 0.5.3 — 2015-05-28
- 0.5.2 — 2015-04-26
- 0.5.1 — 2015-04-25
- 0.5.0 — 2015-04-25
- 0.4.2 — 2015-04-19
- 0.4.1 — 2015-04-10
- 0.4.0 — 2015-04-02
- 0.3.9 — 2015-02-27
- 0.3.8 — 2015-02-23
- 0.3.7 — 2015-02-23
- 0.3.6 — 2015-02-23
- 0.3.5 — 2015-02-20
- 0.3.4 — 2014-09-01
- 0.3.3 — 2014-08-27
- … 20 more at https://npm.io/package/js-comments/versions

## README

# js-comments [![NPM version](https://badge.fury.io/js/js-comments.svg)](http://badge.fury.io/js/js-comments)  [![Build Status](https://travis-ci.org/jonschlinkert/js-comments.svg)](https://travis-ci.org/jonschlinkert/js-comments)

> Parse JavaScript code comments and generate API documentation.

Install with [npm](https://www.npmjs.com/)

```sh
$ npm i js-comments --save
```

Install with [bower](http://bower.io/)

```sh
$ bower install js-comments --save-dev
```

## Table of Contents

<!-- toc -->

* [Usage](#usage)
* [API](#api)
* [Other awesome projects](#other-awesome-projects)
* [Running tests](#running-tests)
* [Contributing](#contributing)
* [Author](#author)
* [License](#license)

_(Table of contents generated by [verb])_

<!-- tocstop -->

## Usage

```js
var comments = require('js-comments');
```

**Heads up!**, only comments with `@api public` will be rendered!

## API

### [.parse](index.js#L44)

Parse comments from the given `str`.

**Params**

* `str` **{String}**: The string to parse.
* `options` **{Object}**: Options to pass to [parse-comments]
* `returns` **{Array}**: Array of comment objects.

**Example**

```js
var fs = require('fs');
var str = fs.readFileSync('foo.js', 'utf8');
comments.parse(str, options);
```

### [.render](index.js#L60)

Process the given Lo-dash `template` string, passing a `comments` object as context.

**Params**

* `comments` **{Array}**: Array of comment objects.
* `template` **{String}**: The lo-dash template to use.
* `returns` **{String}**

**Example**

```js
comments.render(obj, options);
```

### [.renderFile](index.js#L120)

Write markdown API documentation to the given `dest` from the code
comments in the given JavaScript `src` file.

**Params**

* `src` **{String}**: Source file path.
* `dest` **{String}**: Destination file path.
* `options` **{Object}**
* `returns` **{String}**: API documentation

## Other awesome projects

* [code-context](https://github.com/jonschlinkert/code-context): Parse a string of javascript to determine the context for functions, variables and comments based… [more](https://github.com/jonschlinkert/code-context)
* [esprima-extract-comments](https://github.com/jonschlinkert/esprima-extract-comments): Extract code comments from string or from a glob of files using esprima.
* [extract-comments](https://github.com/jonschlinkert/extract-comments): Extract code comments from string or from a glob of files.
* [parse-code-context](https://github.com/jonschlinkert/parse-code-context): Parse code context in a single line of javascript, for functions, variable declarations, methods, prototype… [more](https://github.com/jonschlinkert/parse-code-context)

## Running tests

Install dev dependencies:

```sh
$ npm i -d && npm test
```

## Contributing

Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/js-comments/issues/new)

## Author

**Jon Schlinkert**

+ [github/jonschlinkert](https://github.com/jonschlinkert)
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)

## License

Copyright © 2014-2015 Jon Schlinkert
Originally modified from scrawl.js. Copyright (c) 2014 [Caolan McMahon](https://github.com/caolan), contributors.
Released under the MIT license.

***

_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on May 29, 2015._

<!-- deps:mocha -->

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