npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

strip-comments2

v0.0.2

Published

Strip line and block comments, fast and tiny.

Downloads

3

Readme

strip-comments2

Strip comments, fast and tiny.

Install

npm i strip-comments2

Usage

import { strip, stripLine, stripBlock } from 'strip-comments2'

console.log(strip(`
// Signle Line Comments
console.log('hello')
/*
  Multi Line Comments
*/
console.log('world')
`))

  • stripLine: strip comments startsWith //

  • stripeBlock: stripe comments startsWith /* and endsWith */

output:

console.log('hello')

console.log('world')

Related

Benchmark

 ✓ bench/index.bench.ts (6) 6180ms
   ✓ bench vue-global (3) 5594ms
     name                  hz      min      max     mean      p75      p99     p995     p999     rme  samples
   · strip-literal    46.7648  17.8819  28.3685  21.3836  23.2777  28.3685  28.3685  28.3685  ±5.68%       24   slowest
   · strip-comments   56.3943  15.5689  22.7463  17.7323  18.3920  22.7463  22.7463  22.7463  ±3.28%       29
   · strip-comments2   258.88   3.5234   4.4803   3.8628   3.9270   4.3854   4.4803   4.4803  ±0.82%      130   fastest
   ✓ bench three (3) 6177ms
     name                  hz      min      max     mean      p75      p99     p995     p999      rme  samples
   · strip-literal     8.9268   104.55   126.13   112.02   114.96   126.13   126.13   126.13   ±4.94%       10   slowest
   · strip-comments   12.0624  76.4162  94.1202  82.9024  84.5117  94.1202  94.1202  94.1202   ±4.39%       10
   · strip-comments2  20.5539  39.7816  66.9526  48.6525  54.1268  66.9526  66.9526  66.9526  ±11.25%       11   fastest


 BENCH  Summary

  strip-comments2 - bench/index.bench.ts > bench vue-global
    4.59x faster than strip-comments
    5.54x faster than strip-literal

  strip-comments2 - bench/index.bench.ts > bench three
    1.70x faster than strip-comments
    2.30x faster than strip-literal