Uses babel to extract JavaScript code comments from a string. Returns an array of comment objects, with line, column, index, comment type and comment string.
Installations
npm install babel-extract-comments
Developer Guide
Typescript
No
Module System
CommonJS
Min. Node Version
>=4
Node Version
9.1.0
NPM Version
5.6.0
Score
99.3
Supply Chain
100
Quality
74.9
Maintenance
100
Vulnerability
100
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Developer
jonschlinkert
Download Statistics
Total Downloads
556,793,123
Last Day
129,072
Last Week
606,391
Last Month
3,160,251
Last Year
48,863,389
GitHub Statistics
14 Stars
10 Commits
2 Forks
4 Watching
1 Branches
3 Contributors
Bundle Size
120.89 kB
Minified
32.90 kB
Minified + Gzipped
Package Meta Information
Latest Version
1.0.0
Package Id
babel-extract-comments@1.0.0
Size
3.21 kB
NPM Version
5.6.0
Node Version
9.1.0
Publised On
12 Feb 2018
Total Downloads
Cumulative downloads
Total Downloads
556,793,123
Last day
-8.4%
129,072
Compared to previous day
Last week
-28.9%
606,391
Compared to previous week
Last month
5.1%
3,160,251
Compared to previous month
Last year
-33.4%
48,863,389
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
1
Dev Dependencies
2
babel-extract-comments
Uses babel (babylon) to extract JavaScript code comments from a JavaScript string or file.
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 babel-extract-comments
Usage
Add to your Node.js/JavaScript project with the following line of code:
1const extract = require('babel-extract-comments');
API
extract
Extract code comments from the given string
.
Params
string
{String}: String of javascriptreturns
{Array}: Array of code comment objects.
Example
1var extract = require('babel-extract-comments'); 2console.log(extract('// this is a code comment')); 3// [{ type: 'CommentBlock', 4// value: '!\n * babel-extract-comments <https://github.com/jonschlinkert/babel-extract-comments>\n *\n * 5// Copyright (c) 2014-2018, Jon Schlinkert.\n * Released under the MIT License.\n ', 6// start: 0, 7// end: 173, 8// loc: SourceLocation { start: [Position], end: [Position] } }]
.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:
- esprima-extract-comments: Extract code comments from string or from a glob of files using esprima. | homepage
- 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
Contributors
Commits | Contributor |
---|---|
4 | jonschlinkert |
1 | eventualbuddha |
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
Found 1/9 approved changesets -- score normalized to 1
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
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
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
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 2 are checked with a SAST tool
Score
3.2
/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