Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/babel-utils/babel-normalize-comments
Merge comments together into a normalized string
https://github.com/babel-utils/babel-normalize-comments
ast babel babylon comments jsdoc normalize
Last synced: about 3 hours ago
JSON representation
Merge comments together into a normalized string
- Host: GitHub
- URL: https://github.com/babel-utils/babel-normalize-comments
- Owner: babel-utils
- License: mit
- Created: 2017-10-27T04:16:22.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2022-05-12T12:07:15.000Z (over 2 years ago)
- Last Synced: 2024-09-18T10:17:52.726Z (about 2 months ago)
- Topics: ast, babel, babylon, comments, jsdoc, normalize
- Language: JavaScript
- Size: 38.1 KB
- Stars: 8
- Watchers: 4
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# babel-normalize-comments
> Merge comments together into a normalized string
Preserves indentation in many different comment styles
## Install
```
yarn add babel-normalize-comments
```## Usage
```
const babylon = require('babylon');
const { normalizeComments, normalizeComment } = require('babel-normalize-comments');let ast = babylon.parse(code);
// normalize an array of comment nodes
normalizeComments(ast.comments);// normalize a single comment node
normalizeComment(ast.comments[0]);
```See [test.js](test.js) for examples of input and output.