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 848f355
Showing 1 changed file with 10 additions and 15 deletions.
25 changes: 10 additions & 15 deletions npmjs.com/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,16 @@ 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}`],
];

for (const [label, site] of sites) {
list.append(listItem(label, site));
}

repos.parentNode.append(list);
}

0 comments on commit 848f355

Please sign in to comment.