📜 ⬆️ ⬇️

One developer nearly broke the NPM package manager

Web developer Azer Kochulu (Azer Koçulu), the author of more than 250 modules for Node.js , got into trouble. In his blog, he writes that a few weeks ago he received a letter from Kik’s lawyer (messenger) demanding to withdraw the module with the same name kik from the NPM package manager (Node Package Manager).

The programmer refused, then the lawyer applied directly to NPM, and the project administration satisfied his requirement, changing the owner of kik without the permission of the author.

Azer Kochulu was extremely dissatisfied with this. I am so unhappy that I decided to “release” (that is, withdraw) all my modules - over 250 NPM modules. Unfortunately, among them was left-pad , a small module of 11 lines of JavaScript code. It is used when installing dependencies between packages via NPM, including Node.js, the Babel javascript-transcriptor and a huge number of other builds. Last month alone, the left-pad downloaded 2,486,696 from the NPM server, according to their statistics.

The left-pad code is shown below. It simply fills the left side of the string with zeros or spaces.
')
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;
}

, NPM .

, NPM (Laurie Voss) ( ) , « », . , .

, NPM . Open Source «- NPM». -, . Kik Github.

Source: https://habr.com/ru/post/280039/


All Articles