comments-extractor

1.0.10 • Public • Published

comments-extractor

npm CI Coverage Status

Extract comments from glob of files, annotated or not.

Quick Start

Install

npm install comments-extractor

Use

const CommentsExtractor = require('comments-extractor');
const extractor = new CommentsExtractor('./**/*.js', 'todo');
const todos = extractor.extract();

console.log(todos);
// Output:
// Map {
//   './example-block.js' => [ { type: 'Block', value: '*\n * @TODO: Write this block.\n ' } ],
//   './example-line.js' => [ { type: 'Line', value: ' @TODO: Write this line.' } ]
// }

API

CommentsExtractor

Comments Extractor class.

Kind: global class


new CommentsExtractor(pattern, [annotation], [options], [esprimaClass], [fsClass], [globClass])

Comments Extractor constructor.

Parameter Type Default Description
pattern string Glob pattern
[annotation] string '' Annotation
[options] Object {} Glob options
[esprimaClass] * esprima
[fsClass] * fs
[globClass] * glob

extract()Map.<string, Array>

Extract comments.

Kind: instance method of CommentsExtractor

Returns: Map.<string, Array>, where key is a filepath and value is an array of comments

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.10
    2
    • latest

Version History

Package Sidebar

Install

npm i comments-extractor

Weekly Downloads

9

Version

1.0.10

License

MIT

Unpacked Size

14.2 kB

Total Files

19

Last publish

Collaborators

  • loginov-rocks