1.0.10 • Published 3 years ago

comments-extractor v1.0.10

Weekly downloads
56
License
MIT
Repository
github
Last release
3 years ago

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.

ParameterTypeDefaultDescription
patternstringGlob pattern
annotationstring''Annotation
optionsObject{}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

1.0.10

3 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.5

5 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago