Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

extract-comments

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

extract-comments

Extract code comments from string or from a glob of files.

  • 0.8.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
47K
decreased by-7.69%
Maintainers
1
Weekly downloads
 
Created
Source

extract-comments NPM version

Extract code comments from string or from a glob of files.

Install

Install with npm

$ npm i extract-comments --save

Usage

var extract = require('extract-comments');

// pass a string of javascript, CSS, LESS etc
extract(string);

Example

var str = '/**\n * this is\n *\n * a comment\n*/\n\n\nvar foo = "bar";\n';
var comments = extract(str);
console.log(comments);

[{
  type: 'block',
  raw: '/**\n * this is\n *\n * a comment\n*/',
  value: 'this is\na comment',
  lines: [ 'this is', 'a comment' ],
  loc: { start: { line: 1, pos: 0 }, end: { line: 5, pos: 33 } },
  code:
   { line: 7,
     loc: { start: { line: 7, pos: 36 }, end: { line: 7, pos: 52 } },
     value: 'var foo = "bar";' }

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Run tests

Install dev dependencies:

$ npm i -d && npm test

Author

Jon Schlinkert

License

Copyright © 2014-2015 Jon Schlinkert Released under the MIT license.


This file was generated by verb-cli on November 02, 2015.

Keywords

FAQs

Package last updated on 02 Nov 2015

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc