strip slash style comments, and can be used for JSON
, JavaScript
, C++
, C
files and more.
$ npm install strip-slash-style-comment
var decommented = decomment(input, {
strategy: 'remove'
});
where input
can be a string literal
or data from a source file
.
decomment(input, [options])
Type: string
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.
$ npm run test