Skip to content

Commit

Permalink
compact npmjs.com script
Browse files Browse the repository at this point in the history
  • Loading branch information
avindra committed May 17, 2024
1 parent 7a4c3a4 commit 6471685
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions npmjs.com/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,17 @@ const listItem = (text, href) => {

if (repos) {
const pkg = document.querySelector("#top h1 span").textContent;
list.append(
listItem("Bundlephobia", `https://bundlephobia.com/package/${pkg}`),
);

list.append(
listItem("npm-stat", `https://npm-stat.com/charts.html?package=${pkg}`),
);

list.append(
listItem("Packagephobia", `https://packagephobia.com/result?p=${pkg}`),
);

list.append(
listItem("pkg-size.dev", `https://pkg-size.dev/${pkg}`)
);
const sites = [
["Bundlephobia", `https://bundlephobia.com/package/${pkg}`],
["npm-stat", `https://npm-stat.com/charts.html?package=${pkg}`],
["Packagephobia", `https://packagephobia.com/result?p=${pkg}`],
["pkg-size.dev", `https://pkg-size.dev/${pkg}`],
];

sites.forEach((data) => {
const [label, site] = data;
list.append(listItem(label, site));
});

repos.parentNode.append(list);
}

0 comments on commit 6471685

Please sign in to comment.