DEV Community

Discussion on: 10 useless NPM Package with millions of downloads

Collapse
 
alaindet profile image
Alain D'Ettorre

Actually, array-flatten and ismobilejs are not that useless. For example, array-flatten could be a little bit older than the standard Array.prototype.flat, which was not available before 2019.

Collapse
 
tehmoros profile image
Piotr "MoroS" Mrożek • Edited

Same with array-includes: it might have been a polyfill at some point. I didn't check the dates on it though, so I'm only assuming that was the case.

Collapse
 
jyotishman profile image
Jyotishman Saikia • Edited

javaascript array includes has support for all browser.

array-includes has a weekly downloads of 12,377,891.

So , I am thinking who are these 12,377,891 folks.

Thread Thread
 
ansile profile image
Ansile

Definitely not "all browsers". If you bothered to check, there are a few browsers that do not support it, but they definitely exist.

For example, Internet Explorer 11 is definitely still supported in many websites.

Thread Thread
 
jyotishman profile image
Jyotishman Saikia

there are a bunch of browsers available in the market. But we consider only the top modern browsers.

internet explorer is going to end very soon. So , i think majority of users dont use this browser as they have moved to edge.

Thread Thread
 
miketalbot profile image
Mike Talbot ⭐ • Edited

15% of my users. UK corporates that are not technical (Plumbers, Builders, Contractors etc). IE11 still shipped with W10. etc etc. Check out the Wikipedia stats, they still get ~5% of visitors on IE11. Can't wait until I say "not supported" lol.

Collapse
 
hyoretsu profile image
Aran Leite

In which case you can use Babel to turn you code into pre-ES6 instead of importing such a package.

Collapse
 
ansile profile image
Ansile

Actually, that is wrong. Babel by itself cannot transform prototype methods. That would require type information, which babel does not have. For example, a.includes(b) could be a call to an array method, or a method of your own Collection class (e.g. mobx ObservableArray).

And while babel turns language syntax into pre-es6, you still require polyfills.

You can get them all in a 'bulk' by importing from corejs, but it's a different story.

Collapse
 
shadowtime2000 profile image
shadowtime2000

As said before, not everyone wants to use Babel and setup complex build environments.

Thread Thread
 
hyoretsu profile image
Aran Leite • Edited

Said complex build environment:
babel.config.json
{
"minified": true,
"presets": [["@babel /env", { "targets": { "node": "current" }}]]
}

package.json
"scripts": {
"build": "babel src --out-dir dist",
},
"devDependencies": {
"@babel /cli": "^7.14.5",
"@babel /core": "^7.14.6",
"@babel /preset-env": "^7.14.7",
}

Thread Thread
 
shadowtime2000 profile image
shadowtime2000

Man you really just picked one part out of my comment which is the only part which you knew you could counter and then ignored the actual point. It is kind of irrelevant to the point that it isn't that complex, not all people want to use Babel, and saying that a package is useless because another package can do it is a horrible mindset and a horrible argument.

Thread Thread
 
hyoretsu profile image
Aran Leite • Edited

Look at the comment I answered. "As said before, not everyone wants to use Babel and setup complex build environments." just that. Even if we pick your other replies, they were "Yeah, because people want to support older browsers" and "Yes, Babel has polyfills, but not everyone wants to create complex build systems and may just want to stay a little more basic"
The second one's basically the one I answered, so stop coming up with random stuff. Babel not only has polyfills, but isn't complex and supports older browsers. That's all 3 of your replies countered.

As for "not everyone wants to use Babel", that's life. In a world where build tools or Babel didn't exist, a package that's a polyfill was useful. But it's been established as a great tool for quite some time now, so it's just using outdated/more complex solutions. Or in cases where you can't, which brings us to:

array-includes is used by 442 packages. One of those is create-react-app. Each app created with it also downloads array-includes. Which is not to say that people are willingly choosing to use it.

By the way, Babel has 24m weekly downloads, for all the "not everyone wants to use Babel and setup complex build environments" talk.