4 ms·
All of these packages are created by Jon Schlinkert (https://github.com/jonschlinkert https://github.com/jonschlinkert). So if you want someone to blame...
by tokenizerrr 8y ago
All of these packages are created by Jon Schlinkert (https://github.com/jonschlinkert https://github.com/jonschlinkert). So if you want someone to blame...
- nailer 8y agohttps://github.com/jonschlinkert/is-odd/blob/master/index.js https://github.com/jonschlinkert/is-odd/blob/master/index.js Edit: the original code, even before the float handling, was was a perf optimisation: !!(~~i & 1); Nobody wants to see that in code unless it has a name. Maybe isOdd(). Maybe we should put it on GitHub to save others time. Sure beats copy-pasting from StackOverflow. Original: Did you think of handling floats in your home built isOdd implementation? Thankfully Jon (EDIT: or one of his contributors - doesn't change the point) did. And they added tests. The (flagged) article makes the staggering assumption that "we can't code" because we're not constantly reinventing the wheel. It talks about DRY being taken too far and talks about the functions being replaced as "one liners", when following a couple of links would show they're not. We can code, we're just coding on actual features, not rewriting the same poop.
- fenollp 8y agoNo he did not. https://github.com/jonschlinkert/is-odd/commit/dcc7eeff5be8f8190e2a7e63b76eae2992ad854f https://github.com/jonschlinkert/is-odd/commit/dcc7eeff5be8f...
- Klathmon 8y agoIsn't this evidence that the system is working? Because it's a package, a bug/oversight was found, and it was made more robust. I still wouldn't personally use `is-odd`, but isn't this proof that having something even this trivial as a package can have benefits?
- deleted 8y ago[deleted]
- samb1729 8y agoI find it interesting that the author added an `isInteger` dependency then went on to not use it.
- emodendroket 8y agoI'd say there are very few circumstances where you want to know if a number is odd but could plausibly have floats as an input.