convertComments.js 472 B

1234567891011121314151617
  1. "use strict";
  2. module.exports = function(comments) {
  3. for (var i = 0; i < comments.length; i++) {
  4. var comment = comments[i];
  5. if (comment.type === "CommentBlock") {
  6. comment.type = "Block";
  7. } else if (comment.type === "CommentLine") {
  8. comment.type = "Line";
  9. }
  10. // sometimes comments don't get ranges computed,
  11. // even with options.ranges === true
  12. if (!comment.range) {
  13. comment.range = [comment.start, comment.end];
  14. }
  15. }
  16. };