dormi.zone
  • Communities
  • Create Post
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
@Persona3Reload@lemmy.blahaj.zone to 196@lemmy.blahaj.zoneEnglish • 7 months ago

Rule

lemmy.blahaj.zone

message-square
57
fedilink
396

Rule

lemmy.blahaj.zone

@Persona3Reload@lemmy.blahaj.zone to 196@lemmy.blahaj.zoneEnglish • 7 months ago
message-square
57
fedilink
  • @FiskFisk33@startrek.website
    link
    fedilink
    14•6 months ago

    oh of course there is

    https://www.npmjs.com/package/is-even

    (do take a look at the download stats)

    • Fiona
      link
      fedilink
      13•
      edit-2
      6 months ago

      And that isn’t even the worst thing about it…

      The implementation looks like this:

      function isEven(i) {
        return !isOdd(i);
      };
      

      And yes, is-odd is a dependency that in turn depends on is-number…

    • @Micromot@feddit.org
      link
      fedilink
      English
      8•
      edit-2
      6 months ago

      Can’t you just

      If (number % 2 == 0){return true}

      • @blackn1ght@feddit.uk
        link
        fedilink
        12•6 months ago

        return number % 2 === 0

        • @Micromot@feddit.org
          link
          fedilink
          English
          1•6 months ago

          Yeah, that’s even simpler

      • @drake@lemmy.sdf.org
        link
        fedilink
        6•6 months ago

        but what if number isn’t an integer, or even a number at all? This code, and the improved code shared by the other user, could cause major problems under those conditions. Really, what you would want, is to validate that number is actually an integer before performing the modulo, and if it isn’t, you want to throw an exception, because something has gone wrong.

        That’s exactly what that NPM module does. And this is why it’s not a bad thing to use packages/modules for even very simple tasks, because they help to prevent us from making silly mistakes.

        • @Micromot@feddit.org
          link
          fedilink
          English
          1•6 months ago

          That would already cause an exception when calling the function because it has int number in the parameters

          • @drake@lemmy.sdf.org
            link
            fedilink
            4•6 months ago

            Javascript doesn’t have strongly-typed variables

        • @FiskFisk33@startrek.website
          link
          fedilink
          1•6 months ago

          ah the joys of loosely typed languages

      • Python
        link
        fedilink
        5•6 months ago

        no

        • @Micromot@feddit.org
          link
          fedilink
          English
          2•6 months ago

          ok

      • @FiskFisk33@startrek.website
        link
        fedilink
        5•6 months ago

        yup, which is why I find the download stats truly horrifying

    • @servobobo@feddit.nl
      link
      fedilink
      7•
      edit-2
      6 months ago

      “If it’s not an npm package it’s impossible”

      - JS devs, probably

    • tb_
      link
      fedilink
      5•6 months ago

      That’s a lot of downloads

196@lemmy.blahaj.zone

!196@lemmy.blahaj.zone

Subscribe from Remote Instance

Create a post
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: !196@lemmy.blahaj.zone

Be sure to follow the rule before you head out.


Rule: You must post before you leave.



Other rules

Behavior rules:

  • No bigotry (transphobia, racism, etc…)
  • No genocide denial
  • No support for authoritarian behaviour (incl. Tankies)
  • No namecalling
  • Accounts from lemmygrad.ml, threads.net, or hexbear.net are held to higher standards
  • Other things seen as cleary bad

Posting rules:

  • No AI generated content (DALL-E etc…)
  • No advertisements
  • No gore / violence
  • Mutual aid posts are not allowed

NSFW: NSFW content is permitted but it must be tagged and have content warnings. Anything that doesn’t adhere to this will be removed. Content warnings should be added like: [penis], [explicit description of sex]. Non-sexualized breasts of any gender are not considered inappropriate and therefore do not need to be blurred/tagged.

If you have any questions, feel free to contact us on our matrix channel or email.

Other 196’s:

  • !196@lemmy.world
  • !onehundredninetysix@lemmy.blahaj.zone
  • 666 users / day
  • 2.82K users / week
  • 5.64K users / month
  • 18K users / 6 months
  • 17.6K subscribers
  • 19.4K Posts
  • 222K Comments
  • Modlog
  • mods:
  • Moss
  • @greembow@lemmy.blahaj.zone
  • moss
  • Queue
  • funky-rodent [he/him]
  • Peachy [they/she]
  • @threegnomes@lemmy.blahaj.zone
  • @greembow@lemmy.world
  • @remotelove@lemmy.ca
  • Roflmasterbigpimp
  • @A_Very_Big_Fan@lemm.ee
  • qaz
  • @A_Very_Big_Fan@lemmy.world
  • @qaz@lemmy.sdf.org
  • qaz
  • @qaz@sh.itjust.works
  • BE: 0.19.3
  • Modlog
  • Legal
  • Instances
  • Docs
  • Code
  • join-lemmy.org