extract-comments
Version:
Uses esprima to extract line and block comments from a string of JavaScript. Also optionally parses code context (the next line of code after a comment).
25 lines (19 loc) • 429 B
JavaScript
;
const utils = require('./utils');
const LineComment = require('./line');
/**
* Create a new BlockComment
*
* @param {String} `str` string of JavaScript
* @param {Object} `token` Parsed AST token
*/
class BlockComment extends LineComment {
constructor(str, token) {
super(str, token);
this.value = utils.stripStars(this.raw);
}
}
/**
* expose `BlockComment`
*/
module.exports = BlockComment;