No description or website provided.
Latest commit 535fc52 Mar 5, 2016 @moagrius Create LICENSE
Failed to load latest commit information.
.gitattributes initial commit Feb 16, 2013
.gitignore initial commit Feb 16, 2013
LICENSE Create LICENSE Mar 5, 2016 Update Feb 16, 2013
strip-comments.js fix formatting yet again May 1, 2015

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 = ""; // more comments
var a = function(arg /*, */)


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.