Back to articles
A Single Regex Got Its Own npm Package. It Gets 70 Million Downloads a Week.

A Single Regex Got Its Own npm Package. It Gets 70 Million Downloads a Week.

via Dev.to WebdevAditya Agarwal

A regular expression was popular enough to warrant its own npm package. It's downloaded 70 million times a week. The package is shebang-regex. Here's the entire source code: const shebangRegex = /^#! ( .* ) / ; export default shebangRegex ; Seriously, there's one line of actual code there. One line wrapped in a package, published to npm, and unwittingly linked into millions of projects by way of their dependency trees. In a blog post that hit 379 points on Hacker News this week, James Garbutt lays out what he refers to as the three pillars of JavaScript bloat. And honestly, it puts words to something every JS dev has known in their gut for years but never quite been able to articulate. Pillar One: Old Runtime Support 🦕 The likes of is-string still exist because somewhere, someone needs to cover ES3. Think IE6. Think early Node before they shimmed Array.forEach. For that person, this makes sense. For the rest of us in evergreen land, downloading dead-weight we never actually wanted. Pil

Continue reading on Dev.to Webdev

Opens in a new tab

Read Full Article
2 views

Related Articles