Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gyumeijie/strip-slash-style-comment
strip slash style comments, and can be used for JSON, JavaScript, C++, C file and more.
https://github.com/gyumeijie/strip-slash-style-comment
c-style json remove-comment remove-comments slash-comment slash-style-comments strip-comment strip-comments
Last synced: about 1 month ago
JSON representation
strip slash style comments, and can be used for JSON, JavaScript, C++, C file and more.
- Host: GitHub
- URL: https://github.com/gyumeijie/strip-slash-style-comment
- Owner: Gyumeijie
- License: mit
- Created: 2018-10-20T18:00:19.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2018-10-22T02:03:26.000Z (about 6 years ago)
- Last Synced: 2023-12-27T11:24:28.957Z (about 1 year ago)
- Topics: c-style, json, remove-comment, remove-comments, slash-comment, slash-style-comments, strip-comment, strip-comments
- Language: JavaScript
- Homepage:
- Size: 5.86 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# strip-slash-style-comment
strip slash style comments, and can be used for `JSON`, `JavaScript`, `C++`, `C` files and more.# Install
```bash
$ npm install strip-slash-style-comment
```# Usage
```js
var decommented = decomment(input, {
strategy: 'remove'
});
```
where `input` can be a `string literal` or data from a `source file`.# API
**decomment(input, [options])**##### input
Type: `string`##### options
Type: `object`- strategy
Specify how to handle with comments, the default is doing nothing. `remove`: remove comments; `replace-with-whitespace`:
replace comments with whitespace, this allows us locate error positions as close as possible to the original source.# Test
```
$ npm run test
```