JavaScript Flaws: 5 stupid NPM packages
Tags: javascript, typescript, node, npm
Published: 2021-01-22 15:48:03

As co-founder of Codesphere and Ex-Googler I have been passionate about coding since I was a child. I love NodeJS/JavaScript/Typescript with all their flaws (and there are many lol). One of these flaws for which the JavaScript Community takes a ton of heat is NPM.

For those who do not know NPM - let me explain: NPM is the dominant package manager for JavaScript and NodeJs and it allows importing other source code into your project. 

As you probably know, NPM is a pretty easy meme target, unless you avoided the internet for the last couple of years. The promise is that you include ten things, ten things depend on five things, five things depend on ten things and the next thing is that you have half a gigabyte of node modules on your disk.

NPM is essentially unrestricted and even more than on wikipedia anyone can publish anything. This can even lead to a point where you publish something that is meant to be a joke and people actually start depending on it. One example where unnecessary dependencies have been dangerous is [leftpad](https://qz.com/646467/how-one-programmer-broke-the-internet-by-deleting-a-tiny-piece-of-code/), a library that prepended a number of characters to a string. Its removal led to outages all over the internet.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/b4os79tw7b748o78esh5.png)

## Here are my TOP 5 Unnecessary NPM Libraries on which people actually depend:

### 1: [is-ten-thousand](https://www.npmjs.com/package/is-ten-thousand)
This library is used to find out if (yep, actually) a number is equal to ten thousand.

There are actually some people depending on it and if you need even more help with questions of this kind, there are also [is-hundred](https://www.npmjs.com/package/is-hundred) and [is-ten](https://www.npmjs.com/package/is-ten) available at your command.

Funny enough, is-ten even states how it is used by 10x engineers ;)

### 2: [owoifyx](https://www.npmjs.com/package/owoifyx)
This library is very straightforward to use and it does exactly what you would expect:

It ‘owoifies’ (Hello -> Hewwo) your text.

```js
const owoify = require('owoifyx');
console.log(owoify('Hello friend!')); // Hewwo fwiend (*^ω^)
```

26 people this week decided that they would need exactly this in their project.

### 3: [true](https://www.npmjs.com/package/true)
This package is “A JavaScript port of the Unix utility 'true'” and it returns ‘true’. It even states how it should be used when you need a function that returns true.

The super clean three lines of code were developed by nine contributors in 30 commits, and like every good package, it has 100% test coverage. You might think: Why not use the built in constant ‘true’? - Uhm.. I don’t know!

More than 300 people couldn’t live without this core utility this week.

There is also a companion package [false](https://www.npmjs.com/package/false) which does exactly the same for false.

### 4: [emoji-poop](https://www.npmjs.com/package/emoji-poop)
As one would expect, this returns the poop emoji, but what is really great about this piece of code is that this also has a 100% test coverage and therefore will - guaranteed! - return the poop emoji.

11 people this week used it, maybe to prove a point?

### 5: [is-odd](https://www.npmjs.com/package/is-odd)
A trivial operation to do in JavaScript, though the most used library in this list. It returns true if a number is odd, and it has more than 500k downloads this week.

For all of you who might have wondered if you could also check if a number is even? Surprise - this package exists ([is-even](https://www.npmjs.com/package/is-even)) and was downloaded more than 100k times this week. 

Fun fact: After some investigation by the [Codesphere](http://codesphere.cloud) experts, we found that it imports the is-odd package, and negates it to your convenience.



**Many thanks for reading this post, hope you liked it! What's your favorite NPM package?**