Skip to content

Commit

Permalink
don't crash if a file does not contain any comments (jsdoc#368)
Browse files Browse the repository at this point in the history
  • Loading branch information
hegemonic committed Mar 21, 2013
1 parent ef4ba57 commit f0224e9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion plugins/commentsOnly.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
}
};

0 comments on commit f0224e9

Please sign in to comment.