News for hackers. Stuff that matters.
Re:My temporary PHP fix from 2014 has nearly 20M installs. T... by HackerThemAll on Thursday September 17, 2026 @04:43AM (#49738031)
Re:My temporary PHP fix from 2014 has nearly 20M installs. T... by domh on Thursday September 17, 2026 @07:59AM (#49739511)
These packages are basically memes at this point... Those download figures cannot be accurate for real production usage.

I don't believe any programmer is actually using these. isarray and left-pad are at least functions that didn't used to be in the standard library, to slightly excuse them.

Re:My temporary PHP fix from 2014 has nearly 20M installs. T... by sumtechguy on Thursday September 17, 2026 @09:18AM (#49740344)
I would not bet on that assumption. I have seen some wild code over the years from devs. With 'ai' type coding going on now too you may see them be used even more.
Re:My temporary PHP fix from 2014 has nearly 20M installs. T... by domh on Thursday September 17, 2026 @09:21AM (#49740388)
I would've actually thought AI would slightly improve upon this situation. At least in my experience claude seems to write a lot more little utility functions itself rather than reaching for a package from npm to do something. Requiring an `npm install` before getting something working risks triggering a permissions gate.
Re:My temporary PHP fix from 2014 has nearly 20M installs. T... by brookst on Thursday September 17, 2026 @09:41AM (#49740627)
Opus and fable both are pretty judicious about bringing in dependencies, at least for me. They often argue against and and write even decently large modules to avoid pulling stuff in.
Re:My temporary PHP fix from 2014 has nearly 20M installs. T... by sire-vc on Thursday September 17, 2026 @09:52PM (#49749317)
They never install packages for me and love handrolling large amounts of e.g. parsing code where a library exists. I have to keep telling them 'look for a large popular dependency' when they start writing huge functions that obviously already exist.

Was doing something with OSM the other day and Opus basically started reimplementing NetTopologySuite.

Re:My temporary PHP fix from 2014 has nearly 20M installs. T... by whywhywhywhy on Thursday September 17, 2026 @09:33AM (#49740536)
Major libraries used them so yeah the numbers are real, left-pad was in every react and babel install.
Re:My temporary PHP fix from 2014 has nearly 20M installs. T... by baubino on Thursday September 17, 2026 @09:35AM (#49740562)
Actual programmers do indeed use these packages, and in large numbers. I was in the unfortunate situation a few years ago of hiring a couple of interns (both juniors in a decent CS program) who relied heavily on these types of packages. They honestly thought that it saved them time and they didn’t seem to comprehend the bloat they were adding to otherwise simple code that they could’ve written themselves in 30 seconds. NPM trained a generation of programmers to look for packages rather than learning basic scripts.
Re:My temporary PHP fix from 2014 has nearly 20M installs. T... by domh on Thursday September 17, 2026 @12:53PM (#49743455)
It feels like (to me at least) that the pendulum is swinging back the other way. But maybe this is just my preference.
Re:My temporary PHP fix from 2014 has nearly 20M installs. T... by JaggerJo on Thursday September 17, 2026 @04:56AM (#49738126)
what a broken ecosystem.. The crazy thing is not that the package exists, but that it is used by JS devs.
Re:My temporary PHP fix from 2014 has nearly 20M installs. T... by junon on Thursday September 17, 2026 @05:16AM (#49738243)
I feel like I have to remind people of this quite often, but the history is such that npm was lightweight at one point, bundling wasn't a thing, and while `isodd`/`iseven` are of course silly, things like `isarray` were not functions that existed back then (we didn't have Array.isArray). `typeof [] === 'object'` in JS, so e.g. my package `is-arrayish` checked for a similar structure to an array (whereas Id guess `isarray` checked for the prototype). `isarray` failed for the `arguments` keyword, which was needed for variadics before argument spreads were added to the language I believe in ES5.

So of course they don't make sense now. But they were created for a reason. Before even Markov chains were a fad - let alone LLMs - we were trying to be as efficient as possible and maximize code reuse I stead of writing the same helper functions over and over again. That's what you're seeing.

Re:My temporary PHP fix from 2014 has nearly 20M installs. T... by b112 on Thursday September 17, 2026 @05:40AM (#49738400)
I hate to bring politics into such discussions, but this thought struck me as funny.

The hubris of humanity... what you're describing is akin to the US Constitution and the Founding Father's goals, ending in Donald Trump.

Node is the same horror.

Nice ideas, great premise, and all turned to garbage in the end.

Re:My temporary PHP fix from 2014 has nearly 20M installs. T... by toyg on Thursday September 17, 2026 @05:54AM (#49738494)
"The road to Hell is paved with good intentions". Still true, probably thousands of years after the sentence was coined.
Re:My temporary PHP fix from 2014 has nearly 20M installs. T... by junon on Thursday September 17, 2026 @05:42AM (#49738405)
I think a lot of things end up that way, just at different timescales. Best we can do is learn from them and start again, IMO - however that looks.
Re:My temporary PHP fix from 2014 has nearly 20M installs. T... by zarzavat on Thursday September 17, 2026 @09:37AM (#49740576)
Yes and the critical issue was tree shaking. Nowadays we have tree shaking so it doesn't matter as much but in the past people preferred small single function packages because they had less impact on the download size.
Re:My temporary PHP fix from 2014 has nearly 20M installs. T... by ChiperSoft on Thursday September 17, 2026 @09:46AM (#49740688)
Additional Context: for about two years functional programming was REALLY popular in the Node community. It was a fad to chain tons of tiny functions together, and thus lots of people wrote tons of tiny functions. This is why lodash/fp exists.
Re:My temporary PHP fix from 2014 has nearly 20M installs. T... by wat10000 on Thursday September 17, 2026 @09:56AM (#49740822)
I don’t think it ever made sense. Code reuse improves efficiency when the code can be shared in memory, or when it needs to be updated and you only have to change it in one place. JS packages don’t give you sharing beyond what you’d get from copying the code. And these little things don’t need to be updated, and in fact you probably don’t want them to be.

It’s a case of doing something without understanding why it’s done. Packages are good, code sharing is good, so use it for everything. But it misses why they’re good.

Re:My temporary PHP fix from 2014 has nearly 20M installs. T... by junon on Thursday September 17, 2026 @12:04PM (#49742774)
This is all very easy to say in hindsight. It's missing the context of having been there, I think. Things were just different.

Also, way more fun.

Re:My temporary PHP fix from 2014 has nearly 20M installs. T... by wat10000 on Thursday September 17, 2026 @12:07PM (#49742831)
I was definitely saying it at the time. But I wasn't embedded in the ecosystem, it was very much "those JavaScript guys are nuts, why would they do this?"
Re:My temporary PHP fix from 2014 has nearly 20M installs. T... by IncreasePosts on Thursday September 17, 2026 @12:32PM (#49743195)
You want to implement your own is-odd in your code - simple, right? isOdd = (x) => x % 2 == 1

Ut oh, your code is broken for negative numbers now since % isn't a true modulo operator...

Fine then, isOdd = (x) => x % 2 != 0

Ut oh, your code is broken because isOdd("hi") returns true now...

Fine then, isOdd = (x) => if(!isNumber(x)) throw... else return x%2 != 0

Ut oh, your code is now broken because isOdd(2^55+1) returns true now...

Re:My temporary PHP fix from 2014 has nearly 20M installs. T... by Dylan16807 on Thursday September 17, 2026 @04:05PM (#49745811)
> Ut oh, your code is now broken because isOdd(2^55+1) returns true now...

I think you messed up this example. Whether I literally use "2^55" with XOR or replace it with "2*55", that version of isOdd returns false.

False for isOdd(58) is obviously correct. (Also thanks C for permanently screwing up the precedence of bitwise operations because you didn't want to break some existing programs in 1972.)

False for isOdd(36028797018963970) is also correct, and if you expected to send in a different number the bug is in the "+1" not the isOdd.

Re:My temporary PHP fix from 2014 has nearly 20M installs. T... by IncreasePosts on Thursday September 17, 2026 @05:26PM (#49746776)
Sorry, it's supposed to be power. So 2**55 in JavaScript

2 to the 55th power is obviously even, so that +1 is obviously odd, but ((2*55) +1) % 2 == 0 in JavaScript.

Re:My temporary PHP fix from 2014 has nearly 20M installs. T... by Dylan16807 on Thursday September 17, 2026 @05:58PM (#49747192)
But there's no bug in isOdd. You're sending the number 36028797018963970 into it, which is clearly even.

Putting extra code between the parentheses of the function call doesn't make it the function's responsibility. As nice as it would be for debugging if you could stuff your entire program inside of isNaN((function(){ /* your code here */ })()) and force your browser vendor to fix all problems.

Re:My temporary PHP fix from 2014 has nearly 20M installs. T... by IncreasePosts on Thursday September 17, 2026 @09:53PM (#49749326)
You should check the math on a real calculator.

Despite what most JavaScript implementations will tell you, 2 to the 55th power is 36028797018963968, and adding one to that value is 36028797018963969. That's clearly odd.

There is no extra code between the parens. I just put them there so there wouldn't be any question as to operator precedence. I do see now that hn ate my double star, but I think you know what I mean since you told me the value that is spits out when you do the exponentiation

Re:My temporary PHP fix from 2014 has nearly 20M installs. T... by Dylan16807 on Thursday September 17, 2026 @10:49PM (#49749674)
> There is no extra code between the parens.

You have a plus and an exponentiation in there. That's code.

  var n = 2**55 + 1
  console.log(n)
  isOdd(n)
n is 36028797018963970. isOdd(n) is giving you the right answer. Putting the +1 inside the parentheses and talking about calculators is a sleight of hand that lets you pretend isOdd gets an odd number, but it doesn't. No odd numbers are around by the time isOdd actually does anything.

The problems are in + and/or our expectations of +. It does not output 36028797018963969, and we must acknowledge that.

Re:My temporary PHP fix from 2014 has nearly 20M installs. T... by rtkwe on Thursday September 17, 2026 @01:45PM (#49744132)
Ut oh? I've never seen that, is it variant on uh oh or something else?
Re:My temporary PHP fix from 2014 has nearly 20M installs. T... by IncreasePosts on Thursday September 17, 2026 @02:44PM (#49744847)
It's something I'm fighting for in my own little way.

Everyone does a glottal stop between the "uh" and "oh", so I'm trying to align the spelling

Unlike the guy on him who writes all years with 5 digits like 02026, I have good reasons for my idiosyncracies.

Re:My temporary PHP fix from 2014 has nearly 20M installs. T... by luplex on Thursday September 17, 2026 @02:54PM (#49744983)
Hm, I would not spell it with a "t" then, but maybe with an apostrophe instead.

"Uh'oh" is more readable in my opinion and won't be mispronou in ced

Re:My temporary PHP fix from 2014 has nearly 20M installs. T... by bigstrat2003 on Thursday September 17, 2026 @02:15PM (#49744515)
IsOdd and IsEven never made sense. They were a badge of shame that said "I have no idea how to program".
Re:My temporary PHP fix from 2014 has nearly 20M installs. T... by yurishimo on Thursday September 17, 2026 @05:11AM (#49738219)
There’s a bit more nuance as to why. It’s not fair to say that the average JS dev is reaching for a package like is-odd/is-even.

Years ago when npm was just getting started there was a lot of experimentation and land grabbing for packages. A few “prolific” developers were pushing these tiny utilities and then using them in their own projects which ended up being required as deps in other projects and then snowballed into is-odd being included in webpack at some point (I think I have that timeline roughly correct).

It’s still a crappy problem for sure but it’s not fair to paint most JS devs with a brush so broad.

Re:My temporary PHP fix from 2014 has nearly 20M installs. T... by austin-cheney on Thursday September 17, 2026 @09:06AM (#49740173)
Everything that touches JavaScript in the corporate world feels broken.

Look at any full stack job post. It’s a mess of tech stack nonsense on the backend for people who are terrified of JavaScript and a layering of framework madness on the frontend for people who are still terrified of JavaScript. So it should be no surprise to see packages like those in common use when people aren’t really writing, or even reading, the real code anyways.

That is just the coding aspect of it. There are many additional challenges to working with a bunch of cowards whose primary job is to pretend to be something they clearly aren’t.

Re:My temporary PHP fix from 2014 has nearly 20M installs. T... by dahart on Thursday September 17, 2026 @10:30AM (#49741335)
There’s not much evidence these are being used, only that they are dependencies for something else; that’s why the download numbers are so high.

I wouldn’t say it’s broken, I’d say there are tradeoffs, and devs have known this and discussed it since the start of npm or any package manager. You automatically get some bloat when you use other people’s software. That’s the downside. The upside is you don’t have to write the code yourself and you can create things more quickly by not solving problems that others have already solved.

It’s worth noting that AI has some of the same tradeoffs. The quality of what you get is still proportional to your prompting & reviewing effort, and spending low amounts of effort often results in similar amount of bloat.

Re:My temporary PHP fix from 2014 has nearly 20M installs. T... by shevy-java on Thursday September 17, 2026 @01:36PM (#49744009)
PHP devs are happy that npm exists. That way there is always a worse ecosystem down below.
Re:My temporary PHP fix from 2014 has nearly 20M installs. T... by vachina on Thursday September 17, 2026 @08:53AM (#49740023)
Whenever I see a npmjs project I nope out of it. I’d rather spend $50 on tokens to reimplement whatever JS slop in Python or Go.
Re:My temporary PHP fix from 2014 has nearly 20M installs. T... by JohnMakin on Thursday September 17, 2026 @03:53PM (#49745691)
is-even implementation:

> 'use strict';

> var isOdd = require('is-odd');

> module.exports = function isEven(i) {

> return !isOdd(i);

> };

Re:My temporary PHP fix from 2014 has nearly 20M installs. T... by d3Xt3r on Thursday September 17, 2026 @04:13PM (#49745898)
I thought you were joking, but then I checked the code... holy shit, it is real.

Surely the author's gotta be trolling, right?