<commit_before># comment-parser

`comment-parser` is a library helping to handle Generic JSDoc-style comments. It is

- **language-agnostic** – no semantic enforced. You may use it anywhere as long as `/** */` comments are supported.
- **no dependencies** – it is compact and environment-agnostic, can be ran on both server and browser sides
- **highly customizable** – with a little of code you can deeply customize how comments are parsed
- **bidirectional** - you can write comment blocks back to the source after updating or formatting
- **strictly typed** - comes with generated `d.ts` data definitions since written in TypeScript

```sh
npm install comment-parser
```

### 💡 Check out the [Playground](https://syavorsky.github.io/comment-parser)

Lib mainly provides two pieces [Parser](#Parser) and [Stringifier](#Stringifier).

## Parser

Lets go over string parsing

```
const { parse } = require('comment-parser/lib')

const source = `
/**
 * Description may go
 * over few lines followed by @tags
 * @param name {string} name parameter
 * @param value {any} value of any type
 */`

const parsed = parse(source)
```
<commit_msg>REDME: 0.x branch notes<commit_after># comment-parser

`comment-parser` is a library helping to handle Generic JSDoc-style comments. It is

- **language-agnostic** – no semantic enforced. You may use it anywhere as long as `/** */` comments are supported.
- **no dependencies** – it is compact and environment-agnostic, can be ran on both server and browser sides
- **highly customizable** – with a little of code you can deeply customize how comments are parsed
- **bidirectional** - you can write comment blocks back to the source after updating or formatting
- **strictly typed** - comes with generated `d.ts` data definitions since written in TypeScript

```sh
npm install comment-parser
```

> 💡 Check out the [Playground](https://syavorsky.github.io/comment-parser)

> 💡 Previous version lives in [0.x](https://github.com/syavorsky/comment-parser/tree/0.x) branch

Lib mainly provides two pieces [Parser](#Parser) and [Stringifier](#Stringifier).

## Parser

Lets go over string parsing

```
const { parse } = require('comment-parser/lib')

const source = `
/**
 * Description may go
 * over few lines followed by @tags
 * @param name {string} name parameter
 * @param value {any} value of any type
 */`

const parsed = parse(source)
```

{'fraction_non_alphanumeric': 0.11376994122586062, 'fraction_numerical': 0.0012594458438287153, 'mean_word_length': 4.319196428571429, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 3, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7260314', 'n_tokens_mistral': 683, 'n_tokens_neox': 652, 'n_words': 292}