Extract javascript code comments with esprima. Thin wrapper to prove a simple interface for getting code comments from a string, file or glob of files.
Installations
npm install esprima-extract-comments
Developer Guide
Typescript
No
Module System
CommonJS
Min. Node Version
>=4
Node Version
9.1.0
NPM Version
5.6.0
Score
98.7
Supply Chain
100
Quality
77.7
Maintenance
100
Vulnerability
100
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Developer
jonschlinkert
Download Statistics
Total Downloads
10,683,768
Last Day
8,270
Last Week
39,650
Last Month
178,257
Last Year
2,787,429
GitHub Statistics
14 Stars
25 Commits
1 Forks
3 Watching
2 Branches
2 Contributors
Bundle Size
132.31 kB
Minified
29.30 kB
Minified + Gzipped
Package Meta Information
Latest Version
1.1.0
Package Id
esprima-extract-comments@1.1.0
Size
3.31 kB
NPM Version
5.6.0
Node Version
9.1.0
Publised On
12 Feb 2018
Total Downloads
Cumulative downloads
Total Downloads
10,683,768
Last day
-10.8%
8,270
Compared to previous day
Last week
-17.2%
39,650
Compared to previous week
Last month
2.5%
178,257
Compared to previous month
Last year
13.5%
2,787,429
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
1
Dev Dependencies
2
esprima-extract-comments
Extract code comments from string or from a glob of files using esprima.
Please consider following this project's author, Jon Schlinkert, and consider starring the project to show your :heart: and support.
Install
Install with npm:
1$ npm install --save esprima-extract-comments
Breaking changes in v1.0.0!
- line
comment.type
was changed fromline
toLineComment
- block
comment.type
was changed fromblock
toBlockComment
Usage
Add to your Node.js/JavaScript project with the following line of code:
1const extract = require('esprima-extract-comments');
API
extract
Extract line and block comments from a string of JavaScript.
Params
string
{String}options
{Object}: Options to pass to esprima.returns
{Array}: Array of code comment objects.
Example
1console.log(extract('// this is a line comment'));
2// [ { type: 'Line',
3// value: ' this is a line comment',
4// range: [ 0, 25 ],
5// loc: { start: { line: 1, column: 0 }, end: { line: 1, column: 25 } } } ]
.file
Extract code comments from a JavaScript file.
Params
file
{String}: Filepath to the file to parse.options
{Object}: Options to pass to esprima.returns
{Array}: Array of code comment objects.
Example
1console.log(extract.file('some-file.js'), { cwd: 'some/path' }); 2// [ { type: 'Line', 3// value: ' this is a line comment', 4// range: [ 0, 25 ], 5// loc: { start: { line: 1, column: 0 }, end: { line: 1, column: 25 } } } ]
About
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Running Tests
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
1$ npm install && npm test
Building docs
(This project's readme.md is generated by verb, please don't edit the readme directly. Any changes to the readme must be made in the .verb.md readme template.)
To generate the readme, run the following command:
1$ npm install -g verbose/verb#dev verb-generate-readme && verb
Related projects
You might also be interested in these projects:
- extract-comments: Uses esprima to extract line and block comments from a string of JavaScript. Also optionally… more | homepage
- js-comments: Parse JavaScript code comments and generate API documentation. | homepage
- parse-comments: Parse code comments from JavaScript or any language that uses the same format. | homepage
Author
Jon Schlinkert
License
Copyright © 2018, Jon Schlinkert. Released under the MIT License.
This file was generated by verb-generate-readme, v0.6.0, on February 12, 2018.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
no SAST tool detected
Details
- Warn: no pull requests merged into dev branch
Reason
Found 0/25 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Score
3
/10
Last Scanned on 2025-01-27
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More