You are viewing a single thread.
View all comments
96 points

You’ll find an npm package to help you count up to 2.

(I recently learned - maybe here - that the is-even package has over 170k weekly downloads)

permalink
report
reply
83 points

What’s even wilder is if you look at the code of that package, all it does is include the is-odd package and then return !is-odd. And the is-odd package isn’t much better, it does some basic checks on the input and then returns n % 2 === 1.

permalink
report
parent
reply
27 points

I thought I was missing something. JS is one of my main languages and I always just write the is-odd function myself since it’s like 10 characters. It boggles the mind that is-even has 176k weekly downloads

permalink
report
parent
reply
19 points

To be fair having a name can make things easier to read. I get that i % 2 == 0 is a common pattern and most programmers will quickly recognize what is happening. But isEven(i) is just that much easier to grok and leaves that brainpower to work on something else.

But I would never import a package for it. I would just create a local helper for something this trivial.

permalink
report
parent
reply
7 points

Also there are 40-something packages depending on it, so I guess it gets pulled automatically when they are used.

permalink
report
parent
reply
2 points

If youre lazy/busy enough, doing basic checks on the input is enough boilerplate to package out.

permalink
report
parent
reply
1 point

I’ve always looked at stuff like that as much more along the lines of performance art than anything else.

permalink
report
parent
reply
25 points

Is-even continues to be the best joke in the industry

permalink
report
parent
reply
11 points

Oh boy, this actually made me laugh out loud

permalink
report
parent
reply
10 points

This must be a “hold my beer” kind of joke and someone wanting to see how far they can take it.

permalink
report
parent
reply

Programmer Humor

!programmerhumor@lemmy.ml

Create post

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

  • Posts must be relevant to programming, programmers, or computer science.
  • No NSFW content.
  • Jokes must be in good taste. No hate speech, bigotry, etc.

Community stats

  • 6.4K

    Monthly active users

  • 1.5K

    Posts

  • 35K

    Comments