You are unaware of a core part of JavaScript history, which is why you don't understand why "I'm not importing a library to do left pad" is not only a proper example, but THE BEST example.
String.padStart was added in 2017.
This happened in 2016 https://en.m.wikipedia.org/wiki/Npm_left-pad_incident
It is, however, almost never justified to bring in a dependency for something that's in the standard library. The correct solution for that, in JavaScript-for-the-web, is a shim. left-pad is not a suitable example.
A better example would be https://www.npmjs.com/package/ansi-red:
/*!
* ansi-red <https://github.com/jonschlinkert/ansi-red>
*
* Copyright (c) 2015, Jon Schlinkert.
* Licensed under the MIT License.
*/
'use strict';
var wrap = require('ansi-wrap');
module.exports = function red(message) {
return wrap(31, 39, message);
};
But while this makes a point, does it really make the original point? This ansi-red library has at least two footguns, right off the bat.(Unless the LLM is heavily biased towards certain code, maybe because blog entries promoting their libary got too much weight, but looking at a random js source of a webpage - they do mostly ship tons of garbage).
I am gladly writing my own left-pad.
I am gladly using something like three.js if I need it.
The problem are the extreme stances. Don't add any dependency is as stupid as pulling in dependencies for every second line.