Skip to content

moagrius/stripcomments

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple JS parser to strip comments

// this is a comment

/* this
 * is a multiline
 * comment
*/

Usage is simple - create an instance and call .strip(string) to get back the de-commented string...

var cs = new CommentStripper();
console.log( cs.strip(someString) );

It's intended to be 100% effective - catching any valid comment, including:

var a = 10; // comment
var a = "http://www.github.com"; // more comments
var a = function(arg /*, ...rest */)

etc.

I've tested it a bit against use-cases I could think of, and tried it against a few common libraries (e.g., the dev version of jQuery), and it seems fine, but I'd be interested to hear if anyone breaks it.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published