diff --git a/npmjs.com/index.js b/npmjs.com/index.js index 9927c3c..35b0a5d 100644 --- a/npmjs.com/index.js +++ b/npmjs.com/index.js @@ -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); }