Skip to content

Commit

Permalink
freeCodeCamp#1434 Fix bug when removing comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
g8d3 committed Aug 1, 2015
1 parent 7b85031 commit 6d6da7f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions public/js/lib/coursewares/coursewaresJSFramework_0.0.6.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,10 @@ var scrapeTests = function(userJavaScript) {
};

function removeComments(userJavaScript) {
var regex = new RegExp(/(\/\*[^(\*\/)]*\*\/)|\/\/[^\n]*/g);
return userJavaScript.replace(regex, '');
var singleLineComment = new RegExp("^ *//.*$", 'g'),
multiLineComment = new RegExp(/^ *\/\*[\s\S]*\*\//g);
return userJavaScript.replace(singleLineComment, '')
.replace(multiLineComment, '');
}

function removeLogs(userJavaScript) {
Expand Down

0 comments on commit 6d6da7f

Please sign in to comment.