Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jweinst1/commentfarmer
A Javascript Parser for Javascript style comments
https://github.com/jweinst1/commentfarmer
comments javascript parsing-library
Last synced: 6 days ago
JSON representation
A Javascript Parser for Javascript style comments
- Host: GitHub
- URL: https://github.com/jweinst1/commentfarmer
- Owner: jweinst1
- License: mit
- Created: 2017-09-02T00:08:15.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2017-09-02T00:18:15.000Z (about 7 years ago)
- Last Synced: 2024-10-15T09:27:54.412Z (about 1 month ago)
- Topics: comments, javascript, parsing-library
- Language: JavaScript
- Size: 2.93 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CommentFarmer
## Intro
`CommentFarmer` is a node package that can parse out single or multi line comments from javascript or other languages which use the `//` or `/* */` system for denoting comments. Is it available on NPM for installation.
## Installation
To install type in your shell
```
$ npm install commentfarmer
```## Usage
To initalize on instance of the parser,
```javascript
var ps = require('commentfarmer');
var parser = new ps.JSCommentParser();
```to parse a string,
```javascript
parser.parse("var g = 7; //this line assigns a variable\n var h = 7 //so does this one\n");
```to get the comments or clear them,
```javascript
console.log(parser.getComments()); // 'this line assigns a variable, so does this one'
parser.clearComments();
```## License
This code is MIT licensed
## Contribution
Feel free to suggest changes or contribute