• EnderMB@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    4 months ago

    I’ve honestly never understood why someone at Google or Mozilla hasn’t decided to write a JavaScript Standard Library.

    I’m not opposed to NPM, because dumb shit like this happens everywhere. If such a package is used millions of times a day, perhaps it would make sense to standardise it and have it as part of the fucking browser or node runtime…

    • mindbleach@sh.itjust.works
      link
      fedilink
      arrow-up
      0
      ·
      4 months ago

      That’s basically how Javascript gets extended. I put off learning jQuery for so long that all the features I’d want are now standard.

      • dan@upvote.au
        link
        fedilink
        arrow-up
        1
        ·
        3 months ago

        Vanilla JS is pretty good on the client side, but leaves a lot to be desired on the server side in Node.js, even if you include the standard Node.js modules.

        For example, there’s no built-in way to connect to a database of any sort, nor is there a way to easily create a basic HTTP REST API - the built in HTTP module is just raw HTTP, with no URL routing, no way to automatically JSON encode responses, no standardized error handling, no middleware layer, etc.

        This means that practically every Node.js app imports third-party modules, and they vary wildly in quality. Some are fantastic, some are okay, and some are absolutely horrible yet somehow get millions of downloads per week.

    • seatwiggy@lemmy.dbzer0.com
      link
      fedilink
      English
      arrow-up
      0
      ·
      3 months ago

      There’s a js runtime called bun that is 90-something% feature equivalent to node and also has built in alternatives to many packages like express and bcrypt. I haven’t used it myself so I can’t speak to its quality but it’s always nice to see a little competition

      • Dr. Moose@lemmy.world
        link
        fedilink
        English
        arrow-up
        2
        ·
        3 months ago

        So is Deno! You can easily import npm: and node: packages and run typescript without transpiling. With Bun and Deno there’s no reason to use Node tbh.

        • sfxrlz@lemmy.world
          link
          fedilink
          arrow-up
          1
          ·
          3 months ago

          For starting new projects i absolut agree. At work we have a legacy react app that just will not run on bun and for deno we would probably have to rewrite some stuff.

      • hswolf@lemmy.world
        link
        fedilink
        arrow-up
        1
        ·
        3 months ago

        Sometimes it’s hard to detach It, specially dealing with web dev.

        The browser expects JS, since JS was made for the browser, so you make a front in JS. But now you need a back, and hey, you already have all models and repos in JS, might as well make the back with JS.

        It’s a vicious cycle. Honestly, JS is fine for either if you are component enough (ie. not using stuff like “is-number”), don’t get the hate on It.

        • rimjob_rainer@discuss.tchncs.de
          link
          fedilink
          arrow-up
          1
          ·
          3 months ago

          No, JS is for scripts, it should have never been a whole framework for a frontend. But we can’t get away from it now, because it’s the only thing we have for browsers.