DEV Community

Cover image for 7 NPM packages you may (never) use
Pavol Pidanič
Pavol Pidanič

Posted on • Originally published at pidanic.com

7 NPM packages you may (never) use

This article is based on my Openslava 2018 talk.

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 - abbreviated from Node package manager, is the largest software registry. The largest means, because it currently contains more than 1 556 498 packages 1 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.

five(); // 5
five() + five() // 10
Enter fullscreen mode Exit fullscreen mode

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

five.high() // "o/"
Enter fullscreen mode Exit fullscreen mode

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

five.factorial(); // 120

five.dothraki() // mek
Enter fullscreen mode Exit fullscreen mode

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.

five.isFive(10); // false

five.async(function(err, five) {
// five === 5
});
Enter fullscreen mode Exit fullscreen mode

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.

import Promise from 'promise-promise';

const myAsyncOperation = new Promise(resolve => {
    resolve('I resolved correctly');
});
Enter fullscreen mode Exit fullscreen mode

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

const hodor = require('hodor-api');
const response = hodor('Hodor, bring my brother here.');
console.log(response); // Hodor.
Enter fullscreen mode Exit fullscreen mode

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

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

emptyTrash().then(() => {
    console.log('done');
});
Enter fullscreen mode Exit fullscreen mode

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.

npm install empty-string
const EMPTY_STRING = require('empty-string');
console.log(EMPTY_STRING); // ''
Enter fullscreen mode Exit fullscreen mode

  1. http://www.modulecounts.com/ 

Top comments (3)

Collapse
 
juniordevforlife profile image
Jason F

Thank you for sharing. It's refreshing to see stuff like this.

Collapse
 
natalia_asteria profile image
Natalia Asteria • Edited

If you ever feel you are useless, don't be worried. These packages are much more useless than you.

Collapse
 
archnim profile image
archnim

These packages are all, little useful. 🙄