3 ms·
this may no seem like an odd comment (please at least admire the pun), but generally I can see value in this. All this stuff is-even and is-number is doing to m
by jacomoRodriguez 5y ago
this may no seem like an odd comment (please at least admire the pun), but generally I can see value in this. All this stuff is-even and is-number is doing to make sure that it is actually a number, throwing errors etc. pp. sure, I could do it myself, but I would probably miss half of the cases and would spend some time finding the right solutions for the other half. Why I should reinvent the wheel if someone already has, and that in a good and thought through way?
Don't get me wrong, there are tons of needless packages on npm, but in this case I can see the value (ok, maybe the is-odd is one too much and !is-even would be enough)
just to to trigger a bit more: Pretty sure a case manufacturer could develop it's own screws... but I think in most cases they just use what someone else provides...
- kevin_thibedeau 5y agoWhy would a computer language make working with integers needlessly difficult? This should have been standard functionality from day one.
- city41 5y agoJavaScript was hacked together extremely quickly and Eich almost certainly had no idea we'd be where we are today.
- city41 5y agoIn that case I'd argue use lodash: https://lodash.com/docs/4.17.15#isNumber https://lodash.com/docs/4.17.15#isNumber It's well respected, battle tested, and you can just pull in the functions you actually use. It doesn't have isEven, but it probably drew a good line there.