don't crash if a file does not contain any comments (#368)

This commit is contained in:
Jeff Williams 2013-03-21 12:41:04 -07:00
parent ef4ba57adb
commit f0224e9845

View File

@ -10,6 +10,8 @@ exports.handlers = {
beforeParse: function(e) {
// a JSDoc comment looks like: /**[one or more chars]*/
var comments = e.source.match(/\/\*\*[\s\S]+?\*\//g);
e.source = comments.join('\n\n');
if (comments) {
e.source = comments.join('\n\n');
}
}
};