no-comment
v0.0.2
Published
Remove C and C++ style comments from a file
Downloads
2
Readme
no-comment
Remove C and C++ style comments and any surrounding whitespace.
/*
C style multi-line block comment
*/
// C++ style single-line comment
Note that the regular expressions used here are fairly naive and sacrifice some correctness to reduce incorrect matches.
Usage
JavaScript
var noComment = require('no-comment');
var fs = require('fs');
var output = noComment(fs.readFileSync('foo.txt').toString());
console.log(output);
Shell
no-comment source_file [target_file]
Note that output goes to stdout if target_file
is omitted.