7 NPM packages you may (never) use

How do you find a good npm package?

This article is based on my Openslava 2018 talk.

While there are so many npm packages available to download. Which criteria do you use to find a good npm package? Is it downloads, GitHub stars, recommendation, documentation, …?

NPM

NPM – abbreviated from Node package manager, is the largest software registry. The largest means, because it currently contains more than 1 556 498 packages ^modulecounts of free, reusable code (the count is computed as unique package name, different versions of a package not counted), which is more than other package managers across programming languages as it grows around 1008 packages a day.

We know about most popular, however I will try to show few packages which I found during my career, which I found interesting in a different way, that you would use a different measure to call it good.

Volkswagen

Based on the GitHub stars – it received 11.4k, so it should be very popular. You could read the package description:

If you want your software to be adopted by Americans, good tests scores from the CI server are very important. Volkswagen uses a defeat device to detect when it’s being tested in a CI server and will automatically reduce errors to an acceptable level for the tests to pass. This will allow you to spend less time worrying about testing and more time enjoying the good life as a trustful software developer.
It is inspired by the Dieselgate emission scandal in 2015, when Volkswagen cheated the in emission control. They developed a sofware which activated only when an engine was connected to the emission control laboratory.

A main idea behind the package is that it detects when your tests are being run in a CI server and makes them pass no matter what (errors your tests contain).

Just import it anywhere in your project (usually main test file) and an assertion frameworks have no chance on any of the popular Continous integrations servers.

Would you then use it in your project? It is quite popular, 11.4k stars right? 🙂

Five.js

The next library I will present is a little less popular according to GitHub stars, because it "only" has 1.4k of them.

Its motto is to

overcomplicate five

It is so mature that is has its own logo. Do you see any similarities with Ecma/JavaScript ecosystem logos?

Five.js logo

The library is basically just a function which returns 5, therefore basic mathematical operation works perfect.

When you would need a social support, it will always gives you "high five".

Five supports many different operations you can imagine. Factorial for 5 and even "five" translated into many languages.

Of course, you could check if passed argument is 5 the most special (I was surprised to see) is asynchronous function to get value of 5. And many more functions and values related somehow to number 5, so let yourself check it.

Promise Promise

It has 134 GitHub stars and the idea behind is to have a funny wrapper for a JavaScript Promise, a promise that you can’t keep.

A funny Promise wrapper for those who can’t keep promises. There’s a 50:50 chance that the promise will be fulfilled. If not, it rejects with a random developer excuse.“

As you import it, it exposes an API, that looks like standard Promise API, with resolve and reject parameters.

The developer excuses works only, when a code uses Promise’s the resolve function.

Let’s look at few examples of excuses.
I personally like this: It worked fine for me when I developed it."

Mocha septa reporter

Shame! Shame! Shame!

Except "standard" reporters for Mocha testing framework, this is a different one, because it features a septa from Game of thrones. If you know this series, there was a scene in season 5, when Cercei had to undergo a "walk of attonement". As she walk, the septa Unella accompanies her, repeatly crying out "Shame" and ringing a bell to attract people’s attention.

When your test suite fails, as it does the same thing and reports:

  1. Will play the shame sound (voice + bell)
  2. Will display the shame message :
    Shame! Shame! Shame! 🔔
    Shame! Shame! Shame! 🔔
    Shame! Shame! Shame! 🔔
  3. Before the shame message, will display a random ASCII Septa (2 choices so far)

I tested it on Mac and Windows, and it did not worked on Windows

Hodor

"Returns ‘Hodor.’, no matter what arguments you pass in. Just like Hodor."

A "useless" package, because the API returns Hodor, no matter you pass in. Just like the Hodor character from Game of Thrones.

The API is just one function, which returns "Hodor" string value. Use your imagination to say it in Hodor-ish. Hodor

Empty trash

I am not sure if somebody needs this, except as a joke, but it works on all operating systems. Also as a command line utility

Empty String

well tested empty string module in case you forget how to make it

In the end there is a library called Empty string. In case you forget how to make one, use it. Seriously, somebody created and published such library. Well tested with Travis CI.

The API is very simple, import it and use the empty string value.

Leave a Reply

Your email address will not be published. Required fields are marked *