655 karma · joined June 18, 2012
Depending on 200 tiny modules, you have 200 different risks vs just having 1 risk.
var zero = require("number-zero");
var hundred = require("number-one-hundred");
var isDivisibleBy5 = require("is-divisible-by-5");
var isDivisibleBy3 = require("is-divisible-by-3");
var isDivisibleBy5and3 = require("is-divisible-by-5-and-3");
var numberToString = require("number-that-is-between-one-and-hundred-to-string");
var fizzbuzz = require("string-fizz-buzz");
var fizz = require("string-fizz");
var buzz = require("string-buzz");
var incrementByOne = require("increment-by-one");
var forLoop = require("for-loop");
var ifCondition = require("if-condition");
var elseIfCondition = require("else-if-condition");
var elseCondition = require("else-condition");
var lessThan = require("less-than");
var print = require("print-string");
forLoop(zero, lessThan(hundred), incrementByOne, function(i) {
condition(isDivisibleBy5and3, print(fizzbuzz),
elseIfCondition(isDivisibleBy3, print(fizz),
elseIfCondition(isDivisibleBy5, print(buzz),
elseCondition(print(numberToString(i))))));
});And just because some random guy didn't get something as trivial as this right the first time, doesn't mean nobody else can. Also the de facto standard library lodash already has padding utilities, made by people who have a proven track record.
This has nothing to do with the JavaScript standard library but the insanity of NPM. There are modules that have even more dependents than `pad-left` despite being included in the standard library (e.g. https://www.npmjs.com/package/date-now, https://www.npmjs.com/package/is-positive, https://www.npmjs.com/package/is-lower-case)
Many times it is even faster to write a trivial "module" yourself than even discover it on npm, let alone reading and verifying it. Hell, NPM 3.x is so slow that it's literally faster to write any 1 liner "module" than it is just to install it.
"Reuse" is just a means to an end, it doesn't make sense to do it only for its own sake.
1. https://github.com/WebAssembly/design/blob/master/AstSemanti...
1. https://developers.google.com/v8/experiments#strong-mode
2. https://groups.google.com/forum/#!msg/strengthen-js/ojj3TDxb...