Re:Ride down into JavaScript dependency hell
by d_watt on Saturday April 11, 2020 @10:15PM
(#22845610)
It's funny, because in the case we're talking about, there appears to be edge case behavior if the number is a "safeInteger." While I agree in principle I would never import something as granular as "is-odd," just researching this specific package revealed an edge case someone ran into and solved, and you don't have to worry about as a dev if you take it off the shelf. https://github.com/jonschlinkert/is-odd/blob/master/index.js...
[ Parent
| on HN ]
Re:Ride down into JavaScript dependency hell
by jacobolus on Sunday April 12, 2020 @12:52AM
(#22846134)
Your "isodd" function should probably not be doing bounds checking and throwing an error when it encounters large even integers.
If you have a use case where you need to know if you multiplied two large integers and got a result larger than 2^53, then you should do it explicitly before you get to the point of checking if your number is even or odd.