3 ms·
This is ridiculous. You don't need a module for a function that returns false (https://github.com/mde/false https://github.com/mde/false), and you sure as hell
by rootlocus 11y ago
This is ridiculous. You don't need a module for a function that returns false (https://github.com/mde/false https://github.com/mde/false), and you sure as hell don't need a dependency for a function that prepends N spaces to a string. It takes more keystrokes to add the dependency than it does to write the damn function. Not to mention it spares the NPM server additional requests, etc, etc.
If you can't trust yourself to write such a simple function, how confident are you about writing something a little more complicated? Or very complicated? Doesn't it bother you that you feel more confident in 10 simple lines of code written by a complete stranger than you are in yourself?
- joncampbelldev 11y agoI'm pretty sure that false module is a joke (along with the true module) Although I agree with you about the left pad function. It wouldn't even cross my mind to search for a library instead of just typing out the code. It does make sense as a function in a larger utilities library though, such as lodash. If you already have that as part of your code base then might as well take advantage, similar to apache commons/lang in the java world.
- spdionis 11y agoHell! just copy-paste it raher than adding a dependency.
- collyw 11y agoI spent many years programming Perl, which had no trim / strip funtcion to get rid of whitespace. The Perl cookbook has a recipe for one using a regxeg, and I have cut and pasted that into many other places. It always felt wrong cutting and pasting the same thing over and over, but it was never large enough for me to consider putting it in a package either.
- justinator 11y ago> but it was never large enough for me to consider putting it in a package either. That's OK, someone did it for you: https://metacpan.org/pod/Text::Trim https://metacpan.org/pod/Text::Trim CPAN to the rescue!
- collyw 11y agoI spend 90% of my time on the back end, coding in SQL or Python, setting up servers,cleaning data in SQL. JavaScript has enough quirks that I likely still don't know about, I feel it would be a far more sensible choice to import something like this rather than write my own. (Chances are that I wouldn't have known about this until now, so I would have written my own anyway.)