esprima-extract-comments
Advanced tools
Comparing version 1.0.1 to 1.1.0
17
index.js
@@ -33,3 +33,18 @@ /*! | ||
const tokens = esprima.tokenize(str, Object.assign({}, defaults, options)); | ||
return tokens.filter(isComment); | ||
const comments = []; | ||
for (let i = 0; i < tokens.length; i++) { | ||
let n = i + 1; | ||
const token = tokens[i]; | ||
let next = tokens[n]; | ||
if (isComment(token)) { | ||
if (token.type === 'BlockComment') { | ||
while (next && /comment/i.test(next.type)) next = tokens[++n]; | ||
token.codeStart = next && !/(comment|punc)/i.test(next.type) ? next.range[0] : null; | ||
} | ||
comments.push(token); | ||
} | ||
} | ||
return comments; | ||
} | ||
@@ -36,0 +51,0 @@ |
{ | ||
"name": "esprima-extract-comments", | ||
"description": "Extract code comments from string or from a glob of files using esprima.", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"homepage": "https://github.com/jonschlinkert/esprima-extract-comments", | ||
@@ -6,0 +6,0 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9453
73