• Decq@lemmy.world
      link
      fedilink
      arrow-up
      5
      arrow-down
      1
      ·
      4 hours ago

      To be fair in a dynamic typed language with dumb string to int coercions, I kinda get why such a would library exists. So it’s more a symptom of terrible language design than modern dependency hell.

      • bobo@lemmy.ml
        link
        fedilink
        arrow-up
        5
        ·
        edit-2
        3 hours ago

        in a dynamic typed language with dumb string to int coercions, I kinda get why such a would library exists.

        If string return nan, else % 2

        So it’s more a symptom of terrible language design than modern dependency hell.

        Dependency chain: is-even depends on is-odd which depends on is-number

        • Decq@lemmy.world
          link
          fedilink
          arrow-up
          2
          arrow-down
          1
          ·
          edit-2
          2 hours ago

          If string return nan, else % 2

          So now you return a number type if it’s a string and a boolean if it’s an integer. How does that make sense?

          The is-even lib exists to sanitize input by throwing an exception which imho is better.

          Edit: having looked at the code better. Apparently it still allows string coercion (boo). It only checks for non integer numbers.