orhtej2@eviltoast.org to Programmer Humor@programming.devEnglish · 1 day agoPeak code reuseeviltoast.orgimagemessage-square40fedilinkarrow-up1418arrow-down15
arrow-up1413arrow-down1imagePeak code reuseeviltoast.orgorhtej2@eviltoast.org to Programmer Humor@programming.devEnglish · 1 day agomessage-square40fedilink
minus-squareFiskFisk33@startrek.websitelinkfedilinkarrow-up11·7 hours agohttps://www.npmjs.com/package/is-even don’t look at the weekly downloads if you are faint of heart.
minus-squareDecq@lemmy.worldlinkfedilinkarrow-up5arrow-down1·4 hours agoTo be fair in a dynamic typed language with dumb string to int coercions, I kinda get why such a would library exists. So it’s more a symptom of terrible language design than modern dependency hell.
minus-squarebobo@lemmy.mllinkfedilinkarrow-up5·edit-23 hours ago 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
minus-squareDecq@lemmy.worldlinkfedilinkarrow-up2arrow-down1·edit-22 hours ago 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.
minus-squarebobo@lemmy.mllinkfedilinkarrow-up1·2 hours agoGood point, but you can do if === true… and else if === false… But definitely better to throw an error instead of nan.
minus-squareHawk@lemmy.dbzer0.comlinkfedilinkEnglisharrow-up5·6 hours agoIf you really want to see some horror, follow the dependencies
minus-squareThanksForAllTheFish@sh.itjust.workslinkfedilinkarrow-up3·6 hours agohttps://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 non package, it’s dependency hell!
https://www.npmjs.com/package/is-even
don’t look at the weekly downloads if you are faint of heart.
To be fair in a dynamic typed language with dumb string to int coercions, I kinda get why such a would library exists. So it’s more a symptom of terrible language design than modern dependency hell.
If string return nan, else % 2
Dependency chain: is-even depends on is-odd which depends on is-number
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.
Good point, but you can do if === true… and else if === false…
But definitely better to throw an error instead of nan.
deleted by creator
If you really want to see some horror, follow the dependencies
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 non package, it’s dependency hell!