News for hackers. Stuff that matters.
Re:NPM Vulnerability Discussion on Twitter by skrebbel on Tuesday May 10, 2022 @09:06AM (#31326632)
Hahahhahh isBetween, why

Compared to that, left-pad is rocket science

Re:NPM Vulnerability Discussion on Twitter by daurnimator on Tuesday May 10, 2022 @09:26AM (#31326843)
https://github.com/yefremov/isnan

An entire module for just `return value !== value;`

Re:NPM Vulnerability Discussion on Twitter by __s on Tuesday May 10, 2022 @09:36AM (#31326950)
Re:NPM Vulnerability Discussion on Twitter by jefftk on Tuesday May 10, 2022 @10:01AM (#31327214)
Which wasn't everywhere in 2017, when isnan was created: IE11 didn't (and still doesn't, though it's less relevant) have isNaN()

(Not supporting a culture of taking a dependency for this sort of thing, though)

Re:NPM Vulnerability Discussion on Twitter by jaywalk on Tuesday May 10, 2022 @10:22AM (#31327482)
Just to be clear, because your comment made no sense to me: what IE11 doesn't support is Number.isNaN(). It definitely does support (and has since IE3) plain isNaN(): https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
Re:NPM Vulnerability Discussion on Twitter by jefftk on Tuesday May 10, 2022 @11:03AM (#31327967)
Regular isNaN is very tricky, and almost never what you want: it first coerces its input to a Number, and then checks if that is NaN:

                isNaN   Number.isNaN
                -----   ------------
    {}           true          false
    [true]       true          false
    undefined    true          false
    "{}"         true          false
Re:NPM Vulnerability Discussion on Twitter by jaywalk on Tuesday May 10, 2022 @11:50AM (#31328546)
But none of those things you listed are numbers. The isNaN output is exactly what I want in pretty much every case.
Re:NPM Vulnerability Discussion on Twitter by jefftk on Tuesday May 10, 2022 @11:55AM (#31328620)
isNaN does not tell you whether something is not a Number either. Applying isNaN to any of these returns false: null, true, false, [], "", "cabbage".
Re:NPM Vulnerability Discussion on Twitter by _Algernon_ on Tuesday May 10, 2022 @10:34AM (#31327608)
I'm gonna create a package for isX() for each x in the set of integers. Please use my packages for all comparisons from now on.
Re:NPM Vulnerability Discussion on Twitter by Izkata on Tuesday May 10, 2022 @01:03PM (#31329494)
is-thirteen is six years old: https://www.npmjs.com/package/is-thirteen
Re:NPM Vulnerability Discussion on Twitter by _fat_santa on Tuesday May 10, 2022 @09:08AM (#31326653)
Nevermind on that one. I just checked NPM and thankfully that package does not exist.