Why Does 'Is-Number' Package Have 59M Weekly Downloads?
shubhamjain.co
shubhamjain.co
When we talk about how we can help the planet climate change wise, there has to be a huge amount left on the table when it comes to build environments recreating themselves from scratch multiple times a day (CI/CD without "proper" caching) at a huge scale
I wonder what 1 person driving an EV does for the planet vs 1 commercial airliner vs 1 developer implementing "cache" at a huge company/project
Then rebuilding a container when the dependent upstream packages hadn’t changed would do absolutely nothing.
Today we only chose between rarely rebuilding and excessively doing so.
'is-odd' is a little bit more involved than 'is-even'. What it does, is:
> Returns true if the given number is odd, and is an integer that does not exceed the JavaScript MAXIMUM_SAFE_INTEGER.[0]
The full implementation of 'is-number' is as follows:
'use strict';
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;
};
Ridiculous as it may be, my guess is that provides a unified way of number checking while avoiding the pitfalls or crazy consequences which could arise from divide-by-zero[1], which I guess might prevent less-experienced folks from tripping up on some of the Javascript gotchas? I'm not really sure. That being said, I have seen those package dependencies in some serious stuff.Do I agree? I'm not really sure to be honest. Probably not.
[0] https://github.com/i-voted-for-trump/is-odd/blob/master/READ...
[1] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
EDIT: removed redundant sentence
When I was a Java developer just about everybody used it - Lots of widely used, tested, organised, and trusted utility functionality: https://commons.apache.org/
Presumably most decent packaging tools will strip out any unused code, it stops less experienced developers reinventing the wheel and importing another dependency without thought.
is-number was first published 9 years ago, when these kind of micro-packages were in vogue. braces was added as a dependency to chokidar over 6 years ago [1]. And if it ain't broke, don't fix it. I don't think the average JS dev today is going out and pulling in these deps.
[1] https://github.com/paulmillr/chokidar/commit/cbdf25563cfff7f...
Makes me question on just what sort of grounds are we building our systems on...