4 ms·
> not what the code in this package does Here's `is-number` (https://github.com/jonschlinkert/is-number/blob/master/index.js https://github.com/jonschlinkert/i
by kinjba11 5y ago
> not what the code in this package does
Here's `is-number` (https://github.com/jonschlinkert/is-number/blob/master/index.js 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.
- tshaddox 5y agoNote that there’s a difference between “needs to be a package” and “needs to be used by everyone.” Nothing needs to be a package, because it’s always possible to copy paste code, regardless of how many lines it is.