Big part of the insanity is also how projects introduce dependencies for very simple things like padding a number or a string.
447,211 weekly downloads for what can be done in vanilla JS with foo % 2 === 1;
If you're writing straightforward application code where you already know you have a valid number, then this package probably isn't for you. You can just do num % 2 === 1.
function is_number(val) { return typeof val === "number"; }
With a function that easily written, no one should have any excuse to depend on a third-party dependency for it.
Here's `is-number` (https://github.com/jonschlinkert/is-number/blob/master/index...):
module.exports = function(num) {
if (typeof num === 'number') {
return num - num === 0;
}
if (typeof num === 'string' && num.trim() !== '') {
return Number.isFinite ? Number.isFinite(+num) : isFinite(+num);
}
return false;
};
Care to explain why these 5 lines of code need to be a package? To me, having something so simple be a package by itself is absurd.He abandoned the projects, but:
* https://github.com/jonschlinkert/is-odd
* https://github.com/jonschlinkert/is-even
Of course that doesn't stop them from getting ~500k downloads/week.