22
Mr-Myrk
4y

Love it when you open up a frontend devs project and among some 50 included npm packages for a really simple project you see this

Comments
  • 5
    Isn’t that just a single basic function that someone put in a package for some dumb reason?
  • 4
    @Plasticnova wasn't*

    Unless he uploaded it again. The author had pulled it from NPM and sparked a big controversy a few years ago.
  • 0
    @pk76 I knew it sounded familiar. Someone took advantage of lazy devs
  • 4
    So I found the code, totally made for lazy people

    @highlight
    module.exports = leftpad;
    function leftpad (str, len, ch) {
    str = String(str);
    var i = -1;
    if (!ch && ch !== 0) ch = ' ';
    len = len - str.length;
    while (++i < len) {
    str = ch + str;
    }
    return str;
    }
  • 3
  • 2
    Yeah that's why I still do a lot myself in vanilla js. Why the fuck would you need al those fucking packages? Of course, when you need to pad a string, convert something to pascal case, etc, there's a module for that!
  • 1
    I gotta know, what is this project? Just basic functionality. 50 something dependencies, surely there is some need right.... right?
  • 2
    Isn't the ability to leftpad strings in ES by now anyway?
  • 5
    @pk76

    Now there's a replacement :D

    http://left-pad.io/
  • 1
    @Plasticnova aren't like 90% of dependencies like that? lol
  • 2
    @ilikeglue with npm, quite possibly

    I just wouldn’t install a package for a tiny function like that, I’d just write the function. It wouldn’t even occur to me to look for a package like this
  • 1
    @Plasticnova Just a frontend for an API, that I am managing, the API depends on10 things, of which 6 are external

    "require": {

    "php": ">=7.3",

    "ext-pdo": "*",

    "ext-json": "*",

    "ext-memcached": "*",

    "vlucas/phpdotenv": "^3.4",

    "guzzlehttp/guzzle": "^6.3",

    "php-di/php-di": "^6.0",

    "nikic/fast-route": "^1.3",

    "symfony/http-foundation": "^4.3",

    "robmorgan/phinx": "^0.10.8"

    },
  • 1
    @Mr-Myrk Those are all pretty reasonable.
  • 0
    I checked an old project and I do see how the number can build somewhat quickly. I had to have 9 damn packages for fontawsome because the project used icons from all the various pro packs. 9 entries just for fonts, and vue had several as well
  • 2
    @Mr-Myrk from that link:

    Can I buy an enterprise license?

    Yes. Email root@left-pad.io with your account and ABA routing numbers.

    You’ve got to be shitting me, tell me this is satire. Never mind it is, or I give up
  • 2
    You know, with software patents this could end up being a thing. Someone creates some unique (or not unique) software (algorithm, concept, etc) and gets it patented. Then they create microservice to allow apps to use this code for a usage fee. It could be a single function.
  • 1
    @Demolishun close but they don’t actually need to build anything exactly. They’ll get the bullshit patent (easy to do), threaten an infringement suit, and roll the dice on whether they will settle with some royalty agreement or go to court. If you pass up on settling because you know the claims are bullshit, better hope you can afford the fight because it truly does come down to money. What’s more likely to happen is even if you were to win, the claims are all dismissed, and you get a protective order, you still might go bankrupt from the battle. Then they just swoop in and buy the assets in bankruptcy, getting what they want in the end anyways.
  • 0
    Have you examined the results of create-react-app?
Add Comment