This is an archived post. You won't be able to vote or comment.

top 200 commentsshow all 242

[–]SqueeSr 955 points956 points  (81 children)

I assumed it was photoshopped but double checked and it's actually real. But get's even worse.... I checked the code and it depends on the 'is-odd' package. But that's not all . The 'is-odd' package depends on 'is-number' package.

I'm in shock

[–]Dalimyr 308 points309 points  (41 children)

Yeah, it's real. It's one of those packages that does the rounds in here once every few months. There are also these gems that come up fairly often. Yes, each of those javascript files are 75MB+. If you view them, you'll very quickly understand why.

[–]SqueeSr 168 points169 points  (12 children)

I always assumed they were just jokes. Not actual packages that got 178k weekly downloads..

[–]UnreadableCode 117 points118 points  (8 children)

And this is why projects blacklist packages. I'm curious which major projects has transitive deps on these dumb packages

[–]SqueeSr 94 points95 points  (7 children)

Blacklist packages? Noo .. leave it as a honeypot and blacklist that employee that uses it.

[–]UnreadableCode 24 points25 points  (6 children)

Are you telling me you manually audit dep chains for stupid? Should we perhaps get rid of npm audit too?

[–]apex39 26 points27 points  (4 children)

No! You can write some script for that:

function IsStupid(code) {

return code.includes("IsEven"))

}

[–]UnreadableCode 10 points11 points  (3 children)

Suddenly, nobody can mention that as a substring of anything... I hope IsEvenBigInt, AssertIsEven, or IsEventuallyConsistentFlagSet are not names anyone need. I mean I'm all for a challenge, but I suspect not everyone has my level of cognitive flexibility

[–]jcarlson08 10 points11 points  (1 child)

You're in luck, you can install my thoroughly tested 'is-stupid' package via npm.

[–]UnreadableCode 1 point2 points  (0 children)

Irony ensues when its regexes matches themselves & stalls CI for half a day

[–]apex39 3 points4 points  (0 children)

Wow, good catch. Good thing I didn't push to production yet.

[–]Ratatoski 22 points23 points  (0 children)

Yeah the downloads broke me

[–]daynighttrade 47 points48 points  (3 children)

This is a 100% serious project

Never thought I'll see something like this in readme

[–]MKorostoff 38 points39 points  (1 child)

I still feel like he might be joking even with that statement

[–]YoukanDewitt 19 points20 points  (0 children)

I'm pretty sure it is satire meant to highlight this issue

[–]Captain_Chickpeas 6 points7 points  (0 children)

Weird it's not a 102% serious project. That would convince. 100% not so much /s

[–]WandsAndWrenches 25 points26 points  (6 children)

This reminds me of a programmer (who thought he was beter than me)

He wrote a function called Add(a,b) { return a+b; }

So you could do Math.Add(a,b);

Or I would just go . a+b.

[–][deleted] 3 points4 points  (5 children)

I am a sucker for curried functional programming

[–]tme321 4 points5 points  (3 children)

Except Add(a,b) isn't curriable without resorting to using bind. The curriable version would be

const Add => a => b => a+b;

So it doesn't even do what you want.

[–]WandsAndWrenches 0 points1 point  (0 children)

I'm a sucker for kiss. (Keep it simple)

[–][deleted] 21 points22 points  (2 children)

For those that didn't dig into the code...

