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 - npm Package Compare versions

Comparing version 0.7.0 to 0.7.1

2

package.json
{
"name": "extract-comments",
"description": "Extract code comments from string or from a glob of files.",
"version": "0.7.0",
"version": "0.7.1",
"homepage": "https://github.com/jonschlinkert/extract-comments",

@@ -6,0 +6,0 @@ "author": {

@@ -5,2 +5,4 @@ # extract-comments [![NPM version](https://badge.fury.io/js/extract-comments.svg)](http://badge.fury.io/js/extract-comments)

**Heads up!** As of v0.7.0 this no longer has a `.fromFile()` method to read from the file system. See [extracting from files].
This goes well with [code-context](https://github.com/jonschlinkert/code-context).

@@ -84,3 +86,24 @@

## Extracting from files
Prior to v0.7.0, there was a method to extract code comments from files. Here is the equivalent code to accomplish the same thing:
```js
var fs = require('fs');
var extract = require('extract-comments');
var mapFiles = require('map-files');
function extractComments(patterns, opts) {
opts = opts || {};
opts.name = opts.rename || function(fp) {
return fp;
};
opts.read = opts.read || function(fp, options) {
var code = fs.readFileSync(fp, 'utf8');
return extract(code, options);
};
return mapFiles(patterns, opts);
}
```
## Related

@@ -87,0 +110,0 @@ * [parse-comments](https://github.com/jonschlinkert/parse-comments): Parse code comments from JavaScript or any language that uses the same format.

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