Get unlimited public & private packages + package-based permissions with npm Pro.Get started »

comments-extractor

1.0.9 • Public • Published

comments-extractor

NpmVersion Build Status Coverage Status dependencies Status devDependencies Status Greenkeeper badge

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);
// Outputs:
// 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

Install

npm i comments-extractor

DownloadsWeekly Downloads

17

Version

1.0.9

License

MIT

Unpacked Size

13.8 kB

Total Files

18

Last publish

Collaborators

  • avatar