orhtej2@eviltoast.org to Programmer Humor@programming.devEnglish · 4 days agoPeak code reuseeviltoast.orgimagemessage-square36fedilinkarrow-up1398arrow-down14
arrow-up1394arrow-down1imagePeak code reuseeviltoast.orgorhtej2@eviltoast.org to Programmer Humor@programming.devEnglish · 4 days agomessage-square36fedilink
minus-squareDecq@lemmy.worldlinkfedilinkarrow-up9arrow-down1·edit-23 days agoTo 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.
minus-squarebobo@lemmy.mllinkfedilinkarrow-up8·edit-23 days 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-23 days 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.
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.
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.
deleted by creator