Socket
Socket
Sign inDemoInstall

get-comments

Package Overview
Dependencies
0
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    get-comments

Extract javascript comments on per character basis. Comment object compatible with `acorn-extract-comments` and Esprima format.


Version published
Weekly downloads
13K
decreased by-12.98%
Maintainers
1
Install size
16.4 kB
Created
Weekly downloads
 

Changelog

Source

1.0.1 - 2015-05-30

  • Release v1.0.1 / npm@v1.0.1
  • update travis to test more versions and limit the spam from notifications

Readme

Source

get-comments npmjs.com The MIT License

Extract javascript comments on per character basis. Comment object compatible with acorn-extract-comments and Esprima format.

Notice: It extracts only first level block comments, not include nested comments.

code climate standard code style travis build status coverage status dependency status

Install

npm i get-comments --save
npm test

Usage

For more use-cases see the tests

  • <input> {String} string to extract from
  • [resType] {Boolean} if true, will return array, otherwise object
  • return {Array|Object}

Example

var getComments = require('get-comments');

var input = fs.readFileSync('./fixture.js', 'utf8')
var comments = getComments(input, true)
//=>
// [ {
//   "start": 249,
//   "end": 1353,
//   "type": "Block",
//   "loc": {
//     "start": {
//       "line": 12,
//       "column": 0
//     },
//     "end": {
//       "line": 48,
//       "column": 3
//     }
//   },
//   "value": "*\n * > Filtering incoming request ...",
//   "api": true,
//   "after": "module.exports = function koaIpFilter (options) {"
// }, {
//   "start": 2187,
//   "end": 2267,
//   "type": "Block",
//   "loc": {
//     "start": {
//       "line": 82,
//       "column": 0
//     },
//     "end": {
//       "line": 87,
//       "column": 3
//     }
//   },
//   "value": "*\n * abcd description\n *\n * @name koaIpFilter\n * @param {Object} `options`\n ",
//   "api": false,
//   "after": "exports.data = function () {"
// } ]

See also

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
But before doing anything, please read the CONTRIBUTING.md guidelines.

Charlike Make Reagent new message to charlike freenode #charlike

tunnckocore.tk keybase tunnckocore tunnckoCore npm tunnckoCore twitter tunnckoCore github

Keywords

FAQs

Last updated on 30 May 2015

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc