Socket
Socket
Sign inDemoInstall

es-comments

Package Overview
Dependencies
0
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    es-comments

Parses single and multiline comments from an ECMAScript source file


Version published
Weekly downloads
2.9K
decreased by-4.35%
Maintainers
1
Install size
8.22 kB
Created
Weekly downloads
 

Readme

Source

es-comments

Parses a list of comments from an ECMAScript (JavaScript) source file. 0 dependencies, 417 bytes minified + gzipped.

Install

npm install es-comments

Usage

const parseESComments = require('es-comments');
const someSourceCode = `
    // Some single line comment
    console.log('hello world');
`;
const comments = parseESComments(someSourceCode);
/* Outputs:
    [
      {
        "value": "// Some single line comment",
        "start": 9,
        "end": 36
      }
    ]
*/

Benchmarks

Benchmarks run on a mid-2015 MacBook Pro. Benchmarks compare running time to other similar npm packages.

+--------------+----------------------------+------------------+---------------+---------------+
|              │ es-comments (this package) │ extract-comments │ get-comments  │ comment-regex |
+--------------+----------------------------+------------------+---------------+---------------+
| jQuery 1.7.2 │ 49.36 ops/sec              │ 9.27 ops/sec     │ 22.05 ops/sec │ 1,474 ops/sec |
+--------------+----------------------------+------------------+---------------+---------------+

tl;dr: If location information is not necessary, and some misses are ok, use a RegExp. Otherwise, this package is a good alternative.

Keywords

FAQs

Last updated on 18 Jan 2018

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