Posted by David Haney , Lead Software Engineer, Stack Overflow.So, developers, time for a serious conversation. You probably already know that this week React, Babel and a bunch of other popular packages on NPM have broken. The reason is pretty amazing.
A simple NPM package called left-pad was installed as a dependency in React, Babel, and other packages. The module, which at the time of writing this post,
has 11 stars on Github (now 323 - comment). The whole package consists of
11 simple lines that implement the primitive function of inserting spaces in the left part of the lines. If any of the links ever die, here is his code:
')
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;
}
,
,
, 2 .
, - left-pad, NPM. , :
…
?
? 28 000 - , ?
, NPM . , , - - . , NPM , , , .
—
, . ; . ? - «», , . , .NET . , .
, - . , ? , , , . 1 .
-, , , , . left-pad, is-positive-integer isArray ( Google), . , , .
, API . - , , .
, , , , .
. , , — ,
, . , . : - , , ?
, . (ORM) , .
, , , . — . ? React, , , 11 .