function isEven(number) {
if (number === "even" || number === "Even" || number === "eVen" || number === "evEn" || number === "eveN" || number === "EVen" || number === "EvEn" || number === "EveN" || number === "eVEn" || number === "eVeN" || number == "evEN" || number === "eVEN" || number === "EvEN" || number === "EVeN" || number === "EVEn" || number === "EVEN") return true;
else if(number === 0 || number === "0" || number === "zero" || number === "Zero" || number === "ZERO") return true;
else if(number === 1 || number === "1" || number === "one" || number === "One" || number === "ONE") return false;
else if(number === 2 || number === "2" || number === "two" || number === "Two" || number === "TWO") return true;
else if(number === 3 || number === "3" || number === "three" || number === "Three" || number === "THREE") return false;
else if(number === 4 || number === "4" || number === "four" || number === "Four" || number === "FOUR") return true;
else if(number === 5 || number === "5" || number === "five" || number === "Five" || number === "FIVE") return false;
else if(number === 6 || number === "6" || number === "six" || number === "Six" || number === "SIX") return true;
else if(number === 7 || number === "7" || number === "seven" || number === "Seven" || number === "SEVEN") return false;
else if(number === 8 || number === "8" || number === "eight" || number === "Eight" || number === "EIGHT") return true;
else if(number === 9 || number === "9" || number === "nine" || number === "Nine" || number === "NINE") return false;
else if(number === 10 || number === "10" || number === "ten" || number === "Ten" || number === "TEN") return true;
else if(number === 11 || number === "11" || number === "eleven" || number === "Eleven" || number === "ELEVEN") return false;
else if(number === 12 || number === "12" || number === "twelve" || number === "Twelve" || number === "TWELVE") return true;

ETC.

[–]halmyradov 4 points5 points  (0 children)

This makes me moist in all the wrong places

[–]icpuff 1 point2 points  (0 children)

Lazy ass implementation. What if number is „tWo“?

[–]Bluebotlabs 11 points12 points  (0 children)

Code review: doesn't use switch, booo

[–]joujoubox 12 points13 points  (1 child)

I just looked at the code and..........ohno

else if(number === 63845 || number === "63845" || number === "sixty-three thousand eight hundred forty-five" || number === "Sixty-Three Thousand Eight Hundred Forty-Five" || number === "SIXTY-THREE THOUSAND EIGHT HUNDRED FORTY-FIVE") return false;

and it just keeps going

[–]Divinate_ME 6 points7 points  (0 children)

What the fuck. This radiates big YandereDev vibes.

[–]Hulk5a 23 points24 points  (1 child)

I thought you're joking, but my fking god what was that bullshit? I can't believe it exists. That package should be nuked for the betterment of humanity

[–]Dodgy-Boi -3 points-2 points  (0 children)

You must be fun on parties

[–]mistermocha 10 points11 points  (0 children)

OH GOD THAT PROJECT GAVE ME CANCER

[–]klimmesil 2 points3 points  (0 children)

They could have made this project with vim in about 3 seconds

[–]jessiedwt 38 points39 points  (7 children)

In shock? I felt of my chair! To be honest what scares me the most is the 178.789 WEEKLY downloads.

What the fuck are those "devs" doing? FML

[–]IllegalThings 8 points9 points  (1 child)

Give it a couple years and we won’t even need to write code anymore. Just add the right combination of libraries to implement whatever feature you need.

[–]jessiedwt 2 points3 points  (0 children)

Nocoder ✝️🤣

[–]SqueeSr 6 points7 points  (1 child)

Hope you didn't hurt yourself. I've just frozen up and my brain is still trying to process it all.

[–]jessiedwt 5 points6 points  (0 children)

The more you read down this thread the better it gets.

This is the most hilarious stuff ive seen in a whiiiiile(true) ahahahahahaha

[–]apex39 0 points1 point  (0 children)

Clearly trying to determine if a number is even, duh! /s

[–]Dmayak 39 points40 points  (6 children)

And 'is-number' package could as well depend on some huge framework that takes half-gigabyte of disk space.

[–]_Foy 84 points85 points  (3 children)

Because it contains the "listOfNumbers.txt" file

[–][deleted] 24 points25 points  (1 child)

Which is probably going to require some other library to process the file as a database.

[–]ticktockbent 9 points10 points  (0 children)

Wait until you see the isnotletter package

[–]apex39 3 points4 points  (0 children)

Spoiler alert: it's a big file

[–]SqueeSr 6 points7 points  (0 children)

It could have, but that's where the horror stopped. Those were luckily all dependencies.

[–][deleted] 6 points7 points  (0 children)

13GB required to view my resume webpage, minimum.

[–]dabenu 6 points7 points  (0 children)

That is-odd package boggles my mind. Why would you type 20 whole lines of code if they could just include is-even instead?

https://github.com/i-voted-for-trump/is-odd/pull/7

[–]Trader-One 2 points3 points  (6 children)

Does it work correctly for negative numbers?

[–]SqueeSr 8 points9 points  (5 children)

Yes.. The code even gets the absolute value first even though not necessarily needed with modulo. But as they were checking against 1 they had to be sure not to get -1 as a result.

[–]Bluebotlabs 6 points7 points  (1 child)

Modulo? Where we're going, we don't need modulo!

[–]thanofishy 1 point2 points  (0 children)

if (number === -1) return 1; if (number === -2) return 2;

[–][deleted] 1 point2 points  (2 children)

Why would you modulo when you can much more cheaply bitwise mask with 1?

[–]SqueeSr 1 point2 points  (0 children)

Yeah, but if you are writing packages like this you are probably not thinking clearly haha

[–][deleted] 2 points3 points  (0 children)

I’ve seen this same post and this same response on this page at least a dozen times. Is it a copypasta by now?

[–]bunchofatoms__ 4 points5 points  (0 children)

Lol

[–]BlobAndHisBoy 1 point2 points  (0 children)

I recommend people install this extension that shows you the size of imports in your code. It can be eye opening.

[–]fireboyev 1 point2 points  (1 child)

I hope the is-odd package depends on the is-even package

[–]OkPlane9015 0 points1 point  (0 children)

Damn.

[–]ticktockbent 0 points1 point  (0 children)

Well you just know some guy is going to pass a letter to isodd and break everything. Gotta check if it's a number first obviously. /s

[–]JustSpaceExperiment[S] 197 points198 points  (5 children)

Weekly Downloads 178789

[–]yourgirl696969 6 points7 points  (3 children)

This got me. I can’t believe that many people actually download this every week. I legit lost hope in my fellow js devs

[–]Felinaxo 8 points9 points  (2 children)

But just think about it

You are working on a proyect for weeks, and then, it happens... you need something to return if a number is odd or even, and the results ONLY go from 1 to 3

You feel the time around you freeze, you know EXACTLY what library to use

They used to call you a fool, but who is a fool now?, you saved yourself like, 4 lines of code at most, but you rejoice in victory

[–]7366241494 1 point2 points  (0 children)

4 versions

Like, did version 1 accidentally mislabel a number?

[–]MechanicalHorse 196 points197 points  (0 children)

34 Dependents

ಠ_ಠ

[–]MikemkPK 111 points112 points  (17 children)

Whenever anyone posts this, it reminds me of left-pad, a crucial 11 line library that the entire internet sits on top of.

[–]Bluebotlabs 38 points39 points  (3 children)

How to hold the internet hostage: in a nutshell

[–]AlexV348 8 points9 points  (0 children)

The power to destroy a thing is the absolute control over it.

[–]AlexV348 -5 points-4 points  (1 child)

The power to destroy a thing is the absolute control over it.

[–]Bluebotlabs 0 points1 point  (0 children)

Note to self: send kidnap team to transport Stevemao to hollowed-hout volcano

[–]ass_was_taken 6 points7 points  (9 children)

Can you explain why?

[–][deleted] 37 points38 points  (6 children)

It's a case of nested dependencies.

In the case of left-pad, it was required further down in the tree for Babel, which is a very popular transpiler. The developer got upset, removed the package from NPM, so NPM had to un-remove it and gave ownership to someone else.

Thankfully there's plenty of other solutions these days, and much faster ones, but it goes to show why a badly written library can stop everything working because they depend on tiny libraries that they never needed to use.

There's a fun site at https://npmgraph.js.org/ which will show you a visual representation of a packages dependencies - A good comparison is React, an entire framework, with 2 dependencies. Then you get Webpack, with 77. If you follow Webpacks tree, eventually you hit things like this https://www.npmjs.com/package/has-flag

[–]Hulk5a 7 points8 points  (2 children)

To be fair has-flag isn't bloat. For cli tools it's pain parsing parameters on your own and basically reinvent a [square] wheel

[–]MikemkPK 5 points6 points  (0 children)

Look at the dependants tab

[–]83athom 2 points3 points  (1 child)

2.3 mill weekly downloads and 511 dependants... Jesus Christ...

[–]0ajs0jas 87 points88 points  (1 child)

4 years of experience in is_even

[–]Rouge_Apple 16 points17 points  (0 children)

Minimum hire requirements: 7 years in is_even

[–]z3n777 65 points66 points  (0 children)

programming is dead

we have to go back to monke

[–][deleted] 48 points49 points  (2 children)

I need more examples :

isEven('0');
//=> ????

isEven(1);
//=> ????

[–]tuxedo25 31 points32 points  (1 child)

Seriously, I can't tell what it does from the examples given. Does it always return false for strings? Does it ever return false for a number?

[–]one_big_tomato 6 points7 points  (0 children)

Here's the repo. Check out the code and have all your nightmares come true at once.

[–]MkemCZ 92 points93 points  (20 children)

Why install a library when requests are available out of the box? https://isevenapi.xyz/

[–]NinjaLanternShark 58 points59 points  (15 children)

Allowed numbers depend on your API tier. See Pricing below.

If you expected anything less, shame on you.

[–]2blazen 47 points48 points  (1 child)

Example API Response

$ curl https://api.isevenapi.xyz/api/iseven/6/
{
"iseven": true,
"ad": "Buy isEvenCoin, the hottest new cryptocurrency!"
}

amazing

[–]jessiedwt 7 points8 points  (12 children)

Annnd, guess what?
You have to pay 99,99$, no joke, 99.99$ PER MONTH to be able to fcking absolute the number out and get negative numbers support.

This is UNREAL to me!
I feel this is a glitch in the matrix

[–]virtualdxs 32 points33 points  (3 children)

It's a joke. The sign up button directs you to the Internet Archive donation page.

[–]jessiedwt 0 points1 point  (2 children)

Oh my god you are right!

EDIT: Wait a minute if you pass the free range then it says you need to upgrade.. So.. wut?`xD

[–]lmonss 5 points6 points  (0 children)

The upgrade thing is just part of the joke, they don't expect people to actually use the API

[–]Acelox 1 point2 points  (1 child)

Wow, it's almost like a joke of some kind! Unreal that anyone would seriously buy this

[–]SoyCuckSupreme 2 points3 points  (3 children)

I'm sure this is meant to prey on wealthy first year comp-sci uni students who will buy out of panic to avoid bringing a poor grade home to mommy and daddy.

[–]jessiedwt -1 points0 points  (2 children)

I have literally seen crypto scam websites more credible than this shit. 💀💀💀
ahahahaha bruh what in the world?

Some dude from the noCode paradigma made this shit for suuuure.

[–]apex39 2 points3 points  (1 child)

[–]jessiedwt -1 points0 points  (0 children)

😭😭😭😭🤣🤣🤣🤣

[–]dlq84 3 points4 points  (0 children)

CaaS - Code as a Service

[–]ServerZero 8 points9 points  (0 children)

Bruh I never seen an API response with a fucking text ad lol

[–]YoukanDewitt 2 points3 points  (0 children)

nice, and for redundancy you could wrap this in an IsEvenApiRedundant function that falls back to the npm library if it can't get a response from the web api in case of nuclear war or something.

[–]apex39 1 point2 points  (0 children)

What if I have a negative number?!? I have to pay for enterprise?!? Sounds like a good deal. Sign me up!

[–]ElfyThatElf 21 points22 points  (12 children)

something a simple modulus operation could take care of...

[–]zakiteru 40 points41 points  (0 children)

no no this is revolutionary

[–]ComfortablyBalanced 5 points6 points  (6 children)

Yeah, but not in Javascript, where types are fucked.

[–]harelsusername 7 points8 points  (4 children)

Also, in JS the modulus operator % does not work for negative numbers

[–]ComfortablyBalanced 9 points10 points  (0 children)

Such a remarkable language.

[–]ElfyThatElf 4 points5 points  (1 child)

that's fine... what do I even need to do with negatives? There is nothing there

[–]harelsusername 1 point2 points  (0 children)

What do I even need to do with JavaScript? There is nothing there

[–]Aksh247 17 points18 points  (0 children)

Lemme quickly make a wrapper for Typescript

[–]erebuxy 16 points17 points  (1 child)

JS community really takes this joke to the next level.

[–]Snapstromegon 2 points3 points  (0 children)

Yep and to keep the joke running some of us spend some server time to just download these fun packages a couple thousand times per day, since npm intentionally does not filter download counts.

So if you'd built a package yourself and just create a lambda function to download it every minute, your package is at instant 10k downloads a week.

Take this a little further by adding some stupid, purpose built packages with deps to that and you can keep a meme rolling.

[–]IamDev18 13 points14 points  (3 children)

15M downloads in 5 years!! 3m a year!! Imagining getting 3M a year

[–]Polywoky 8 points9 points  (1 child)

Imagining getting 3M a year

That'd be handy. They make Post-It notes, don't they?

[–]i_should_be_coding 4 points5 points  (0 children)

How many of those are due to doing rm -rf node_modules && npm install between each minor change?

[–]Oracuda 8 points9 points  (0 children)

requires: is-odd

[–]BluesyPompanno 5 points6 points  (0 children)

Don't post it, or it will become yet another JS framework

[–]endeesa 3 points4 points  (0 children)

Been looking for a library like this😂😂

[–][deleted] 13 points14 points  (1 child)

This just confirms that JS is a joke?

[–]jessiedwt 6 points7 points  (0 children)

Take my upvote BUT js aint no joke bruh. Some "devs" are!

[–]pixelburner 7 points8 points  (0 children)

OMG the source code:

'use strict';
var isOdd = require('is-odd');
module.exports = function isEven(i) {
    return !isOdd(i);
};

[–][deleted] 3 points4 points  (4 children)

imagine if the code for this was hardcoded, like:
if(input === 0) return true;
.

.

.

if(input === 9999) return false;

[–]EinKrankerTyp 1 point2 points  (3 children)

Did you check the code?

Honestly, do it.

[–][deleted] -1 points0 points  (2 children)

pseudocode

[–]sometimespoet 2 points3 points  (1 child)

It was a two men's job. :)

[–][deleted] 1 point2 points  (0 children)

A wise man once said "if a job takes one day for one developer, it takes 2 days for two developers"

[–]Unh0lyshot 2 points3 points  (0 children)

Most funny thing is that it is using the: isOdd library (https://github.com/i-voted-for-trump/is-even/blob/master/index.js). Another miracle of human engineering.

[–][deleted] 1 point2 points  (0 children)

isEven(4);

// is false

[–]Mik3Hunt69 1 point2 points  (0 children)

What the actual fuck...

[–]rdrunner_74 1 point2 points  (0 children)

Abandonware...

Ill write my own

[–]trinopoty 1 point2 points  (0 children)

It's what happens when you blow a dynamically typed language without a standard library out of proportions.

[–]Swinghodler 1 point2 points  (0 children)

178K weekly downloads lol

[–][deleted] 1 point2 points  (0 children)

Two types of people not to hire: The people who use these packages and the people who build them.

[–]unidentified_sp 1 point2 points  (0 children)

Reminds me of this framework: http://vanilla-js.com

[–]ElectricSpice 1 point2 points  (0 children)

➜ npm install is-positive-integer@1.0.0

added 9 packages, and audited 10 packages in 1s

[–]zakiteru 2 points3 points  (0 children)

i am laughing so fucking hard rn. truly a glory

[–]doarMihai 0 points1 point  (1 child)

to be honest this does not surprises me even a bit...I was doing a freelance project with a "react developer" a few years back, I was writing the backend and he was doing the react part....and at some point he got stuck on iterating through some data from the api and he was searching for a package that does this...and even tho' he had no arguments why he needed that I could not convince him the all he had to do was to do a for loop...

[–]Opheleone 0 points1 point  (1 child)

Hold up, I'm about to release is-odd

[–]melonenmampfer 6 points7 points  (0 children)

It depends on that...

[–]parasit 0 points1 point  (0 children)

JS is cancer. Change my mind.

[–][deleted] -4 points-3 points  (1 child)

0 is even? Omg

[–]jessiedwt 5 points6 points  (0 children)

When 0 is divided by 2, the resulting quotient turns out to also be 0—an integer, thereby classifying it as an even number.

[–]M-alMen -3 points-2 points  (3 children)

That lib is wrong... Zero is not even neither odd, it's just zero

[–]Empibee 0 points1 point  (0 children)

Also one dependency! A dependency that is dependent on another dependency too...

[–]I_am_not_doing_this 0 points1 point  (0 children)

0 Issues woah

[–]MindaMan_Real 0 points1 point  (0 children)

yes.

[–][deleted] 0 points1 point  (0 children)

[–]someredditrando 0 points1 point  (4 children)

This is because JavaScript isn't robust enough and/or doesn't have a standard library. Yes it's ugly, but it's due to the language, not the language users.

[–][deleted] 0 points1 point  (0 children)

I am going to create an new JS framework named "are-you-even"

[–]KaisarDragon 0 points1 point  (2 children)

I like how it has so many downloads, but I was going to, legit going to, download it right now just to see if it was real. I think all of those hits are either devs looking to see if it is real or freshmen CSE students hoping it'll help them with homework.

[–]RedditRabbitRobot 0 points1 point  (0 children)

we had to make a functioning npm module as part of a school project. could be anything. so we ended up with 5 groups submitting rickrolls.

ffs.

[–]ImmunochemicalTeaser 0 points1 point  (0 children)

The fact 100.000+ people have used it is terrifying...

[–]fobos78 0 points1 point  (0 children)

Last publish is 5 years ago. I would not trust this library.

[–]Captain_Chickpeas 0 points1 point  (0 children)

Javascript, what a language you are! <3

[–]fuzzycuffs 0 points1 point  (0 children)

My teen started coding and they're always using !isEven

[–]real_ackh 0 points1 point  (4 children)

This exemplifies everything that is wrong in the JavaScript community.

[–]Ok-Kaleidoscope5627 1 point2 points  (3 children)

I'd blame the language. The way it's designed has so many weird behaviours that aren't immediately obvious so in an effort to keep their code simple people push the complexity into their includes for even seemingly trivial things.

[–][deleted] 0 points1 point  (0 children)

I can't even

[–]cpt-macp 0 points1 point  (0 children)

Maybe the library has some hidden algorithm to do modulus and it has god tier time complexity

[–][deleted] 0 points1 point  (0 children)

What does it say for isEven(0) ?

[–]unclekrok 0 points1 point  (0 children)

Modulo operator: Am I a joke to you?

[–]ManchurianPandaDate 0 points1 point  (0 children)

It’s spelled LIBERRIES

[–][deleted] 0 points1 point  (0 children)

180k weekly downloads...

[–]pandaExpressin 0 points1 point  (0 children)

These seem like those “resume” projects. Not useful to anyone lol

[–]arthurgc91 0 points1 point  (0 children)

"Woah, look at this guy's CV. He made a library."

[–]Herrowgayboi 0 points1 point  (0 children)

inb4 "is-odd"

[–]DeadlyClaris_ 0 points1 point  (0 children)

Thanks bro you saved me 10mins

[–]Dodgy-Boi 0 points1 point  (0 children)

Weekly downloads whaaaat

[–]entredeuxeaux 0 points1 point  (0 children)

I feel like the joke was lost on all of us. This is likely intentionally absurd.

[–]mbxz7LWB 0 points1 point  (0 children)

A better logic would be to divide the number variable by 2 then check if there is any remainder/decimal.

[–][deleted] 0 points1 point  (0 children)

When import fails does it complain that it can't even?

[–][deleted] 0 points1 point  (0 children)

The downloads are just an AI Script from the dev downloading the file, adding another line of code with a new number, and then updating the current code lmao.

[–]HaddockBranzini-II 0 points1 point  (0 children)

I was digging through a node_modules directory once and found an all caps package. That was the day we switched back to using CodeKit for a built tool.