this post was submitted on 12 Sep 2025
454 points (98.9% liked)

Programmer Humor

26332 readers
1607 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] FiskFisk33@startrek.website 17 points 2 days ago (3 children)

https://www.npmjs.com/package/is-even

don't look at the weekly downloads if you are faint of heart.

[–] Decq@lemmy.world 9 points 2 days ago* (last edited 1 day ago) (1 children)

To be fair in a dynamic typed language with dumb string to int coercions, I kinda get why such a library would exists. So it's more a symptom of terrible language design than modern dependency hell.

[–] bobo@lemmy.ml 9 points 2 days ago* (last edited 2 days ago) (1 children)

in a dynamic typed language with dumb string to int coercions, I kinda get why such a would library exists.

If string return nan, else % 2

So it's more a symptom of terrible language design than modern dependency hell.

Dependency chain: is-even depends on is-odd which depends on is-number

[–] Decq@lemmy.world 1 points 2 days ago* (last edited 2 days ago) (2 children)

If string return nan, else % 2

So now you return a number type if it's a string and a boolean if it's an integer. How does that make sense?

The is-even lib exists to sanitize input by throwing an exception which imho is better.

Edit: having looked at the code better. Apparently it still allows string coercion (boo). It only checks for non integer numbers.

[–] bobo@lemmy.ml 1 points 2 days ago

Good point, but you can do if === true... and else if === false...

But definitely better to throw an error instead of nan.

[–] Hawk@lemmy.dbzer0.com 6 points 2 days ago

If you really want to see some horror, follow the dependencies

[–] ThanksForAllTheFish@sh.itjust.works 3 points 2 days ago* (last edited 18 hours ago)

https://10xengineersqualityprogramming.github.io/ https://www.npmjs.com/package/@falsejs/falsejs This is hilarious, has 262 of the best useless dependencies. In all seriousness though how does anyone ever audit a npm package, it's dependency hell!