7 NPM packages you may (never) use
Tags: npm, node, programming, javascript
Published: 2021-04-09 06:51:18

*This article is based on my [Openslava 2018 talk](https://www.youtube.com/watch?v=_DkG1yA6t3w)*.

# How do you find a good npm package?

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](https://www.npmjs.com/) - 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.

[^modulecounts]: http://www.modulecounts.com/

## [Volkswagen](https://github.com/auchenberg/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](https://github.com/jackdclark/five)
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?

<img alt="Five.js logo" title="Five.js logo" src="https://camo.githubusercontent.com/cc121ed3dcdaeea56631d473fd4403857736ae117daff7df81f2aa6866ec267e/68747470733a2f2f636c6475702e636f6d2f6b77467a306c686731752e706e67" width=100 height=100>
<br>
<br>

The library is basically just a function which returns `5`, therefore basic mathematical operation works perfect.
```js
five(); // 5
five() + five() // 10
```

When you would need a social support, it will always gives you "high five".
```js
five.high() // "o/"
```

Five supports many different operations you can imagine.  Factorial for `5` and even "five" translated into many languages.
```js
five.factorial(); // 120

five.dothraki() // mek
```

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.
```js
five.isFive(10); // false

five.async(function(err, five) {
// five === 5
});
```

## [Promise Promise](https://github.com/bullgit/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 <u>random developer excuse</u>.“

As you import it, it exposes an API, that looks like standard `Promise` API, with `resolve` and `reject` parameters.
```js
import Promise from 'promise-promise';

const myAsyncOperation = new Promise(resolve => {
    resolve('I resolved correctly');
});
```
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](https://github.com/tristant/mocha-septa-reporter)
> Shame! Shame! Shame!

Except "standard" reporters for [Mocha testing framework](https://mochajs.org/), this is a different one, because it features a [septa from Game of thrones](https://gameofthrones.fandom.com/wiki/Unella). 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](https://github.com/tristant/mocha-septa-reporter/blob/master/septa0.txt) (2 choices so far)

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

## [Hodor](https://github.com/colingourlay/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](https://gameofthrones.fandom.com/wiki/Hodor) 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*
```js
const hodor = require('hodor-api');
const response = hodor('Hodor, bring my brother here.');
console.log(response); // Hodor.
```

## [Empty trash](https://github.com/sindresorhus/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

```js
const emptyTrash = require('empty-trash');

emptyTrash().then(() => {
    console.log('done');
});
```

## [Empty String](https://github.com/thomaslindstrom/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.
```js
npm install empty-string
const EMPTY_STRING = require('empty-string');
console.log(EMPTY_STRING); // ''
```