Why is there a is-even package on npm?

Viewed 3589

When I was browsing the npm package library, I came across a package named is-even.
This package is only for checking if a number is even. Surprisingly, this package has over 100,000 weekly downloads. And this package uses another package named is-odd.

But, the same can be achieved using a one-line-function, then why do so many people are using a third-party package for that?

https://www.npmjs.com/package/is-even

For those who say "That package supports error handling and works with strings", Yeah you are right. But can't a developer write error handling for an isEven function?

2 Answers

Probably an npm package depends on it also, and that npm package people are downloading. In any case, it is indeed a wasted resource. I suspect the developer using it doesn't know about the mod operator: %

isEven = value % 2 === 0
Related