News for hackers. Stuff that matters.
Re:4B If Statements by lvncelot on Thursday December 28, 2023 @03:38AM (#38791336)
It's always worth mentioning that those packages stem from the effort of one dedicated npm spammer[1] to weasel his way into as many node_modules directories as possible. There's also packages for ansi-colors (no, not one package for all colors, one package for each color) and god knows what else. These then get jammed into any cli tool or other half-way sensible looking package, all referencing each other obviously - and any "real" project is just a single innocuous dependency away from having dozens of jonschlinkert packages.

[1] https://www.npmjs.com/~jonschlinkert

Re:4B If Statements by jevoten on Thursday December 28, 2023 @04:46AM (#38791758)
Achieving supply-chain security by controlling every link in the chain. This Jon is very noble.
Re:4B If Statements by jbverschoor on Thursday December 28, 2023 @05:47AM (#38792111)
Packages should specify their entitlements.. network access, file access, executing system calls, being able to monkey patch things, accessing packages outside their own.
Re:4B If Statements by vorticalbox on Thursday December 28, 2023 @05:54AM (#38792154)
Deno has a few of these by default an application has no access to the filesystem, env or network.

You can allow only reading or only writing for files and you can also define what domains are allowed.

Re:4B If Statements by jbverschoor on Thursday December 28, 2023 @06:57AM (#38792560)
Sure it's a huge step forward. But that's on an application level, which honestly I can do with sandbox-exec on macOS (see below).

In Deno, all permissions would still propagate down to the dependencies.

  (version 1)
  (deny default)
  (allow file-read*
    (subpath "~/Downloads")
  )
  (allow network-outbound
    (remote tcp "localhost:80")
  )
or

  (version 1)
  (allow default)
  (deny network*)
or

  # start an airgapped shell, and play around in there..
  sandbox-exec -p "(version 1)(allow default)(deny network*)" bash
Re:4B If Statements by vorticalbox on Friday December 29, 2023 @03:17AM (#38802750)
There have been a few GitHub issues open but from what I can tell it's in the "not technically possible with V8 VM" category
Re:4B If Statements by smolder on Thursday December 28, 2023 @06:22AM (#38792333)
Realistically I think they long ago should have been banned from npm, with all submissions deleted.
Re:4B If Statements by fmx on Thursday December 28, 2023 @05:46AM (#38792105)
When I first heard of the is-odd and is-even NPM packages I was sure they were a joke, yet there we are: 200K weekly downloads! Publishing the packages may have been the effort of one spammer, but many developers obviously chose to use them - that's the part that boggles my mind.
Re:4B If Statements by lvncelot on Thursday December 28, 2023 @06:02AM (#38792199)
Well, look at one of the dependents: https://www.npmjs.com/package/handlebars-helpers - certainly a more useful npm package, but by the same author. Seldom do people actually type `npm install is-even` - there's just a jungle of transitive dependencies that can be traced back to one of jonschlinkert's many packages, which then circles back to something inane as `is-even` or `ansi-red`.

I once ran a simple grep in some of my node projects - most of them had a jonschlinkert package in node_modules, certainly not through any (direct) choice of my own.

Re:4B If Statements by spacechild1 on Thursday December 28, 2023 @06:07AM (#38792228)
Check out this very useful utility: https://github.com/mitsuhiko/is-jonschlinkert :)
Re:4B If Statements by bryancoxwell on Thursday December 28, 2023 @06:15AM (#38792280)
I love the release notes:

> It exists.

Re:4B If Statements by password4321 on Thursday December 28, 2023 @11:30AM (#38795171)
Possibly related: https://github.com/SukkaW/nolyfill vs. ljharb and nodejs 4
Re:4B If Statements by runarberg on Thursday December 28, 2023 @12:59PM (#38796281)
I recently came across this issue (https://github.com/import-js/eslint-plugin-import/issues/213... and https://github.com/import-js/eslint-plugin-import/issues/181...) and man that person has really found him self a hill.

What is a bit worrying though is that he is an active member and contributor to TC-39. Meaning that this kind of community hostility is very much alive among the people who rule JavaScript.

Re:4B If Statements by Ataraxic on Thursday December 28, 2023 @01:33PM (#38796781)
View their obstinance: https://github.com/nvm-sh/nvm/issues/794

8 years later and despite much support for the `.node-version` file.

Someone else started using the .node-version file years ago, and because all open source packages won't form a committee to standardize this file, nvm will not support it.

They have a lot of hills. JS Private Properties was another.

Re:4B If Statements by wk_end on Thursday December 28, 2023 @02:21PM (#38797385)
Very often when I’m digging around GitHub Issues because of some bug or quirk or insanity in the JS ecosystem (which is often) I see someone spout the worst possible take - often being kind of a jerk about it - and when I look to see who’s responsible, very very often, ljharb’s name pops up. Often.

Dogpiling on someone deep in an HN comments tree isn’t exactly the classiest thing but…never having interacted with him myself, I’ve been harbouring this low-grade antipathy towards him - nothing unhealthy, just a groan whenever I see his name on GH - for years now, and it’s cathartic and almost gratifying, given his prominence in the community, to feel seen like this. Thank you.

Re:4B If Statements by runarberg on Thursday December 28, 2023 @02:56PM (#38797848)
I was doing some snooping around and found this earlier discussion https://news.ycombinator.com/item?id=37602923 from September 2023 (234 points, 110 comments), which I had missed at the time, very related to this current subthread, and includes posts such as these (https://news.ycombinator.com/item?id=37604635).

I think we as a community really need to have a conversation about ljharb and his role in the future of our industry. If he was only a library maintainer, that would be one thing, we could just move on, find workarounds, alternatives, etc. But his involvement in TC-39 makes him one of our rulers in a non-democratic structure. That makes this different.

Re:4B If Statements by Aeolun on Thursday December 28, 2023 @06:11PM (#38799904)
To be fair, the ESM switch has been botched beyond compare.

It’s like they didn’t want to become Python 2/3, and then did the absolute worst possible alternative.

It is beyond frustrating that it’s up to individual package authors whether or not their package supports ESM or CommonJS.

And yeah, it’s a pita when one of your downstream dependencies decides to go ESM only, and breaks your entire friggin chain of stuff that depends on it being CommonJS.

Re:4B If Statements by runarberg on Thursday December 28, 2023 @06:55PM (#38800227)
I agree. Mistakes were made and migration has been unnecessarily hard. This particular issue doesn’t even affect me. I simply turned off `no-unresolved`. TypeScript handles a lot better anyway (even with jsdoc type annotations).

But what is the issue here is the stubbornness of the maintainer and his unwillingness to accommodate a very sizable portion of his user base. The industry is moving on, and as a TC-39 member he should be aware of where the community is moving as well as show some empathy with his users.

Re:4B If Statements by fmx on Thursday December 28, 2023 @06:12AM (#38792259)
I see, thanks. I guess that answers one question, but raises another: why have his packages depend on more of his packages? If his goal was to be included in as many node_modules directories as possible, and handlebars-helpers was already included what's the point of pulling in is-odd/is-even, too?
Re:4B If Statements by ncruces on Thursday December 28, 2023 @06:40AM (#38792456)
Makes is-odd/is-even popular; many downloads; raises their (and his) profile.
Re:4B If Statements by peteradio on Thursday December 28, 2023 @07:30AM (#38792807)
He could sell rights to the repos and disavow any knowledge of its maintenance while maintaining the link in his own repos. When those sold rights are used to commit some crime he has plausible deniability as anyone else but got a payday. If you try spinning off the subpackage just prior to a sale then it shows some sort of intent.
Re:4B If Statements by umanwizard on Thursday December 28, 2023 @11:21AM (#38795011)
Is there any evidence that he has ever done anything like this, or that he plans to? Or is this just pure speculation?
Re:4B If Statements by peteradio on Thursday December 28, 2023 @12:04PM (#38795549)
I didn't declare he's done this only that it is a vulnerability of depending on those packages.
Re:4B If Statements by plufz on Thursday December 28, 2023 @08:51AM (#38793456)
Might be this from his GitHub bio “Several years ago, just before my 40th birthday, I switched careers from sales, marketing and consulting to learn how to program” Good way to get more eyeballs…
Re:4B If Statements by fmx on Thursday December 28, 2023 @11:56AM (#38795455)
Ah yes, that actually explains a lot! Thanks.
Re:4B If Statements by tshaddox on Thursday December 28, 2023 @09:42AM (#38793888)
Here we are all talking about him now!
Re:4B If Statements by Levitz on Thursday December 28, 2023 @11:07AM (#38794826)
Would it be considered bad practice or in poor taste to make pull requests in projects with the sole objective of implementing is-even natively?

Thinking of being the change I want to see in the world.

Re:4B If Statements by verandaguy on Thursday December 28, 2023 @12:52PM (#38796174)
It’s probably contextual but I’d say it’s in poor taste to use them in the first place. Removing them is a net benefit imo.
Re:4B If Statements by divbzero on Thursday December 28, 2023 @06:26AM (#38792364)
I did learn one new thing from browsing the is-odd source code: Number.isSafeInteger(n) checks that n falls within the [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER] interval.

  ...
  if (!Number.isSafeInteger(n)) {
    throw new Error('value exceeds maximum safe integer');
  }
  ...
Re:4B If Statements by skitter on Friday December 29, 2023 @10:48AM (#38806173)
Shouldn't this simply return true instead of throwing?
Re:4B If Statements by brainzap on Thursday December 28, 2023 @07:24AM (#38792754)
the bigger joke is that programming language have no built in
Re:4B If Statements by fifilura on Thursday December 28, 2023 @07:35AM (#38792829)
Huh? Did you miss the modulo operator?
Re:4B If Statements by kristopolous on Thursday December 28, 2023 @07:55AM (#38793005)
It wouldn't have 200k downloads a week unless there was a large number of programmers who didn't know how to do it.

I mean we're talking FizzBuzz secret sauce here. This must be total black magic for a catastrophic percentage of programmers

Re:4B If Statements by RugnirViking on Thursday December 28, 2023 @08:16AM (#38793150)
A more catastrophic number of programmers a) dont know how dependencies work and b) think everyone else are idiots.
Re:4B If Statements by kristopolous on Thursday December 28, 2023 @12:15PM (#38795681)
Maybe the person you're talking to on hn isn't a total moron.

Perhaps, I solidly understand how dependencies work and in this case my observation is correct

Someone made the decision to use that and someone thought using stuff made by a person's who makes those kinds of decisions was a good idea and so on.

You can git blame dependencies all the way down and research the parties involved. I've done it, built tools for it even.

A stack of people who make bad decisions doesn't make good software.

Re:4B If Statements by robertlagrant on Friday December 29, 2023 @04:53PM (#38810675)
More likely the author made another, more useful, package that uses it.
Re:4B If Statements by arzig on Thursday December 28, 2023 @09:08AM (#38793597)
I have not read the source but I had always assumed that this was the lovingly crafted effort of someone who is intimately familiar with the js standard making sure that some hypothetical expression like ![1] is neither odd nor even. Surely the idea that modulo is beyond developers is too horrifying to contemplate.
Re:4B If Statements by umanwizard on Thursday December 28, 2023 @11:24AM (#38795070)
Here you go:

    /*!
     * is-odd <https://github.com/jonschlinkert/is-odd>
     *
     * Copyright (c) 2015-2017, Jon Schlinkert.
     * Released under the MIT License.
     */
    
    'use strict';
    
    const isNumber = require('is-number');
    
    module.exports = function isOdd(value) {
      const n = Math.abs(value);
      if (!isNumber(n)) {
        throw new TypeError('expected a number');
      }
      if (!Number.isInteger(n)) {
        throw new Error('expected an integer');
      }
      if (!Number.isSafeInteger(n)) {
        throw new Error('value exceeds maximum safe integer');
      }
      return (n % 2) === 1;
    };
It does some checking the `value` is an integer in the safe range, which doesn't even seem right to me. Why shouldn't you be able to call this on integers outside the save range?
Re:4B If Statements by addaon on Thursday December 28, 2023 @11:50AM (#38795375)
All non-safe integers are even, yes?
Re:4B If Statements by johnfn on Thursday December 28, 2023 @02:00PM (#38797140)
(10e15 + 1) % 2 === 0
Re:4B If Statements by fifilura on Thursday December 28, 2023 @10:01AM (#38794009)
Sad but true. For JavaScript these kind of functions can actually be useful because of all the quirks. If that was the GPs hint then I can understand.
Re:4B If Statements by SkyBelow on Thursday December 28, 2023 @01:21PM (#38796589)
Given the lack of integers and my hesitancy to trust modulo for non-integer variables, I don't know if I would trust it. You would need to add some safety checks, but either you create an is_even/is_odd function that has safety checks, or you have to rely on developers adding in the checks anytime the number might have been in close proximity to a floating point number.

Something as simple as this can end up being neither even or odd.

    (0.1 + 0.2) * 10
Re:4B If Statements by charlieyu1 on Thursday December 28, 2023 @03:03PM (#38797937)
It is not just modulo, it also test for whether the input is a number or integer. It also has one dependency, is-number. And isOdd(“3”) returns true.

Basically it helps dealing with all the typing problems of Javascript, and also fitting into functional programming paradigms.

Re:4B If Statements by ownlife on Thursday December 28, 2023 @03:21PM (#38798119)
If you need to know if a number is even or odd then you should convert it to an int natively anyway.
Re:4B If Statements by paulddraper on Thursday December 28, 2023 @02:00PM (#38797134)
Often the is-even package will be imported by another (less ridiculous) package of the same author.
Re:4B If Statements by MyFirstSass on Thursday December 28, 2023 @06:19AM (#38792303)
Seriously fuck this dude leeching on the open source community.

He's not even a technical guy but has a background i marketing and is directly trolling various Github issues :

https://news.ycombinator.com/item?id=28661094

I've always wondered why node-modules and npm required such an insane amount packages so quickly, and now i know why, people like him that use their 10.000 ridiculous packages to boost their career or do whatever self serving community destroying thing they can think off that day.

There really should be a way to ban people doing this shit.

Re:4B If Statements by yreg on Thursday December 28, 2023 @07:08AM (#38792649)
The author hasn't forced you to import their package. What's there to ban apart from maybe polluting the common namespace?
Re:4B If Statements by posix86 on Thursday December 28, 2023 @08:23AM (#38793208)
It's more a statement about the community than him imo. Or maybe about what npm allows to be published. Nobody forced you to use is-odd, yet it's downloaded 200k a week, why? Because js' developer community doesn't know any better
Re:4B If Statements by kardos on Thursday December 28, 2023 @12:20PM (#38795759)
A lot or these downloads may be CI systems running automatic tests.
Re:4B If Statements by darkwater on Thursday December 28, 2023 @12:50PM (#38796148)
They clearly are, but this still means a not negligible amount of softwares have those packages in their dependencies.
Re:4B If Statements by geodel on Thursday December 28, 2023 @11:13AM (#38794913)
Exactly right. Its clever way of deflecting blame that whole community should share by piling on this particular person.
Re:4B If Statements by ycombobreaker on Thursday December 28, 2023 @12:40PM (#38796030)
This really sounds like victim-blaming. The community is vulnerable to somebody publishing asinine modules, which should be addressed. However, this individual is still the perpetrator.
Re:4B If Statements by sam_bristow on Thursday December 28, 2023 @01:45PM (#38796947)
Maybe someone needs to do a website in the same spirit of https://youmightnotneedjquery.com except youmightnotneedjonschlinkert.
Re:4B If Statements by whstl on Thursday December 28, 2023 @09:28PM (#38801188)
Notice that most dependents of his tools are: 1) his own project, 2) abandoned beginner projects.

As some people mentioned, most of the usage of is-even is by tools made by this person.

But the other part is that, he made quite a few development tools for beginners that scaffold new projects and pull lots of his packages as dependencies (especially the handlebars helper), which heavily inflates the number of "Dependents" in NPM.

The other issue is that, in the past, he managed to include some of his less-useless packages in some semi-popular tools.

Re:4B If Statements by bee_rider on Thursday December 28, 2023 @11:22AM (#38795027)
I mostly write in languages without package managers so it is possible that my expectations are just wrong, but is there no way of showing your dependency graph when using npm?
Re:4B If Statements by christophilus on Thursday December 28, 2023 @02:03PM (#38797176)
Here are some popular ones. Now, in two of these cases, they can be dev-dependencies, but even there, it makes me angry, since all of those deps have to be downloaded to my machine, and can run any random code they want at install time (which is why Node projects should always be run in some kind of sandbox).

https://npm.anvaka.com/#/view/2d/jest

https://npm.anvaka.com/#/view/2d/tailwind

https://npm.anvaka.com/#/view/2d/aws-sdk

Re:4B If Statements by throwitaway1123 on Thursday December 28, 2023 @04:35PM (#38798964)
> can run any random code they want at install time (which is why Node projects should always be run in some kind of sandbox).

You can install with the --ignore-scripts flag. Or set the option globally in your npm config file.

Re:4B If Statements by umanwizard on Thursday December 28, 2023 @11:28AM (#38795134)
Isn't the post you linked to about a different person?
Re:4B If Statements by paulddraper on Thursday December 28, 2023 @02:02PM (#38797161)
> There really should be a way to ban people doing this shit.

???

There is. It's called "doing nothing."

It takes work to add a dependency to your project; they don't spring out of nothing.

Re:4B If Statements by AussieWog93 on Thursday December 28, 2023 @07:28AM (#38792793)
This is the first time I'm hearing about this guy, but not sure why there's so much hate.

It looks like he came from a non-technical background, and is trying to make the language more noob friendly.

Compare the pair:

if isEven(n) { }

if (n % 2) == 0 { }

I guarantee you my wife would have no idea what the second snippet even means.

Re:4B If Statements by numpad0 on Thursday December 28, 2023 @08:25AM (#38793222)
if !(n & 1) {} // rightmost bit(LSB) is always `true` for odd integers
Re:4B If Statements by btdmaster on Thursday December 28, 2023 @09:07AM (#38793584)
For code golf purposes, ~n&1 works fine
Re:4B If Statements by extrememacaroni on Thursday December 28, 2023 @09:05AM (#38793566)
AussieWog93 should marry this guy instead.
Re:4B If Statements by cperciva on Thursday December 28, 2023 @03:39PM (#38798307)
// FIXME: This breaks on negative numbers on ones-complement machines
Re:4B If Statements by MrJohz on Thursday December 28, 2023 @09:00AM (#38793530)
There's an argument to be made for writing functions like `isEven` and using them instead of n%2. There's an argument that the JS standard library, or other comprehensive util libraries like Lodash or Underscore should include these functions.

The problem here is introducing separate dependencies for each of these tiny functions. Dependencies are code that you haven't written, but are still your responsibility. For a lot of things, that's a good tradeoff: if you don't have the expertise in a specific area, or if you can offload work to a dependency that you trust, that's great. But for micro dependencies like this, it's usually a bad deal - you don't get anything in return (seriously, how hard is it to write your own isEven function?) but you have to rely on a third party to be secure, to not push anything accidentally broken, to not change the API, etc.

(I think it's also worth pointing out that your wife is not a paid programmer. Software development should be accessible, but this isn't the only goal, and I think it's reasonable to assume that most programmers either understand the n%2 idiom, or know enough to be able to find help on the subject.)

Re:4B If Statements by buttercraft on Thursday December 28, 2023 @10:26AM (#38794308)
The hate is deserved. This person lacks ethics.
Re:4B If Statements by wvh on Friday December 29, 2023 @09:14AM (#38805077)
Most professions require some sort of degree or license before you get to practice it. If your wife wants to develop software, she should learn the basics. Especially when her code is included in larger projects and ecosystems.

I think the criticism comes from the fact it is hard to avoid driving over badly designed bridges or avoid wasteful dependencies in the Javascript ecosystem due to the way the package management is organised, and it is felt this specific person contributes a lot to that problem.

I have no knowledge of this person, but I often avoid Javascript and NPM for exactly that reason. I'm hopeful of Deno though to fix some of that mess.

Re:4B If Statements by umanwizard on Thursday December 28, 2023 @07:52AM (#38792979)
It seems very uncharitable to describe someone as a “spammer” because their philosophy on the proper size of units of code reuse is different from yours.
Re:4B If Statements by Y_Y on Thursday December 28, 2023 @10:29AM (#38794344)
It seems overly charitable to me to frame the dispute in those terms. You and I might differ as to the appropriate amount of vermouth in a martini or pineapple on a pizza and I won't worry much about it, within reason.

There's a limit though! I think up to about 10% pineapple by weight is reasonable for a Hawaiian, if you choose 0 or 20% then we'll have no issue. If you went to 30% I don't think I could stop myself writing a libellous remark on hn. Anything about 50% and I would be morally forced to denounce you to the proper authorities. About 80% is where the nightmares begin.

Re:4B If Statements by hex4def6 on Thursday December 28, 2023 @02:38PM (#38797602)
At a certain point, isn't it just grilled pineapple with pizza crumbs?
Re:4B If Statements by pc86 on Thursday December 28, 2023 @10:33AM (#38794392)
Even if you think having a dependency load `is_even()` is a good thing, surely you can see how it's pretty hard to defend having a completely separate and nearly identical `is_odd()` rather than just `!is_even()`
Re:4B If Statements by Exoristos on Thursday December 28, 2023 @07:40PM (#38800502)
The argument is that non-programmers like his wife don't understand e.g. `!`.
Re:4B If Statements by pc86 on Saturday December 30, 2023 @09:25AM (#38815479)
I think if you're installing npm packages and writing code you're a programmer whether you want to be or not.
Re:4B If Statements by shp0ngle on Thursday December 28, 2023 @09:17AM (#38793679)
You may not like it, but this is what 10x performance looks like
Re:4B If Statements by joenot443 on Thursday December 28, 2023 @09:40AM (#38793880)
> Several years ago, just before my 40th birthday, I switched careers from sales, marketing and consulting to learn how to program, with the goal of making the world a better place through code [1]

It checks out, sales/consulting folks are pretty infamous for their tendency to abuse metrics. The metric here is npm downloads and Github stars.

The strategy does mean that he's _technically_ not inaccurate in claiming this on his LinkedIn -

> NASA, Microsoft, Google, AMEX, Target, IBM, Apple, Facebook, Airbus, Mercedes, Salesforce, and hundreds of thousands of other organizations depend on code I wrote to power their developer tools and consumer applications.

I encountered this type a lot in college consulting groups, it's a little funny seeing one make their way to the OSS community.

[1] https://github.com/jonschlinkert

Re:4B If Statements by whaleofatw2022 on Thursday December 28, 2023 @10:51AM (#38794617)
Yeah but this might make him the Patient Zero for modern tech influencing and blogspam.
Re:4B If Statements by galangalalgol on Thursday December 28, 2023 @12:06PM (#38795568)
Anyone know if this has spread to crates.io yet? I see plenty of name squatting, but I haven't run into real crates trying to insert themselves into everything. Namespaces are sorely needed, including some semi-official ones. candi::rand would be reasonable for candidates to enter std. Watching the battles over tokio getting into candi would be fun.
Re:4B If Statements by internetter on Thursday December 28, 2023 @10:30PM (#38801502)
> Watching the battles over tokio getting into candi would be fun.

What would be the argument for this? It's my understanding that the lack of a default runtime is considered a strength

Re:4B If Statements by jd24 on Thursday December 28, 2023 @01:46PM (#38796970)
> To date, I've created more than 1,000 open source projects

This dude is counting each one as a project hahaha

Re:4B If Statements by jv22222 on Thursday December 28, 2023 @02:49PM (#38797753)
It reminds me of graffiti tagging!
Re:4B If Statements by buttercraft on Thursday December 28, 2023 @02:06PM (#38797200)
It's the truth but not the whole truth
Re:4B If Statements by pc86 on Thursday December 28, 2023 @10:30AM (#38794358)
So what excuse do the people installing these packages have?
Re:4B If Statements by mbb70 on Thursday December 28, 2023 @10:34AM (#38794403)
Another classic from jon is the venerable https://www.npmjs.com/package/isobject coming in at 30,000,000 weekly downloads for

`function(val) { return val != null && typeof val === 'object' && Array.isArray(val) === false; }`

But honestly, having seen "TypeError: Cannot read properties of null" enough times, I give it a pass.

https://npm-stat.com/charts.html?author=jonschlinkert paints a pretty crazy picture

Re:4B If Statements by orenlindsey on Thursday December 28, 2023 @10:42AM (#38794495)
That's hilarious. The best part is that he didn't even try to make good packages (not that hard) but just took the lazy route.
Re:4B If Statements by geodel on Thursday December 28, 2023 @11:12AM (#38794894)
Well one reason could be this software proverb: Good programers are lazy programers.
Re:4B If Statements by mkgeorge7 on Thursday December 28, 2023 @01:21PM (#38796596)
I'm relatively new to the world of node. Is there anything objectively wrong or should I say nefarious with that this Jon person is doing? I guess, what's the issue here, from your perspective, if he's creating package (that albeit are simple) but some some amount of utility?
Re:4B If Statements by lolc on Thursday December 28, 2023 @02:35PM (#38797570)
In my view it is objectively wrong to create trivial npm packages yes. If we look at the npm ecosystem as a commons, that person is polluting it. Of course you could say it's namespaced to one account, so what's the harm? In my view, plenty:

- package searches will show these packages due to the inflated usage from transient deps.

- installs are slower due to the package noise.

- increased attack surface when they are used

- cultural normalization of throwaway packages

Probably more.

Re:4B If Statements by johannes1234321 on Thursday December 28, 2023 @03:43PM (#38798347)
Each dependency causes work for any serious use. You got to check license, got to check for updates, risk supply chain attacks (package disappearing, package replaced with bad code, ...) etc. which causes longer term cost.

In addition abstraction of trivial checks, makes it harder to see the limitations of said routine. How well does it work on numeric strings? How well on large numbers where float properties cause issues?

Re:4B If Statements by Jasper_ on Thursday December 28, 2023 @01:47PM (#38796991)
My favorite is the existence of both https://github.com/jonschlinkert/ansi-gray and https://github.com/jonschlinkert/ansi-grey that do the exact same thing.
Re:4B If Statements by johnfn on Thursday December 28, 2023 @02:03PM (#38797178)
It's weird to me that in every other comment thread on Hacker News, people say "good software should do one thing and do it well". And then the topic moves to NPM, and suddenly everyone loses their mind?
Re:4B If Statements by throwitaway1123 on Thursday December 28, 2023 @04:04PM (#38798592)
This is part of the UNIX philosophy, but sometimes this gets taken way too far. There is of course the UNIX command "yes", which literally just prints the character "y" over and over again (to skip interactive prompts).
Re:4B If Statements by ericbarrett on Thursday December 28, 2023 @05:30PM (#38799546)
GNU yes will actually repeat any string—the default is of course "y". So it's very handy for scripting, and not really as single-purpose as you'd think.
Re:4B If Statements by throwitaway1123 on Thursday December 28, 2023 @05:58PM (#38799808)
Yeah it's definitely useful. Still a bash one liner though:

  function yes { while true; do echo "${1:-y}"; done }
Re:4B If Statements by rini17 on Friday December 29, 2023 @03:28AM (#38802809)
also, it's actually faster than reading /dev/zero if you need some filler data hahahaha
Re:4B If Statements by jrockway on Thursday December 28, 2023 @02:48PM (#38797736)
A little copying is better than a little dependency.
Re:4B If Statements by lolc on Thursday December 28, 2023 @02:38PM (#38797605)
Haha ok do something substantial! It's implied.