Skip to content

Commit

Permalink
Fix invalid regular expressions in removePaths function.
Browse files Browse the repository at this point in the history
  • Loading branch information
rjm101 committed Sep 6, 2014
1 parent e83cc33 commit 789d45f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,14 @@ function rewriteSourcemapPaths (compileDir, relativePath, cb) {
});
}

function escapeRegExp(string) {
return string.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, '\\$1');
}

function removePaths(msg, paths) {
paths.forEach(function (path) {
msg = msg.replace(new RegExp(path + '/?', 'g'), '');

msg = msg.replace(new RegExp(escapeRegExp(path), 'g'), '');
});

return msg;
Expand Down

0 comments on commit 789d45f

Please sign in to comment.