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

noconsolejs

v1.0.3

Published

Disable all console statements in production.

Downloads

299

Readme

noconsolejs-icon

noconsolejs

npm version license

Tired of people judging you for leaving console.logs in production?

Yeah, me too.

Here's why you absolutely need this

Because your code is embarrassing. There, I said it. I mean, using console.log to debug is fine when it’s just you and your code in the privacy of your local environment. But once it’s out there in the wild, it’s like leaving the house without your pants on. People will notice, and they will judge you. So save yourself the awkwardness and let noconsolejs sweep those logs under the rug, where they belong.

Most of us (aka everyone) use console.log as if it’s the answer to all of life’s problems. But guess what? It’s not. It's more like a 'Post-It' note you slapped on your code because you couldn't figure out what went wrong.

Now, do you really want your users — or worse, your team — to see that? Yeah, didn’t think so.

Features (ahem, ahem)

  • Zero dependencies: Because we’re all trying to live simpler lives and avoid another node_modules folder the size of a small planet. Plus, I didn’t need to add any, so — You're Welcome.
  • Auto-magically erases your console blunders like a "guilty" browser tab you close when someone walks by: console.log, console.warn, console.error, console.info, console.debug — and whatever else you thought was helping — gone; just like your dignity after debugging for 6 hours straight.
  • Works anywhere: Browser, Node.js, that one ancient server you forgot about, or even in the depths of outer space (because if JavaScript is running there, it’s probably doing something weird — but at least noconsolejs can hide the console statements.)

Installation

For the Fancy Node.js Devs

You’re already running 20+ npm commands a day, what’s with one more anyway? Just run:

npm install noconsolejs
const disableConsole = require('noconsolejs');
disableConsole();

Boom. No more consoles. It’s like they never happened. No one will ever know you needed 39 logs to figure out how promises work.

For my fellow ~Noobies~ Browser Folks

Want this in the browser? Sure thing! Just drop this <script> tag into your HTML, ideally in the <head>. (You know, like putting your brain in the driver’s seat before making bad life choices. Same idea — keep things in the right place.)

<!-- noconsolejs -->
<script src="https://cdn.jsdelivr.net/gh/Druhin13/noconsolejs@master/index.js"></script>

Usage

Node.js Example

const disableConsole = require('noconsolejs');

// disabling all the bad decisions
disableConsole();

console.log("This? Never again.");
console.warn("No one will ever see your shame.");

Browser Example

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>noconsolejs Example</title>
    <!-- no more console shaming -->
    <script src="https://cdn.jsdelivr.net/gh/Druhin13/noconsolejs@master/index.js"></script>
</head>
<body>
    <script>
        console.log("You'll never see this.");
        console.error("Or this.");
    </script>
</body>
</html>

Will this Fix your Code?

Haha, No. Absolutely not. Your code is still a hot mess. But at least people won’t be able to tell from the console. It’s like sweeping everything under the rug, except no one trips over it. You’ll still need to actually fix your code at some point, but with noconsolejs, you can take your time. No one’s looking — for now, at least.

License (Blah Blah.. the Legal Stuff)

Yeah, yeah, it’s MIT. Do whatever you want with it. Just don't blame me when your app breaks because you relied on console.log to do all your debugging.